From ae21175b2b248460164a024c6c692bee523b3768 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Sat, 25 Mar 2023 11:27:04 -0400 Subject: [PATCH 01/10] General Maintenance --- dist/glimmer.cjs.cjs | 30 +- package.json | 3 +- pnpm-lock.yaml | 263 +++++++++++++++++- tests-cjs/package.json | 8 +- .../__snapshots__/injections.test.js.snap | 14 +- tests-esm/unit/injections.test.js | 159 ++++++----- 6 files changed, 397 insertions(+), 80 deletions(-) diff --git a/dist/glimmer.cjs.cjs b/dist/glimmer.cjs.cjs index 48f29dda..83d39b57 100644 --- a/dist/glimmer.cjs.cjs +++ b/dist/glimmer.cjs.cjs @@ -161,6 +161,7 @@ function glimmer(hljs) { end: /"/, contains: [ XML_ENTITIES + /* MUSTACHE_EXPRESSION added later */ ] }, { @@ -168,6 +169,7 @@ function glimmer(hljs) { end: /'/, contains: [ XML_ENTITIES + /* MUSTACHE_EXPRESSION added later */ ] } ] @@ -180,8 +182,19 @@ function glimmer(hljs) { BLOCK_PARAMS, THIS_EXPRESSION, ATTRIBUTES, + // { + // className: 'variable', + // keywords: KEYWORDS, + // match: /\s[\w\d-_^]+/ + // }, + // { + // match: /\b[a-z][a-zA-Z0-9-]+\b/, + // keywords: KEYWORDS, + // className: 'keyword' + // }, CURLY_NAME, STRING + // NAME, ]; const SUB_EXPRESSION = { keywords: KEYWORDS, @@ -189,6 +202,7 @@ function glimmer(hljs) { /\(/, regex.lookahead( regex.concat( + // /[^)]+/, /\)/ ) ) @@ -241,6 +255,7 @@ function glimmer(hljs) { ABS_NAME ] }, + // close tag { className: "tag", begin: regex.concat(/<\/:?/, regex.lookahead(regex.concat(TAG_NAME, />/))), @@ -317,10 +332,21 @@ function setupTemplateTag(_hljs, js) { const GLIMMER_TEMPLATE_TAG = { begin: / `, - 'js' + "js" ); formattedEquals( @@ -98,21 +109,21 @@ describe('Injections | JS', () => { list( // These are JS and not tagged by us `import Greeting from './greeting.js';`, - '\n', + "\n", `import WeatherSummary from './weather-summary.js';`, - '\n', - '\n', + "\n", + "\n", glimmer( template( - tags.element('div', [ - tags.selfClosing('Greeting', [ - ' ', - tags.arg('name'), + tags.element("div", [ + tags.selfClosing("Greeting", [ + " ", + tags.arg("name"), tags.operator.equals, - tags.string('Chris'), + tags.string("Chris"), ]), - '\n', - tags.selfClosing('WeatherSummary'), + "\n", + tags.selfClosing("WeatherSummary"), ]) ) ) @@ -120,7 +131,25 @@ describe('Injections | JS', () => { ); }); - test('a function exists above the template', () => { + test("a setTimeout exists above the template", () => { + let result = parse( + stripIndent` + const demo = new Demo(); + + setTimeout(() => { + demo.theProperty = 2; + }, 500); + + `, - 'js' + "js" ); formattedEquals( @@ -161,37 +190,37 @@ describe('Injections | JS', () => { dateOfBirth.getMonth() === now.getMonth() ); }`, - '\n', - '\n', + "\n", + "\n", glimmer( template( - tags.element('div', [ - tags.selfClosing('Greeting', [ - ' ', - tags.arg('name'), + tags.element("div", [ + tags.selfClosing("Greeting", [ + " ", + tags.arg("name"), tags.operator.equals, - tags.string('Chris'), + tags.string("Chris"), ]), - '\n', + "\n", tags.mustache( - '#', - tag('title', tag('built_in', 'if')), - tag('punctuation', '('), - tag('title', 'isBirthday'), - ' ', - tag('punctuation', '@'), - tag('params', 'user'), - tag('punctuation', '.'), - tag('title', 'dateOfBirth'), - tag('punctuation', ')') + "#", + tag("title", tag("built_in", "if")), + tag("punctuation", "("), + tag("title", "isBirthday"), + " ", + tag("punctuation", "@"), + tag("params", "user"), + tag("punctuation", "."), + tag("title", "dateOfBirth"), + tag("punctuation", ")") ), - tags.selfClosing('Celebration', [ - tag('attribute', 'type'), + tags.selfClosing("Celebration", [ + tag("attribute", "type"), tags.operator.equals, - tag('string', [''', 'birthday', ''']), + tag("string", ["'", "birthday", "'"]), ]), - tags.mustache('/', tag('title', tag('built_in', 'if'))), - tags.selfClosing('WeatherSummary'), + tags.mustache("/", tag("title", tag("built_in", "if"))), + tags.selfClosing("WeatherSummary"), ]) ) ) @@ -199,7 +228,7 @@ describe('Injections | JS', () => { ); }); - test('is embedded in a class', () => { + test("is embedded in a class", () => { let result = parse( stripIndent` import Component from '@glimmer/component'; @@ -236,13 +265,13 @@ describe('Injections | JS', () => { } `, - 'js' + "js" ); expect(format(result)).toMatchSnapshot(); }); - test('multiple components', () => { + test("multiple components", () => { let result = parse( stripIndent` import WeatherSummary from './weather-summary.js'; @@ -269,7 +298,7 @@ describe('Injections | JS', () => { `, - 'js' + "js" ); expect(format(result)).toMatchSnapshot(); From def7bb5e17b9296b275eabef72baffb7f1bfe30b Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Sat, 25 Mar 2023 11:46:24 -0400 Subject: [PATCH 02/10] Swap for changeset --- .changeset/README.md | 8 + .changeset/config.json | 14 + .changeset/selfish-books-smash.md | 21 + .github/actions/pnpm/action.yml | 14 - .github/workflows/ci.yml | 44 +- package.json | 27 +- pnpm-lock.yaml | 2074 ++++++++--------------------- 7 files changed, 616 insertions(+), 1586 deletions(-) create mode 100644 .changeset/README.md create mode 100644 .changeset/config.json create mode 100644 .changeset/selfish-books-smash.md delete mode 100644 .github/actions/pnpm/action.yml diff --git a/.changeset/README.md b/.changeset/README.md new file mode 100644 index 00000000..e5b6d8d6 --- /dev/null +++ b/.changeset/README.md @@ -0,0 +1,8 @@ +# Changesets + +Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works +with multi-package repos, or single-package repos to help you version and publish your code. You can +find the full documentation for it [in our repository](https://github.com/changesets/changesets) + +We have a quick list of common questions to get you started engaging with this project in +[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 00000000..d4c33cf1 --- /dev/null +++ b/.changeset/config.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json", + "changelog": [ + "@changesets/changelog-github", + { "repo": "NullVoxPopuli/highlightjs-glimmer" } + ], + "commit": false, + "fixed": [], + "linked": [], + "access": "restricted", + "baseBranch": "main", + "updateInternalDependencies": "patch", + "ignore": ["hljs-glimmer-tests-cjs", "hljs-glimmer-tests-esm"] +} diff --git a/.changeset/selfish-books-smash.md b/.changeset/selfish-books-smash.md new file mode 100644 index 00000000..d1506870 --- /dev/null +++ b/.changeset/selfish-books-smash.md @@ -0,0 +1,21 @@ +--- +"highlightjs-glimmer": patch +--- + +Fix issue where the `