From e4272bf1d5ba849152fafddd9745e2dcc4fec639 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 1 May 2023 16:58:31 -0700 Subject: [PATCH 1/3] Modernize Infrastructure Highlights: - updated `typescript` to `5.0.4`. - updated eslint and associated packages to the latest version - updated prettier and associated packages - updated babel and associated packages - updated to pnpm and pnpm workspaces The biggest consequence of this commit is that packages should *reliably* have dependencies on the packages they depend on. This required moving a handful of interfaces to `@glimmer/interfaces`: - The `Reference` type and associated types - The `Tag` type and associated types - All of the `SimpleDOM` types, to avoid duplication problems Where a symbol is part of an interface, `@glimmer/interface` declares the symbol. The concrete implementation assigns its symbol to the symbol type exported by `@glimmer/interface`. This commit also refactors away from `const enum` in a few key places. Const enums were refactored into normal unions, and the members of a const enum were refactored into type literal types. --- .editorconfig | 3 + .eslintrc.json | 54 +- .github/workflows/ci.yml | 87 +- .github/workflows/perf.yml | 16 +- .vscode/settings.json | 21 +- RELEASE.md | 19 +- benchmark/benchmarks/krausest/lib/index.js | 2 +- benchmark/package.json | 2 +- lib/local-linker/package.json | 2 +- package.json | 101 +- packages/@glimmer/benchmark-env/package.json | 20 +- .../src/benchmark/basic-component-manager.ts | 3 +- .../src/benchmark/create-registry.ts | 22 +- .../src/benchmark/on-modifier.ts | 2 +- .../src/benchmark/render-benchmark.ts | 2 +- .../benchmark-env/src/benchmark/util.ts | 2 +- .../@glimmer/benchmark-env/src/interfaces.ts | 2 +- packages/@glimmer/compiler/index.ts | 10 +- .../compiler/lib/builder/builder-interface.ts | 19 +- .../@glimmer/compiler/lib/builder/builder.ts | 3 +- packages/@glimmer/compiler/lib/compiler.ts | 6 +- .../lib/passes/1-normalization/keywords.ts | 2 +- .../passes/1-normalization/keywords/append.ts | 4 +- .../passes/1-normalization/keywords/block.ts | 28 +- .../passes/1-normalization/keywords/impl.ts | 3 +- .../keywords/utils/if-unless.ts | 4 +- .../@glimmer/compiler/lib/shared/result.ts | 2 +- packages/@glimmer/compiler/package.json | 11 +- .../@glimmer/compiler/test/compiler-test.ts | 2 +- packages/@glimmer/debug/lib/debug.ts | 13 +- packages/@glimmer/debug/lib/metadata.ts | 4 +- packages/@glimmer/debug/lib/stack-check.ts | 2 +- packages/@glimmer/debug/package.json | 10 +- packages/@glimmer/destroyable/index.ts | 2 +- packages/@glimmer/destroyable/package.json | 6 +- .../destroyable/test/destroyables-test.ts | 212 +- .../dom-change-list/lib/dom-operations.ts | 17 +- .../dom-change-list/lib/node-tokens.ts | 5 +- .../dom-change-list/lib/tree-builder.ts | 12 +- .../dom-change-list/lib/tree-construction.ts | 5 +- .../@glimmer/dom-change-list/package.json | 7 +- .../dom-change-list/test/change-list-test.ts | 6 +- .../@glimmer/dom-change-list/test/support.ts | 2 +- .../dom-change-list/test/test-case.ts | 7 +- .../dom-change-list/test/tree-builder-test.ts | 6 +- packages/@glimmer/encoder/package.json | 4 +- .../lib/components/emberish-curly.ts | 41 +- .../integration-tests/lib/dom/assertions.ts | 4 +- .../integration-tests/lib/dom/simple-utils.ts | 18 +- .../lib/modes/jit/delegate.ts | 10 +- .../lib/modes/jit/register.ts | 2 +- .../integration-tests/lib/modes/node/env.ts | 8 +- .../lib/modes/rehydration/builder.ts | 2 +- .../lib/modes/rehydration/delegate.ts | 2 +- .../partial-rehydration-delegate.ts | 2 +- .../integration-tests/lib/modifiers.ts | 5 +- .../integration-tests/lib/render-delegate.ts | 2 +- .../integration-tests/lib/render-test.ts | 2 +- .../integration-tests/lib/snapshot.ts | 14 +- .../lib/suites/custom-dom-helper.ts | 6 +- .../integration-tests/lib/suites/debugger.ts | 20 +- .../integration-tests/lib/suites/each.ts | 4 +- .../lib/suites/emberish-components.ts | 4 +- .../lib/suites/entry-point.ts | 21 +- .../lib/suites/in-element.ts | 6 +- .../lib/suites/initial-render.ts | 46 +- .../lib/test-helpers/module.ts | 5 +- .../@glimmer/integration-tests/package.json | 34 +- .../integration-tests/test/attributes-test.ts | 128 +- .../test/chaos-rehydration-test.ts | 28 +- .../test/compiler/compile-options-test.ts | 14 +- .../test/debug-render-tree-test.ts | 16 +- .../test/ember-component-test.ts | 57 +- .../integration-tests/test/helpers/fn-test.ts | 16 +- .../test/helpers/hash-test.ts | 2 +- .../integration-tests/test/i-n-u-r-test.ts | 6 +- .../test/initial-render-test.ts | 34 +- .../test/input-range-test.ts | 10 +- .../test/invocation-generation-test.ts | 50 +- .../test/managers/helper-manager-test.ts | 54 +- .../test/managers/modifier-manager-test.ts | 46 +- .../integration-tests/test/modifiers-test.ts | 34 +- .../test/modifiers/on-test.ts | 45 +- .../integration-tests/test/owner-test.ts | 2 +- .../test/partial-rehydration-test.ts | 4 +- .../integration-tests/test/precompile-test.ts | 4 +- .../test/strict-mode-test.ts | 2 +- .../test/updating-content-matrix-test.ts | 7 +- .../test/updating-modifiers-test.ts | 2 +- .../test/updating-svg-test.ts | 65 +- .../integration-tests/test/updating-test.ts | 20 +- packages/@glimmer/interfaces/index.d.ts | 3 + .../@glimmer/interfaces/lib/components.d.ts | 2 +- .../@glimmer/interfaces/lib/dom/simple.d.ts | 16 + .../interfaces/lib/dom/tree-construction.d.ts | 7 +- .../lib/managers/internal/component.d.ts | 2 +- .../lib/managers/internal/modifier.d.ts | 4 +- packages/@glimmer/interfaces/lib/program.d.ts | 4 + .../@glimmer/interfaces/lib/references.d.ts | 26 +- .../interfaces/lib/runtime/arguments.d.ts | 9 +- .../interfaces/lib/runtime/element.d.ts | 3 +- .../interfaces/lib/runtime/helper.d.ts | 2 +- .../interfaces/lib/runtime/scope.d.ts | 2 +- .../@glimmer/interfaces/lib/runtime/vm.d.ts | 3 +- packages/@glimmer/interfaces/lib/tags.d.ts | 56 + .../@glimmer/interfaces/lib/template.d.ts | 7 +- .../@glimmer/manager/lib/public/component.ts | 3 +- .../@glimmer/manager/lib/public/modifier.ts | 16 +- packages/@glimmer/manager/package.json | 13 +- .../manager/test/capabilities-test.ts | 42 +- .../@glimmer/manager/test/managers-test.ts | 294 +- packages/@glimmer/node/lib/node-dom-helper.ts | 2 +- .../@glimmer/node/lib/serialize-builder.ts | 4 +- packages/@glimmer/node/package.json | 13 +- .../lib/opcode-builder/context.ts | 6 +- .../lib/opcode-builder/helpers/resolution.ts | 2 +- .../lib/opcode-builder/helpers/stdlib.ts | 3 +- .../opcode-compiler/lib/program-context.ts | 7 +- .../@glimmer/opcode-compiler/package.json | 18 +- packages/@glimmer/owner/package.json | 2 +- packages/@glimmer/owner/test/owner-test.ts | 2 +- packages/@glimmer/program/lib/constants.ts | 3 +- packages/@glimmer/program/package.json | 12 +- .../@glimmer/program/test/artifacts-test.ts | 2 +- packages/@glimmer/program/test/heap-test.ts | 13 +- packages/@glimmer/reference/lib/reference.ts | 54 +- packages/@glimmer/reference/package.json | 8 +- .../@glimmer/reference/test/iterable-test.ts | 20 +- .../reference/test/references-test.ts | 154 +- packages/@glimmer/runtime/lib/bounds.ts | 2 +- .../runtime/lib/compat/svg-inner-html-fix.ts | 2 +- .../lib/compat/text-node-merging-fix.ts | 2 +- .../runtime/lib/compiled/opcodes/component.ts | 7 +- .../@glimmer/runtime/lib/debug-render-tree.ts | 3 +- packages/@glimmer/runtime/lib/dom/helper.ts | 2 +- .../@glimmer/runtime/lib/dom/normalize.ts | 2 +- .../@glimmer/runtime/lib/dom/operations.ts | 2 +- packages/@glimmer/runtime/lib/dom/props.ts | 2 +- .../runtime/lib/dom/sanitized-values.ts | 4 +- .../@glimmer/runtime/lib/helpers/array.ts | 10 +- .../@glimmer/runtime/lib/helpers/concat.ts | 2 +- packages/@glimmer/runtime/lib/helpers/fn.ts | 2 +- packages/@glimmer/runtime/lib/helpers/hash.ts | 54 +- packages/@glimmer/runtime/lib/modifiers/on.ts | 10 +- packages/@glimmer/runtime/lib/vm/append.ts | 2 +- .../runtime/lib/vm/attributes/dynamic.ts | 2 +- .../@glimmer/runtime/lib/vm/content/text.ts | 2 +- .../runtime/lib/vm/element-builder.ts | 2 +- .../runtime/lib/vm/rehydrate-builder.ts | 2 +- .../@glimmer/runtime/lib/vm/render-result.ts | 2 +- packages/@glimmer/runtime/lib/vm/update.ts | 2 +- packages/@glimmer/runtime/package.json | 30 +- packages/@glimmer/syntax/index.ts | 48 +- packages/@glimmer/syntax/lib/parser.ts | 4 +- .../lib/parser/handlebars-node-visitors.ts | 4 +- .../lib/parser/tokenizer-event-handlers.ts | 11 +- packages/@glimmer/syntax/lib/source/index.ts | 4 +- packages/@glimmer/syntax/lib/source/span.ts | 2 +- .../@glimmer/syntax/lib/traversal/-index.ts | 4 +- .../@glimmer/syntax/lib/traversal/errors.ts | 2 +- .../@glimmer/syntax/lib/traversal/traverse.ts | 4 +- .../@glimmer/syntax/lib/traversal/walker.ts | 2 +- packages/@glimmer/syntax/lib/v1/api.ts | 3 +- .../@glimmer/syntax/lib/v1/legacy-interop.ts | 2 +- .../@glimmer/syntax/lib/v1/public-builders.ts | 4 +- packages/@glimmer/syntax/lib/v2-a/api.ts | 6 +- .../@glimmer/syntax/lib/v2-a/normalize.ts | 14 +- packages/@glimmer/syntax/package.json | 6 +- .../syntax/test/generation/print-test.ts | 14 +- .../@glimmer/syntax/test/loc-node-test.ts | 3 + .../@glimmer/syntax/test/plugin-node-test.ts | 11 +- .../test/traversal/visiting-node-test.ts | 7 +- packages/@glimmer/util/lib/dom.ts | 2 +- .../util/lib/is-serialization-first-node.ts | 2 +- packages/@glimmer/util/lib/platform-utils.ts | 2 +- packages/@glimmer/util/lib/simple-cast.ts | 2 +- packages/@glimmer/util/package.json | 8 +- packages/@glimmer/util/test/immediate-test.ts | 9 +- packages/@glimmer/validator/index.ts | 8 +- packages/@glimmer/validator/lib/debug.ts | 13 +- packages/@glimmer/validator/lib/meta.ts | 3 +- packages/@glimmer/validator/lib/tracking.ts | 4 +- packages/@glimmer/validator/lib/validators.ts | 77 +- packages/@glimmer/validator/package.json | 3 +- packages/@glimmer/validator/test/meta-test.ts | 2 +- .../@glimmer/validator/test/tracking-test.ts | 38 +- .../validator/test/validators-test.ts | 6 +- packages/@glimmer/vm/package.json | 4 +- packages/@glimmer/wire-format/package.json | 4 +- pnpm-lock.yaml | 11840 ++++++++++++++++ pnpm-workspace.yaml | 5 + .../tsconfig.json => tsconfig.build.json | 15 +- yarn.lock | 10525 -------------- 193 files changed, 13419 insertions(+), 11975 deletions(-) create mode 100644 packages/@glimmer/interfaces/lib/dom/simple.d.ts create mode 100644 packages/@glimmer/interfaces/lib/tags.d.ts create mode 100644 pnpm-lock.yaml create mode 100644 pnpm-workspace.yaml rename benchmark/benchmarks/krausest/tsconfig.json => tsconfig.build.json (53%) delete mode 100644 yarn.lock diff --git a/.editorconfig b/.editorconfig index 219985c228..44ffe996f1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,6 +13,9 @@ insert_final_newline = true indent_style = space indent_size = 2 +[*.json] +max_line_length = 80 + [*.hbs] insert_final_newline = false diff --git a/.eslintrc.json b/.eslintrc.json index 23df137eb3..96413d4afa 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,19 +2,24 @@ "root": true, "parser": "@typescript-eslint/parser", "parserOptions": { - "ecmaVersion": 2020 + "ecmaVersion": "latest", + "project": ["tsconfig.json", "tsconfig.build.json", "packages/@glimmer/vm/tsconfig.json"] }, "extends": [ "eslint:recommended", "plugin:@typescript-eslint/eslint-recommended", "plugin:qunit/recommended", - "plugin:qunit/two", "plugin:node/recommended", - "prettier", - "prettier/@typescript-eslint" + "prettier" ], "plugins": ["@typescript-eslint", "prettier", "qunit"], "settings": { + "import/resolver": { + "typescript": {} + }, + "import/parsers": { + "@typescript-eslint/parser": [".js", ".ts", ".d.ts"] + }, "node": { "allowModules": ["@glimmer/debug", "@glimmer/local-debug-flags"], "tryExtensions": [".js", ".ts", ".d.ts", ".json"] @@ -192,7 +197,11 @@ "parserOptions": { "project": "./tsconfig.json" }, - "files": ["packages/@glimmer/compiler/**/*.ts", "packages/@glimmer/syntax/lib/**/*.ts", "packages/@glimmer/syntax/index.ts"], + "files": [ + "packages/@glimmer/compiler/**/*.ts", + "packages/@glimmer/syntax/lib/**/*.ts", + "packages/@glimmer/syntax/index.ts" + ], "extends": [ // "plugin:@typescript-eslint/recommended-requiring-type-checking", "eslint:recommended", @@ -200,17 +209,14 @@ "plugin:import/errors", "plugin:import/typescript", "plugin:qunit/recommended", - "plugin:qunit/two", "plugin:node/recommended", - "prettier", - "prettier/@typescript-eslint" - ], - "plugins": [ - "simple-import-sort" + "prettier" ], + "plugins": ["simple-import-sort"], "rules": { "prefer-const": ["off"], - "simple-import-sort/sort": ["error"], + "simple-import-sort/imports": ["error"], + "simple-import-sort/exports": ["error"], "import/order": "off", "sort-imports": "off", "import/first": ["error"], @@ -227,16 +233,20 @@ } ], "@typescript-eslint/no-explicit-any": [ - "error", { + "error", + { "ignoreRestArgs": true } ], - "@typescript-eslint/ban-types": ["error", { - "extendDefaults": true, - "types": { - "object": false + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true, + "types": { + "object": false + } } - }] + ] } }, { @@ -290,9 +300,7 @@ } }, { - "files": [ - "packages/build-utils/@glimmer/vm-babel-plugins/test/**/*.js" - ], + "files": ["packages/build-utils/@glimmer/vm-babel-plugins/test/**/*.js"], "env": { "es6": true, "node": true, @@ -403,10 +411,6 @@ // these packages need to be fixed to avoid these warnings, but in the // meantime we should not regress the other packages "files": [ - // @glimmer/interfaces should not import for any other @glimmer package - // but it currently imports from @glimmer/reference and @glimmer/validator - "packages/@glimmer/interfaces/**/*.ts", - // this specific test imports from @glimmer/runtime (causing a cyclic // dependency), it should either be refactored to use the interfaces // directly (instead of the impls) or moved into @glimmer/runtime diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f2e2bf8b68..000158b45d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,53 +12,52 @@ on: - cron: '0 3 * * *' # daily, at 3am jobs: + install_dependencies: + name: "Install Dependencies" + runs-on: "ubuntu-latest" + + steps: + - uses: actions/checkout@v3 + - uses: NullVoxPopuli/action-setup-pnpm@v2 + lint: name: Linting runs-on: ubuntu-latest + needs: ["install_dependencies"] timeout-minutes: 10 steps: - - uses: actions/checkout@v2 - - uses: volta-cli/action@v1 - - - name: install dependencies - run: yarn install --frozen-lockfile - - - run: yarn lint + - uses: actions/checkout@v3 + - uses: NullVoxPopuli/action-setup-pnpm@v2 + - run: pnpm lint test-chrome: name: Chrome runs-on: ubuntu-latest + needs: ["install_dependencies"] timeout-minutes: 10 steps: - - uses: actions/checkout@v2 - - uses: volta-cli/action@v1 - - - name: install dependencies - run: yarn install --frozen-lockfile + - uses: actions/checkout@v3 + - uses: NullVoxPopuli/action-setup-pnpm@v2 + - run: pnpm test - - run: yarn test test-node: - name: Node + name: Chrome runs-on: ubuntu-latest + needs: ["install_dependencies"] timeout-minutes: 10 steps: - - uses: actions/checkout@v2 - - uses: volta-cli/action@v1 - - - name: install dependencies - run: yarn install --frozen-lockfile - - - run: yarn ember build - - run: yarn test:node - - run: yarn test:babel-plugins + - uses: actions/checkout@v3 + - uses: NullVoxPopuli/action-setup-pnpm@v2 + - run: pnpm test test-browserstack: name: Browserstack runs-on: ubuntu-latest + needs: ["install_dependencies"] timeout-minutes: 20 env: @@ -66,44 +65,34 @@ jobs: BROWSERSTACK_ACCESS_KEY: 7DFjbGLxYRsXWmc8tzeh steps: - - uses: actions/checkout@v2 - - uses: volta-cli/action@v1 - - - name: install dependencies - run: yarn install --frozen-lockfile - - - run: yarn browserstack:connect - - run: yarn test:browserstack - - run: yarn browserstack:results - - run: yarn browserstack:disconnect + - uses: actions/checkout@v3 + - uses: NullVoxPopuli/action-setup-pnpm@v2 + - run: pnpm browserstack:connect + - run: pnpm test:browserstack + - run: pnpm browserstack:results + - run: pnpm browserstack:disconnect test-types: name: Types runs-on: ubuntu-latest + needs: ["install_dependencies"] timeout-minutes: 10 steps: - - uses: actions/checkout@v2 - - uses: volta-cli/action@v1 - - - name: install dependencies - run: yarn install --frozen-lockfile - - - run: yarn build - - run: yarn test:types + - uses: actions/checkout@v3 + - uses: NullVoxPopuli/action-setup-pnpm@v2 + - run: pnpm build + - run: pnpm test:types floating-dependencies: name: Floating Dependencies runs-on: ubuntu-latest + needs: ["install_dependencies"] timeout-minutes: 10 steps: - - uses: actions/checkout@v2 - - uses: volta-cli/action@v1 + - uses: actions/checkout@v3 + - uses: NullVoxPopuli/action-setup-pnpm@v2 with: - node-version: 12.x - - - name: install dependencies - run: yarn install --no-lockfile - - - run: yarn test + args: '--no-lockfile' + - run: pnpm test diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index 9a335bb43a..0a1a5bb143 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -12,28 +12,28 @@ jobs: name: Glimmer Krausest Benchmark runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: volta-cli/action@v1 + - uses: NullVoxPopuli/action-setup-pnpm@v2 - name: Build Control run: | git checkout ${{ github.event.pull_request.base.sha }} - yarn install --frozen-lockfile - yarn ember build --env production --suppress-sizes --output-path control-dist + pnpm install --frozen-lockfile + pnpm ember build --env production --suppress-sizes --output-path control-dist - name: Build Experiment run: | git checkout ${{ github.sha }} - yarn install --frozen-lockfile - yarn ember build --env production --suppress-sizes --output-path dist + pnpm install --frozen-lockfile + pnpm ember build --env production --suppress-sizes --output-path dist - name: Run Analysis timeout-minutes: 10 uses: tracerbench/tracerbench-compare-action@master with: build-control: false build-experiment: false - control-serve-command: yarn benchmark:control - experiment-serve-command: yarn benchmark:experiment + control-serve-command: pnpm benchmark:control + experiment-serve-command: pnpm benchmark:experiment control-url: http://localhost:3000/krausest/ experiment-url: http://localhost:3001/krausest/ regression-threshold: 25 diff --git a/.vscode/settings.json b/.vscode/settings.json index b2f3e470b0..efe5c6ad4b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ // Place your settings in this file to overwrite default and user settings. { + "explorer.excludeGitIgnore": true, "search.exclude": { "tmp": true }, @@ -23,9 +24,10 @@ "editor.tabSize": 2, "editor.formatOnSave": true, "editor.defaultFormatter": "dbaeumer.vscode-eslint", + "eslint.format.enable": true, "typescript.tsc.autoDetect": "on", "javascript.updateImportsOnFileMove.enabled": "always", - "typescript.preferences.importModuleSpecifier": "relative", + "typescript.preferences.importModuleSpecifier": "project-relative", "javascript.preferences.importModuleSpecifier": "relative", "typescript.tsdk": "node_modules/typescript/lib", "typescript.workspaceSymbols.scope": "currentProject", @@ -35,5 +37,20 @@ "changeProcessCWD": true } ], - "eslint.enable": true + "eslint.enable": true, + "[yaml]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[typescript]": { + "editor.defaultFormatter": "dbaeumer.vscode-eslint" + }, + "[markdown]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[jsonc]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + } } diff --git a/RELEASE.md b/RELEASE.md index 55e91ed6e2..228eaee7b8 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,8 @@ # Release Process +> **Warning** +> this file is currently outdated, but will be updated soon. + Releases are mostly automated using [release-it](https://github.com/release-it/release-it/) and [lerna-changelog](https://github.com/lerna/lerna-changelog/). @@ -17,24 +20,24 @@ guiding principle here is that changelogs are for humans, not machines. When reviewing merged PR's the labels to be used are: -* breaking - Used when the PR is considered a breaking change. -* enhancement - Used when the PR adds a new feature or enhancement. -* bug - Used when the PR fixes a bug included in a previous release. -* documentation - Used when the PR adds or updates documentation. -* internal - Used for internal changes that still require a mention in the +- breaking - Used when the PR is considered a breaking change. +- enhancement - Used when the PR adds a new feature or enhancement. +- bug - Used when the PR fixes a bug included in a previous release. +- documentation - Used when the PR adds or updates documentation. +- internal - Used for internal changes that still require a mention in the changelog/release notes. ## Release Once the prep work is completed, the actual release is straight forward: -* First, ensure that you have installed your projects dependencies: +- First, ensure that you have installed your projects dependencies: ```sh yarn install ``` -* Second, ensure that you have obtained a +- Second, ensure that you have obtained a [GitHub personal access token][generate-token] with the `repo` scope (no other permissions are needed). Make sure the token is available as the `GITHUB_AUTH` environment variable. @@ -47,7 +50,7 @@ yarn install [generate-token]: https://github.com/settings/tokens/new?scopes=repo&description=GITHUB_AUTH+env+variable -* And last (but not least 😁) do your release. +- And last (but not least 😁) do your release. ```sh npx release-it diff --git a/benchmark/benchmarks/krausest/lib/index.js b/benchmark/benchmarks/krausest/lib/index.js index 5d5cba2a65..84807ecfab 100644 --- a/benchmark/benchmarks/krausest/lib/index.js +++ b/benchmark/benchmarks/krausest/lib/index.js @@ -7,7 +7,7 @@ import Row from './components/Row'; import buildData from './utils/data'; /** - * @param {HTMLElement | import('@simple-dom/interface').SimpleElement} element + * @param {HTMLElement | import('@glimmer/interfaces').SimpleElement} element * @param {boolean} isInteractive */ export default async function render(element, isInteractive) { diff --git a/benchmark/package.json b/benchmark/package.json index cfc037c591..8122f6125b 100644 --- a/benchmark/package.json +++ b/benchmark/package.json @@ -3,7 +3,7 @@ "version": "0.84.3", "private": true, "dependencies": { - "@glimmer/benchmark-env": "0.84.3", + "@glimmer/benchmark-env": "workspace:^", "@simple-dom/document": "^1.4.0", "@simple-dom/serializer": "^1.4.0", "@simple-dom/void-map": "^1.4.0" diff --git a/lib/local-linker/package.json b/lib/local-linker/package.json index c14b21fbe4..cca3e5de2f 100644 --- a/lib/local-linker/package.json +++ b/lib/local-linker/package.json @@ -1,6 +1,6 @@ { "name": "local-linker", - "version": "0.84.3", + "version": "workspace:^", "private": true, "keywords": [ "ember-addon" diff --git a/package.json b/package.json index de66a315ee..e8a57e8ec0 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,6 @@ }, "license": "MIT", "author": "Tilde, Inc.", - "workspaces": [ - "benchmark", - "lib/local-linker", - "packages/@glimmer/*", - "packages/build-utils/@glimmer/*" - ], "scripts": { "benchmark:build": "node benchmark/bin/build.js", "benchmark:control": "node benchmark/bin/control.js", @@ -28,6 +22,7 @@ "link:local": "node bin/yarn-link-local", "lint": "npm-run-all lint:*", "lint:files": "eslint . --cache", + "force:lint:files": "eslint .", "lint:types": "tsc -p tsconfig.json --noEmit", "start": "ember serve --port=7357", "test": "ember test", @@ -39,8 +34,10 @@ "yarn:link": "node bin/yarn-link-all", "yarn:unlink": "node bin/yarn-link-all --unlink" }, - "resolutions": { - "typescript": "4.0.2" + "pnpm": { + "overrides": { + "typescript": "$typescript" + } }, "dependencies": { "@handlebars/parser": "~2.0.0", @@ -54,20 +51,20 @@ "symlink-or-copy": "^1.3.1" }, "devDependencies": { - "@babel/core": "^7.8.4", - "@babel/plugin-transform-modules-commonjs": "^7.8.3", - "@babel/preset-env": "^7.8.4", + "@babel/core": "^7.21.8", + "@babel/plugin-transform-modules-commonjs": "^7.21.5", + "@babel/preset-env": "^7.21.5", "@glimmer/env": "0.1.7", - "@types/node": "^13.7.4", - "@types/qunit": "^2.0.31", - "@typescript-eslint/eslint-plugin": "^4.0.1", - "@typescript-eslint/parser": "^4.0.1", + "@types/node": "^13.13.52", + "@types/qunit": "^2.19.5", + "@typescript-eslint/eslint-plugin": "^5.59.2", + "@typescript-eslint/parser": "^5.59.2", "amd-name-resolver": "^1.3.1", "auto-dist-tag": "^1.0.0", "babel-plugin-nukable-import": "^0.4.2", "babel-plugin-strip-glimmer-utils": "^0.1.1", - "broccoli-babel-transpiler": "^7.4.0", - "broccoli-concat": "^3.7.5", + "broccoli-babel-transpiler": "^7.8.1", + "broccoli-concat": "^4.2.5", "broccoli-debug": "^0.6.5", "broccoli-file-creator": "^2.1.1", "broccoli-funnel": "^2.0.2", @@ -79,27 +76,25 @@ "broccoli-typescript-compiler": "^6.0.1", "chalk": "^3.0.0", "dag-map": "^2.0.2", - "ember-cli": "~3.20.0", + "ember-cli": "~4.12.1", "ember-cli-browserstack": "^2.0.1", "ensure-posix-path": "^1.1.1", - "eslint": "^7.7.0", - "eslint-config-prettier": "^6.11.0", - "eslint-plugin-import": "^2.22.0", + "eslint": "^8.39.0", + "eslint-config-prettier": "^8.8.0", + "eslint-import-resolver-typescript": "^3.5.5", + "eslint-plugin-import": "^2.27.5", "eslint-plugin-node": "^11.1.0", - "eslint-plugin-prettier": "^3.1.4", - "eslint-plugin-qunit": "^4.3.0", - "eslint-plugin-simple-import-sort": "^5.0.3", + "eslint-plugin-prettier": "^4.2.1", + "eslint-plugin-qunit": "^7.3.4", + "eslint-plugin-simple-import-sort": "^10.0.0", "execa": "^1.0.0", "glob": "^7.0.5", "js-yaml": "^3.10.0", "loader.js": "^4.0.10", - "mkdirp": "^0.5.1", + "mkdirp": "^0.5.6", "npm-run-all": "^4.1.5", - "prettier": "^2.1.1", - "qunit": "^2.9.3", - "release-it": "^14.2.1", - "release-it-lerna-changelog": "^3.1.0", - "release-it-yarn-workspaces": "^2.0.0", + "prettier": "^2.8.8", + "qunit": "^2.19.4", "rimraf": "^2.7.1", "rollup": "^2.24.0", "rollup-plugin-sourcemaps": "^0.6.2", @@ -107,7 +102,7 @@ "semver": "^6.3.0", "testem-failure-only-reporter": "^0.0.1", "toml": "^3.0.0", - "typescript": "4.0.2" + "typescript": "^5.0.4" }, "publishConfig": { "registry": "https://registry.npmjs.org" @@ -127,47 +122,9 @@ "lib/local-linker" ] }, - "release-it": { - "hooks": { - "before:bump": "yarn build" - }, - "plugins": { - "release-it-lerna-changelog": { - "infile": "CHANGELOG.md", - "launchEditor": true - }, - "release-it-yarn-workspaces": { - "workspaces": [ - "dist/@glimmer/*", - "packages/build-utils/@glimmer/*" - ], - "additionalManifests": { - "dependencyUpdates": [ - "benchmark/package.json", - "lib/local-linker/package.json", - "packages/*/*/package.json", - "packages/build-utils/*/*/package.json" - ], - "versionUpdates": [ - "package.json", - "benchmark/package.json", - "lib/local-linker/package.json", - "packages/*/*/package.json" - ] - } - } - }, - "git": { - "tagName": "v${version}" - }, - "github": { - "release": true, - "tokenRef": "GITHUB_AUTH" - }, - "npm": false - }, "volta": { - "node": "12.18.3", - "yarn": "1.22.5" + "node": "16.20.0", + "yarn": "1.22.5", + "pnpm": "8.4.0" } } diff --git a/packages/@glimmer/benchmark-env/package.json b/packages/@glimmer/benchmark-env/package.json index 16309302f1..45539ba1f5 100644 --- a/packages/@glimmer/benchmark-env/package.json +++ b/packages/@glimmer/benchmark-env/package.json @@ -4,17 +4,17 @@ "private": true, "repository": "https://github.com/glimmerjs/glimmer-vm/tree/master/packages/@glimmer/benchmark-env", "dependencies": { - "@glimmer/global-context": "0.84.3", - "@glimmer/program": "0.84.3", - "@glimmer/reference": "0.84.3", - "@glimmer/runtime": "0.84.3", - "@glimmer/validator": "0.84.3", - "@glimmer/util": "0.84.3", - "@glimmer/interfaces": "0.84.3", - "@glimmer/opcode-compiler": "0.84.3", - "@simple-dom/interface": "^1.4.0" + "@glimmer/global-context": "workspace:^", + "@glimmer/interfaces": "workspace:^", + "@glimmer/manager": "workspace:^", + "@glimmer/opcode-compiler": "workspace:^", + "@glimmer/program": "workspace:^", + "@glimmer/reference": "workspace:^", + "@glimmer/runtime": "workspace:^", + "@glimmer/util": "workspace:^", + "@glimmer/validator": "workspace:^" }, "devDependencies": { - "@types/qunit": "^2.9.0" + "@types/qunit": "^2.19.5" } } diff --git a/packages/@glimmer/benchmark-env/src/benchmark/basic-component-manager.ts b/packages/@glimmer/benchmark-env/src/benchmark/basic-component-manager.ts index 61db1fe271..90d65964ed 100644 --- a/packages/@glimmer/benchmark-env/src/benchmark/basic-component-manager.ts +++ b/packages/@glimmer/benchmark-env/src/benchmark/basic-component-manager.ts @@ -27,7 +27,8 @@ interface BasicState { } class BasicComponentManager - implements WithCreateInstance>) => object, Owner> { + implements WithCreateInstance>) => object, Owner> +{ create( _owner: Owner, Component: { new (args: ComponentArgs): object }, diff --git a/packages/@glimmer/benchmark-env/src/benchmark/create-registry.ts b/packages/@glimmer/benchmark-env/src/benchmark/create-registry.ts index d0791c2176..cfc95e98ff 100644 --- a/packages/@glimmer/benchmark-env/src/benchmark/create-registry.ts +++ b/packages/@glimmer/benchmark-env/src/benchmark/create-registry.ts @@ -7,8 +7,8 @@ import { Helper, } from '@glimmer/interfaces'; import { programCompilationContext } from '@glimmer/opcode-compiler'; -import { artifacts } from '@glimmer/program'; -import { SimpleElement } from '@simple-dom/interface'; +import { artifacts, RuntimeOpImpl } from '@glimmer/program'; +import { SimpleElement } from '@glimmer/interfaces'; import { getComponentTemplate, getInternalComponentManager, @@ -78,14 +78,18 @@ export default function createRegistry(): Registry { }, render: (entry, args, element, isIteractive) => { const sharedArtifacts = artifacts(); - const context = programCompilationContext(sharedArtifacts, { - lookupHelper: (name) => helpers.get(name) ?? null, - lookupModifier: (name) => modifiers.get(name) ?? null, - lookupComponent: (name) => components.get(name) ?? null, + const context = programCompilationContext( + sharedArtifacts, + { + lookupHelper: (name) => helpers.get(name) ?? null, + lookupModifier: (name) => modifiers.get(name) ?? null, + lookupComponent: (name) => components.get(name) ?? null, - lookupBuiltInHelper: () => null, - lookupBuiltInModifier: () => null, - }); + lookupBuiltInHelper: () => null, + lookupBuiltInModifier: () => null, + }, + (heap) => new RuntimeOpImpl(heap) + ); const component = components.get(entry); if (!component) { throw new Error(`missing ${entry} component`); diff --git a/packages/@glimmer/benchmark-env/src/benchmark/on-modifier.ts b/packages/@glimmer/benchmark-env/src/benchmark/on-modifier.ts index 07d7799f05..db2c93af69 100644 --- a/packages/@glimmer/benchmark-env/src/benchmark/on-modifier.ts +++ b/packages/@glimmer/benchmark-env/src/benchmark/on-modifier.ts @@ -2,7 +2,7 @@ import { CapturedArguments, InternalModifierManager, Owner } from '@glimmer/inte import { Reference, valueForRef } from '@glimmer/reference'; import { castToBrowser } from '@glimmer/util'; import { createUpdatableTag } from '@glimmer/validator'; -import { SimpleElement } from '@simple-dom/interface'; +import { SimpleElement } from '@glimmer/interfaces'; interface OnModifierState { element: SimpleElement; diff --git a/packages/@glimmer/benchmark-env/src/benchmark/render-benchmark.ts b/packages/@glimmer/benchmark-env/src/benchmark/render-benchmark.ts index b206202f26..2f4c049791 100644 --- a/packages/@glimmer/benchmark-env/src/benchmark/render-benchmark.ts +++ b/packages/@glimmer/benchmark-env/src/benchmark/render-benchmark.ts @@ -1,4 +1,4 @@ -import { SimpleElement } from '@simple-dom/interface'; +import { SimpleElement } from '@glimmer/interfaces'; import { Dict, RuntimeResolver, diff --git a/packages/@glimmer/benchmark-env/src/benchmark/util.ts b/packages/@glimmer/benchmark-env/src/benchmark/util.ts index 0d27838cb2..e128e816b4 100644 --- a/packages/@glimmer/benchmark-env/src/benchmark/util.ts +++ b/packages/@glimmer/benchmark-env/src/benchmark/util.ts @@ -12,7 +12,7 @@ export async function measureRender( endMark: string, render: () => Promise | void ) { - const endObserved = new Promise((resolve) => { + const endObserved = new Promise((resolve) => { new PerformanceObserver((entries, observer) => { if (entries.getEntriesByName(endMark, 'mark').length > 0) { resolve(); diff --git a/packages/@glimmer/benchmark-env/src/interfaces.ts b/packages/@glimmer/benchmark-env/src/interfaces.ts index fd05d98285..8966b9d424 100644 --- a/packages/@glimmer/benchmark-env/src/interfaces.ts +++ b/packages/@glimmer/benchmark-env/src/interfaces.ts @@ -1,5 +1,5 @@ import { Dict, SerializedTemplateWithLazyBlock } from '@glimmer/interfaces'; -import { SimpleElement } from '@simple-dom/interface'; +import { SimpleElement } from '@glimmer/interfaces'; /** * This abstracts a tracked root. diff --git a/packages/@glimmer/compiler/index.ts b/packages/@glimmer/compiler/index.ts index 6877a17774..d27b6fbd17 100644 --- a/packages/@glimmer/compiler/index.ts +++ b/packages/@glimmer/compiler/index.ts @@ -1,14 +1,14 @@ -export { defaultId, precompile, precompileJSON, PrecompileOptions } from './lib/compiler'; export { - ProgramSymbols, buildStatement, buildStatements, - s, c, - unicode, NEWLINE, + ProgramSymbols, + s, + unicode, } from './lib/builder/builder'; -export { BuilderStatement, Builder } from './lib/builder/builder-interface'; +export { Builder, BuilderStatement } from './lib/builder/builder-interface'; +export { defaultId, precompile, precompileJSON, PrecompileOptions } from './lib/compiler'; // exported only for tests export { default as WireFormatDebugger } from './lib/wire-format-debug'; diff --git a/packages/@glimmer/compiler/lib/builder/builder-interface.ts b/packages/@glimmer/compiler/lib/builder/builder-interface.ts index 0e96aa41ab..69f29cc95f 100644 --- a/packages/@glimmer/compiler/lib/builder/builder-interface.ts +++ b/packages/@glimmer/compiler/lib/builder/builder-interface.ts @@ -206,9 +206,13 @@ export function normalizeSugaryArrayStatement( } case '#': { - let { head: path, params, hash, blocks, blockParams } = normalizeBuilderBlockStatement( - statement as BuilderBlockStatement - ); + let { + head: path, + params, + hash, + blocks, + blockParams, + } = normalizeBuilderBlockStatement(statement as BuilderBlockStatement); return { kind: HeadKind.Block, @@ -439,9 +443,10 @@ export function normalizeBuilderBlockStatement( }; } -function normalizeBlockHash( - hash: BuilderBlockHash -): { hash: Option; blockParams: Option } { +function normalizeBlockHash(hash: BuilderBlockHash): { + hash: Option; + blockParams: Option; +} { if (hash === null) { return { hash: null, blockParams: null }; } @@ -451,7 +456,7 @@ function normalizeBlockHash( entries(hash, (key, value) => { if (key === 'as') { - blockParams = Array.isArray(value) ? value : [value]; + blockParams = Array.isArray(value) ? (value as string[]) : [value as string]; } else { out = out || dict(); out[key] = normalizeExpression(value as BuilderExpression); diff --git a/packages/@glimmer/compiler/lib/builder/builder.ts b/packages/@glimmer/compiler/lib/builder/builder.ts index 05c5e5570c..8018b7d3f2 100644 --- a/packages/@glimmer/compiler/lib/builder/builder.ts +++ b/packages/@glimmer/compiler/lib/builder/builder.ts @@ -1,7 +1,9 @@ import { + AttrNamespace, Dict, Expressions, GetContextualFreeOp, + Namespace, Option, PresentArray, SexpOpcodes, @@ -9,7 +11,6 @@ import { WireFormat, } from '@glimmer/interfaces'; import { assert, assertNever, dict, exhausted, expect, isPresent, values } from '@glimmer/util'; -import { AttrNamespace, Namespace } from '@simple-dom/interface'; import { Builder, diff --git a/packages/@glimmer/compiler/lib/compiler.ts b/packages/@glimmer/compiler/lib/compiler.ts index f3f99e6bc0..d46c9c3dc5 100644 --- a/packages/@glimmer/compiler/lib/compiler.ts +++ b/packages/@glimmer/compiler/lib/compiler.ts @@ -14,9 +14,7 @@ declare function require(id: 'crypto'): Crypto; declare function require(id: string): unknown; interface Crypto { - createHash( - alg: 'sha1' - ): { + createHash(alg: 'sha1'): { update(src: string, encoding: 'utf8'): void; digest(encoding: 'base64'): string; }; @@ -120,7 +118,7 @@ export function precompile( moduleName: moduleName ?? '(unknown template module)', // lying to the type checker here because we're going to // replace it just below, after stringification - scope: (SCOPE_PLACEHOLDER as unknown) as null, + scope: SCOPE_PLACEHOLDER as unknown as null, isStrictMode: options.strictMode ?? false, }; diff --git a/packages/@glimmer/compiler/lib/passes/1-normalization/keywords.ts b/packages/@glimmer/compiler/lib/passes/1-normalization/keywords.ts index c6686e5615..8b878c2d0f 100644 --- a/packages/@glimmer/compiler/lib/passes/1-normalization/keywords.ts +++ b/packages/@glimmer/compiler/lib/passes/1-normalization/keywords.ts @@ -1,4 +1,4 @@ -export { CALL_KEYWORDS } from './keywords/call'; export { APPEND_KEYWORDS } from './keywords/append'; export { BLOCK_KEYWORDS } from './keywords/block'; +export { CALL_KEYWORDS } from './keywords/call'; export { MODIFIER_KEYWORDS } from './keywords/modifier'; diff --git a/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/append.ts b/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/append.ts index 938fc35ef2..6fdb6041e0 100644 --- a/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/append.ts +++ b/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/append.ts @@ -21,9 +21,7 @@ export const APPEND_KEYWORDS = keywords('Append') .kw('if', toAppend(ifUnlessInlineKeyword('if'))) .kw('unless', toAppend(ifUnlessInlineKeyword('unless'))) .kw('yield', { - assert( - node: ASTv2.AppendContent - ): Result<{ + assert(node: ASTv2.AppendContent): Result<{ target: SourceSlice; positional: ASTv2.PositionalArguments; }> { diff --git a/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/block.ts b/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/block.ts index 74bc9e0759..5d69ffe02d 100644 --- a/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/block.ts +++ b/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/block.ts @@ -11,9 +11,7 @@ import { assertCurryKeyword } from './utils/curry'; export const BLOCK_KEYWORDS = keywords('Block') .kw('in-element', { - assert( - node: ASTv2.InvokeBlock - ): Result<{ + assert(node: ASTv2.InvokeBlock): Result<{ insertBefore: ASTv2.ExpressionNode | null; destination: ASTv2.ExpressionNode; }> { @@ -90,9 +88,7 @@ export const BLOCK_KEYWORDS = keywords('Block') }, }) .kw('if', { - assert( - node: ASTv2.InvokeBlock - ): Result<{ + assert(node: ASTv2.InvokeBlock): Result<{ condition: ASTv2.ExpressionNode; }> { let { args } = node; @@ -154,9 +150,7 @@ export const BLOCK_KEYWORDS = keywords('Block') }, }) .kw('unless', { - assert( - node: ASTv2.InvokeBlock - ): Result<{ + assert(node: ASTv2.InvokeBlock): Result<{ condition: ASTv2.ExpressionNode; }> { let { args } = node; @@ -218,9 +212,7 @@ export const BLOCK_KEYWORDS = keywords('Block') }, }) .kw('each', { - assert( - node: ASTv2.InvokeBlock - ): Result<{ + assert(node: ASTv2.InvokeBlock): Result<{ value: ASTv2.ExpressionNode; key: ASTv2.ExpressionNode | null; }> { @@ -288,9 +280,7 @@ export const BLOCK_KEYWORDS = keywords('Block') }, }) .kw('with', { - assert( - node: ASTv2.InvokeBlock - ): Result<{ + assert(node: ASTv2.InvokeBlock): Result<{ value: ASTv2.ExpressionNode; }> { let { args } = node; @@ -352,9 +342,7 @@ export const BLOCK_KEYWORDS = keywords('Block') }, }) .kw('let', { - assert( - node: ASTv2.InvokeBlock - ): Result<{ + assert(node: ASTv2.InvokeBlock): Result<{ positional: ASTv2.PositionalArguments; }> { let { args } = node; @@ -408,9 +396,7 @@ export const BLOCK_KEYWORDS = keywords('Block') }, }) .kw('-with-dynamic-vars', { - assert( - node: ASTv2.InvokeBlock - ): Result<{ + assert(node: ASTv2.InvokeBlock): Result<{ named: ASTv2.NamedArguments; }> { return Ok({ named: node.args.named }); diff --git a/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/impl.ts b/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/impl.ts index dd9019b9a2..186a0d0c00 100644 --- a/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/impl.ts +++ b/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/impl.ts @@ -167,7 +167,8 @@ function getCalleeExpression( } export class Keywords = never> - implements Keyword> { + implements Keyword> +{ _keywords: Keyword[] = []; _type: K; diff --git a/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/utils/if-unless.ts b/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/utils/if-unless.ts index 3062d7dc4b..15d63703c6 100644 --- a/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/utils/if-unless.ts +++ b/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/utils/if-unless.ts @@ -114,9 +114,7 @@ function translateIfUnlessInlineKeyword(type: string) { }; } -export function ifUnlessInlineKeyword( - type: string -): KeywordDelegate< +export function ifUnlessInlineKeyword(type: string): KeywordDelegate< ASTv2.CallExpression | ASTv2.AppendContent, { condition: ASTv2.ExpressionNode; diff --git a/packages/@glimmer/compiler/lib/shared/result.ts b/packages/@glimmer/compiler/lib/shared/result.ts index 068e92bf72..f774eeb92d 100644 --- a/packages/@glimmer/compiler/lib/shared/result.ts +++ b/packages/@glimmer/compiler/lib/shared/result.ts @@ -92,7 +92,7 @@ class ErrImpl extends ResultImpl { } cast(): Result { - return (this as unknown) as Result; + return this as unknown as Result; } } diff --git a/packages/@glimmer/compiler/package.json b/packages/@glimmer/compiler/package.json index f99862803f..4270e682c4 100644 --- a/packages/@glimmer/compiler/package.json +++ b/packages/@glimmer/compiler/package.json @@ -3,13 +3,12 @@ "version": "0.84.3", "repository": "https://github.com/glimmerjs/glimmer-vm/tree/master/packages/@glimmer/compiler", "dependencies": { - "@glimmer/syntax": "0.84.3", - "@glimmer/util": "0.84.3", - "@glimmer/wire-format": "0.84.3", - "@glimmer/interfaces": "0.84.3", - "@simple-dom/interface": "^1.4.0" + "@glimmer/syntax": "workspace:^", + "@glimmer/util": "workspace:^", + "@glimmer/wire-format": "workspace:^", + "@glimmer/interfaces": "workspace:^" }, "devDependencies": { - "@glimmer/local-debug-flags": "0.84.3" + "@glimmer/local-debug-flags": "workspace:^" } } diff --git a/packages/@glimmer/compiler/test/compiler-test.ts b/packages/@glimmer/compiler/test/compiler-test.ts index 3ea091371c..f9b23e7164 100644 --- a/packages/@glimmer/compiler/test/compiler-test.ts +++ b/packages/@glimmer/compiler/test/compiler-test.ts @@ -24,7 +24,7 @@ import { QUnit.module('@glimmer/compiler - compiling source to wire format'); function compile(content: string): SerializedTemplate { - let parsed = (JSON.parse(precompile(content, {})) as unknown) as SerializedTemplateWithLazyBlock; + let parsed = JSON.parse(precompile(content, {})) as unknown as SerializedTemplateWithLazyBlock; let block = JSON.parse(parsed.block); return assign({}, parsed, { block }); diff --git a/packages/@glimmer/debug/lib/debug.ts b/packages/@glimmer/debug/lib/debug.ts index 7c8dfe208d..08c289d303 100644 --- a/packages/@glimmer/debug/lib/debug.ts +++ b/packages/@glimmer/debug/lib/debug.ts @@ -1,16 +1,15 @@ import { CompileTimeConstants, - Recast, - RuntimeOp, Dict, Maybe, - TemplateCompilationContext, + Recast, ResolutionTimeConstants, + RuntimeOp, + TemplateCompilationContext, } from '@glimmer/interfaces'; import { LOCAL_SHOULD_LOG } from '@glimmer/local-debug-flags'; -import { RuntimeOpImpl } from '@glimmer/program'; -import { Register, $s0, $s1, $t0, $t1, $v0, $fp, $sp, $pc, $ra } from '@glimmer/vm'; -import { decodeImmediate, decodeHandle, LOCAL_LOGGER } from '@glimmer/util'; +import { decodeHandle, decodeImmediate, LOCAL_LOGGER } from '@glimmer/util'; +import { $fp, $pc, $ra, $s0, $s1, $sp, $t0, $t1, $v0, Register } from '@glimmer/vm'; import { opcodeMetadata } from './opcode-metadata'; import { Primitive } from './stack-check'; @@ -24,7 +23,7 @@ export function debugSlice(context: TemplateCompilationContext, start: number, e LOCAL_LOGGER.group(`%c${start}:${end}`, 'color: #999'); let heap = context.program.heap; - let opcode = new RuntimeOpImpl(heap); + let opcode = context.program.createOp(heap); let _size = 0; for (let i = start; i < end; i = i + _size) { diff --git a/packages/@glimmer/debug/lib/metadata.ts b/packages/@glimmer/debug/lib/metadata.ts index de1faf2af3..76b27de5de 100644 --- a/packages/@glimmer/debug/lib/metadata.ts +++ b/packages/@glimmer/debug/lib/metadata.ts @@ -24,7 +24,7 @@ function isOperandType(s: string): s is OperandType { return OPERAND_TYPES.indexOf(s as any) !== -1; } -export type OperandType = typeof OPERAND_TYPES[number]; +export type OperandType = (typeof OPERAND_TYPES)[number]; export interface Operand { type: OperandType; @@ -210,7 +210,7 @@ export function strip(strings: TemplateStringsArray, ...args: unknown[]) { } export const META_KIND = tuple('METADATA', 'MACHINE_METADATA'); -export type META_KIND = typeof META_KIND[number]; +export type META_KIND = (typeof META_KIND)[number]; export function buildSingleMeta( kind: META_KIND, diff --git a/packages/@glimmer/debug/lib/stack-check.ts b/packages/@glimmer/debug/lib/stack-check.ts index 073ce1773c..b6b4e5cb88 100644 --- a/packages/@glimmer/debug/lib/stack-check.ts +++ b/packages/@glimmer/debug/lib/stack-check.ts @@ -1,5 +1,5 @@ import { Option, Dict, BlockSymbolTable, ProgramSymbolTable, Maybe } from '@glimmer/interfaces'; -import { SimpleElement, SimpleDocumentFragment, SimpleNode } from '@simple-dom/interface'; +import { SimpleElement, SimpleDocumentFragment, SimpleNode } from '@glimmer/interfaces'; export interface Checker { type: T; diff --git a/packages/@glimmer/debug/package.json b/packages/@glimmer/debug/package.json index 3d77db65ee..01e21a6c66 100644 --- a/packages/@glimmer/debug/package.json +++ b/packages/@glimmer/debug/package.json @@ -4,13 +4,13 @@ "repository": "https://github.com/glimmerjs/glimmer-vm/tree/master/packages/@glimmer/debug", "private": true, "dependencies": { - "@glimmer/interfaces": "0.84.3", - "@glimmer/util": "0.84.3", - "@glimmer/vm": "0.84.3", - "@simple-dom/interface": "^1.4.0" + "@glimmer/interfaces": "workspace:^", + "@glimmer/util": "workspace:^", + "@glimmer/vm": "workspace:^" }, "devDependencies": { - "@types/qunit": "^2.9.0", + "@glimmer/local-debug-flags": "workspace:^", + "@types/qunit": "^2.19.5", "toml": "^3.0.0" } } diff --git a/packages/@glimmer/destroyable/index.ts b/packages/@glimmer/destroyable/index.ts index 0288d92612..d06d2d57b5 100644 --- a/packages/@glimmer/destroyable/index.ts +++ b/packages/@glimmer/destroyable/index.ts @@ -87,7 +87,7 @@ function getDestroyableMeta(destroyable: T): DestroyableM DESTROYABLE_META.set(destroyable, meta); } - return (meta as unknown) as DestroyableMeta; + return meta as unknown as DestroyableMeta; } export function associateDestroyableChild(parent: Destroyable, child: T): T { diff --git a/packages/@glimmer/destroyable/package.json b/packages/@glimmer/destroyable/package.json index 0b091758e1..69c14df4da 100644 --- a/packages/@glimmer/destroyable/package.json +++ b/packages/@glimmer/destroyable/package.json @@ -6,8 +6,8 @@ "license": "MIT", "dependencies": { "@glimmer/env": "0.1.7", - "@glimmer/global-context": "0.84.3", - "@glimmer/interfaces": "0.84.3", - "@glimmer/util": "0.84.3" + "@glimmer/global-context": "workspace:^", + "@glimmer/interfaces": "workspace:^", + "@glimmer/util": "workspace:^" } } diff --git a/packages/@glimmer/destroyable/test/destroyables-test.ts b/packages/@glimmer/destroyable/test/destroyables-test.ts index 401c3108e0..03d27f0928 100644 --- a/packages/@glimmer/destroyable/test/destroyables-test.ts +++ b/packages/@glimmer/destroyable/test/destroyables-test.ts @@ -45,7 +45,7 @@ module('Destroyables', (hooks) => { }); hooks.afterEach((assert) => { - assert.equal(destroyQueue.length, 0, 'destruction flushed'); + assert.strictEqual(destroyQueue.length, 0, 'destruction flushed'); }); test('standard destructors work', (assert) => { @@ -54,20 +54,20 @@ module('Destroyables', (hooks) => { registerDestructor(destroyable, () => count++); - assert.equal(isDestroying(destroyable), false, 'not destroying at first'); - assert.equal(isDestroyed(destroyable), false, 'not destroyed at first'); + assert.false(isDestroying(destroyable), 'not destroying at first'); + assert.false(isDestroyed(destroyable), 'not destroyed at first'); destroy(destroyable); - assert.equal(isDestroying(destroyable), true, 'destroying immediately after destroy() called'); - assert.equal(isDestroyed(destroyable), false, 'not destroyed immediately after destroy()'); - assert.equal(count, 0, 'count has not increased'); + assert.true(isDestroying(destroyable), 'destroying immediately after destroy() called'); + assert.false(isDestroyed(destroyable), 'not destroyed immediately after destroy()'); + assert.strictEqual(count, 0, 'count has not increased'); flush(); - assert.equal(isDestroying(destroyable), true, 'still destroying after flush'); - assert.equal(isDestroyed(destroyable), true, 'destroyed after flush'); - assert.equal(count, 1, 'destructor was run'); + assert.true(isDestroying(destroyable), 'still destroying after flush'); + assert.true(isDestroyed(destroyable), 'destroyed after flush'); + assert.strictEqual(count, 1, 'destructor was run'); }); test('destructors work with functions', (assert) => { @@ -76,20 +76,20 @@ module('Destroyables', (hooks) => { registerDestructor(destroyable, () => count++); - assert.equal(isDestroying(destroyable), false, 'not destroying at first'); - assert.equal(isDestroyed(destroyable), false, 'not destroyed at first'); + assert.false(isDestroying(destroyable), 'not destroying at first'); + assert.false(isDestroyed(destroyable), 'not destroyed at first'); destroy(destroyable); - assert.equal(isDestroying(destroyable), true, 'destroying immediately after destroy() called'); - assert.equal(isDestroyed(destroyable), false, 'not destroyed immediately after destroy()'); - assert.equal(count, 0, 'count has not increased'); + assert.true(isDestroying(destroyable), 'destroying immediately after destroy() called'); + assert.false(isDestroyed(destroyable), 'not destroyed immediately after destroy()'); + assert.strictEqual(count, 0, 'count has not increased'); flush(); - assert.equal(isDestroying(destroyable), true, 'still destroying after flush'); - assert.equal(isDestroyed(destroyable), true, 'destroyed after flush'); - assert.equal(count, 1, 'destructor was run'); + assert.true(isDestroying(destroyable), 'still destroying after flush'); + assert.true(isDestroyed(destroyable), 'destroyed after flush'); + assert.strictEqual(count, 1, 'destructor was run'); }); test('can register multiple destructors', (assert) => { @@ -99,20 +99,20 @@ module('Destroyables', (hooks) => { registerDestructor(destroyable, () => count++); registerDestructor(destroyable, () => count++); - assert.equal(isDestroying(destroyable), false, 'not destroying at first'); - assert.equal(isDestroyed(destroyable), false, 'not destroyed at first'); + assert.false(isDestroying(destroyable), 'not destroying at first'); + assert.false(isDestroyed(destroyable), 'not destroyed at first'); destroy(destroyable); - assert.equal(isDestroying(destroyable), true, 'destroying immediately after destroy() called'); - assert.equal(isDestroyed(destroyable), false, 'not destroyed immediately after destroy()'); - assert.equal(count, 0, 'count has not increased'); + assert.true(isDestroying(destroyable), 'destroying immediately after destroy() called'); + assert.false(isDestroyed(destroyable), 'not destroyed immediately after destroy()'); + assert.strictEqual(count, 0, 'count has not increased'); flush(); - assert.equal(isDestroying(destroyable), true, 'still destroying after flush'); - assert.equal(isDestroyed(destroyable), true, 'destroyed after flush'); - assert.equal(count, 2, 'both destructors were run'); + assert.true(isDestroying(destroyable), 'still destroying after flush'); + assert.true(isDestroyed(destroyable), 'destroyed after flush'); + assert.strictEqual(count, 2, 'both destructors were run'); }); test('destruction only happens once', (assert) => { @@ -124,16 +124,16 @@ module('Destroyables', (hooks) => { destroy(destroyable); flush(); - assert.equal(isDestroying(destroyable), true, 'destroying after flush'); - assert.equal(isDestroyed(destroyable), true, 'destroyed after flush'); - assert.equal(count, 1, 'destructor was run'); + assert.true(isDestroying(destroyable), 'destroying after flush'); + assert.true(isDestroyed(destroyable), 'destroyed after flush'); + assert.strictEqual(count, 1, 'destructor was run'); destroy(destroyable); flush(); - assert.equal(isDestroying(destroyable), true, 'destroying after second flush'); - assert.equal(isDestroyed(destroyable), true, 'destroyed after second flush'); - assert.equal(count, 1, 'destructor was not run again'); + assert.true(isDestroying(destroyable), 'destroying after second flush'); + assert.true(isDestroyed(destroyable), 'destroyed after second flush'); + assert.strictEqual(count, 1, 'destructor was not run again'); }); test('eager destructors work', (assert) => { @@ -144,15 +144,15 @@ module('Destroyables', (hooks) => { destroy(destroyable); - assert.equal(isDestroying(destroyable), true, 'destroying immediately after destroy() called'); - assert.equal(isDestroyed(destroyable), false, 'not destroyed immediately after destroy()'); - assert.equal(count, 1, 'count has increased, eager destructor run'); + assert.true(isDestroying(destroyable), 'destroying immediately after destroy() called'); + assert.false(isDestroyed(destroyable), 'not destroyed immediately after destroy()'); + assert.strictEqual(count, 1, 'count has increased, eager destructor run'); flush(); - assert.equal(isDestroying(destroyable), true, 'destroying after flush'); - assert.equal(isDestroyed(destroyable), true, 'destroyed after flush'); - assert.equal(count, 1, 'destructor was not run again'); + assert.true(isDestroying(destroyable), 'destroying after flush'); + assert.true(isDestroyed(destroyable), 'destroyed after flush'); + assert.strictEqual(count, 1, 'destructor was not run again'); }); test('can unregister a destructor', (assert) => { @@ -165,7 +165,7 @@ module('Destroyables', (hooks) => { destroy(destroyable); flush(); - assert.equal(count, 0, 'destructor was not called'); + assert.strictEqual(count, 0, 'destructor was not called'); }); test('can associate destroyable children', (assert) => { @@ -176,33 +176,29 @@ module('Destroyables', (hooks) => { registerDestructor(parent, () => assert.step('parent')); registerDestructor(child, () => assert.step('child')); - assert.equal(isDestroying(parent), false, 'parent not destroying at first'); - assert.equal(isDestroyed(parent), false, 'parent not destroyed at first'); + assert.false(isDestroying(parent), 'parent not destroying at first'); + assert.false(isDestroyed(parent), 'parent not destroyed at first'); - assert.equal(isDestroying(child), false, 'child not destroying at first'); - assert.equal(isDestroyed(child), false, 'child not destroyed at first'); + assert.false(isDestroying(child), 'child not destroying at first'); + assert.false(isDestroyed(child), 'child not destroyed at first'); destroy(parent); - assert.equal( - isDestroying(parent), - true, - 'parent destroying immediately after destroy() called' - ); - assert.equal(isDestroyed(parent), false, 'parent not destroyed immediately after destroy()'); + assert.true(isDestroying(parent), 'parent destroying immediately after destroy() called'); + assert.false(isDestroyed(parent), 'parent not destroyed immediately after destroy()'); - assert.equal(isDestroying(child), true, 'child destroying immediately after destroy() called'); - assert.equal(isDestroyed(child), false, 'child not destroyed immediately after destroy()'); + assert.true(isDestroying(child), 'child destroying immediately after destroy() called'); + assert.false(isDestroyed(child), 'child not destroyed immediately after destroy()'); assert.verifySteps([], 'nothing destroyed yet'); flush(); - assert.equal(isDestroying(parent), true, 'parent still destroying after flush'); - assert.equal(isDestroyed(parent), true, 'parent destroyed after flush'); + assert.true(isDestroying(parent), 'parent still destroying after flush'); + assert.true(isDestroyed(parent), 'parent destroyed after flush'); - assert.equal(isDestroying(child), true, 'child still destroying after flush'); - assert.equal(isDestroyed(child), true, 'child destroyed after flush'); + assert.true(isDestroying(child), 'child still destroying after flush'); + assert.true(isDestroyed(child), 'child destroyed after flush'); assert.verifySteps(['child', 'parent'], 'destructors run in correct order'); }); @@ -215,43 +211,39 @@ module('Destroyables', (hooks) => { registerDestructor(parent, () => assert.step('parent')); registerDestructor(child, () => assert.step('child')); - assert.equal(isDestroying(parent), false, 'parent not destroying at first'); - assert.equal(isDestroyed(parent), false, 'parent not destroyed at first'); + assert.false(isDestroying(parent), 'parent not destroying at first'); + assert.false(isDestroyed(parent), 'parent not destroyed at first'); - assert.equal(isDestroying(child), false, 'child not destroying at first'); - assert.equal(isDestroyed(child), false, 'child not destroyed at first'); + assert.false(isDestroying(child), 'child not destroying at first'); + assert.false(isDestroyed(child), 'child not destroyed at first'); destroy(child); - assert.equal(isDestroying(parent), false, 'parent not immediately after child destroy()'); - assert.equal(isDestroyed(parent), false, 'parent not destroyed after child destroy()'); + assert.false(isDestroying(parent), 'parent not immediately after child destroy()'); + assert.false(isDestroyed(parent), 'parent not destroyed after child destroy()'); - assert.equal(isDestroying(child), true, 'child destroying immediately after destroy()'); - assert.equal( - isDestroyed(child), - false, - 'child not destroyed immediately after destroy() called' - ); + assert.true(isDestroying(child), 'child destroying immediately after destroy()'); + assert.false(isDestroyed(child), 'child not destroyed immediately after destroy() called'); assert.verifySteps([], 'nothing destroyed yet'); flush(); - assert.equal(isDestroying(parent), false, 'parent still not destroying after flush'); - assert.equal(isDestroyed(parent), false, 'parent not destroyed after flush'); + assert.false(isDestroying(parent), 'parent still not destroying after flush'); + assert.false(isDestroyed(parent), 'parent not destroyed after flush'); - assert.equal(isDestroying(child), true, 'child still destroying after flush'); - assert.equal(isDestroyed(child), true, 'child destroyed after flush'); + assert.true(isDestroying(child), 'child still destroying after flush'); + assert.true(isDestroyed(child), 'child destroyed after flush'); assert.verifySteps(['child'], 'child destructor run'); destroy(parent); - assert.equal(isDestroying(parent), true, 'parent destroying after destroy()'); - assert.equal(isDestroyed(parent), false, 'parent not destroyed before flush'); + assert.true(isDestroying(parent), 'parent destroying after destroy()'); + assert.false(isDestroyed(parent), 'parent not destroyed before flush'); flush(); - assert.equal(isDestroying(parent), true, 'parent still destroying after flush'); - assert.equal(isDestroyed(parent), true, 'parent destroyed after flush'); + assert.true(isDestroying(parent), 'parent still destroying after flush'); + assert.true(isDestroyed(parent), 'parent destroyed after flush'); assert.verifySteps(['parent'], 'parent destructor run'); }); @@ -271,28 +263,28 @@ module('Destroyables', (hooks) => { destroy(parent1); flush(); - assert.equal(isDestroying(parent1), true, 'parent1 destroying'); - assert.equal(isDestroyed(parent1), true, 'parent1 destroyed'); + assert.true(isDestroying(parent1), 'parent1 destroying'); + assert.true(isDestroyed(parent1), 'parent1 destroyed'); - assert.equal(isDestroying(parent2), false, 'parent2 not destroying'); - assert.equal(isDestroyed(parent2), false, 'parent2 not destroyed'); + assert.false(isDestroying(parent2), 'parent2 not destroying'); + assert.false(isDestroyed(parent2), 'parent2 not destroyed'); - assert.equal(isDestroying(child), true, 'child destroying'); - assert.equal(isDestroyed(child), true, 'child destroyed'); + assert.true(isDestroying(child), 'child destroying'); + assert.true(isDestroyed(child), 'child destroyed'); assert.verifySteps(['child', 'parent1'], 'first parent and child destroyed'); destroy(parent2); flush(); - assert.equal(isDestroying(parent1), true, 'parent1 destroying'); - assert.equal(isDestroyed(parent1), true, 'parent1 destroyed'); + assert.true(isDestroying(parent1), 'parent1 destroying'); + assert.true(isDestroyed(parent1), 'parent1 destroyed'); - assert.equal(isDestroying(parent2), true, 'parent2 destroying'); - assert.equal(isDestroyed(parent2), true, 'parent2 destroyed'); + assert.true(isDestroying(parent2), 'parent2 destroying'); + assert.true(isDestroyed(parent2), 'parent2 destroyed'); - assert.equal(isDestroying(child), true, 'child destroying'); - assert.equal(isDestroyed(child), true, 'child destroyed'); + assert.true(isDestroying(child), 'child destroying'); + assert.true(isDestroyed(child), 'child destroyed'); assert.verifySteps(['parent2'], 'second parent destroyed'); }); @@ -305,45 +297,41 @@ module('Destroyables', (hooks) => { registerDestructor(parent, () => assert.step('parent')); registerDestructor(child, () => assert.step('child')); - assert.equal(isDestroying(parent), false, 'parent not destroying at first'); - assert.equal(isDestroyed(parent), false, 'parent not destroyed at first'); + assert.false(isDestroying(parent), 'parent not destroying at first'); + assert.false(isDestroyed(parent), 'parent not destroyed at first'); - assert.equal(isDestroying(child), false, 'child not destroying at first'); - assert.equal(isDestroyed(child), false, 'child not destroyed at first'); + assert.false(isDestroying(child), 'child not destroying at first'); + assert.false(isDestroyed(child), 'child not destroyed at first'); destroyChildren(parent); - assert.equal(isDestroying(parent), false, 'parent not immediately after child destroy()'); - assert.equal(isDestroyed(parent), false, 'parent not destroyed after child destroy()'); + assert.false(isDestroying(parent), 'parent not immediately after child destroy()'); + assert.false(isDestroyed(parent), 'parent not destroyed after child destroy()'); - assert.equal(isDestroying(child), true, 'child destroying immediately after destroy()'); - assert.equal( - isDestroyed(child), - false, - 'child not destroyed immediately after destroy() called' - ); + assert.true(isDestroying(child), 'child destroying immediately after destroy()'); + assert.false(isDestroyed(child), 'child not destroyed immediately after destroy() called'); assert.verifySteps([], 'nothing destroyed yet'); flush(); - assert.equal(isDestroying(parent), false, 'parent still not destroying after flush'); - assert.equal(isDestroyed(parent), false, 'parent not destroyed after flush'); + assert.false(isDestroying(parent), 'parent still not destroying after flush'); + assert.false(isDestroyed(parent), 'parent not destroyed after flush'); - assert.equal(isDestroying(child), true, 'child still destroying after flush'); - assert.equal(isDestroyed(child), true, 'child destroyed after flush'); + assert.true(isDestroying(child), 'child still destroying after flush'); + assert.true(isDestroyed(child), 'child destroyed after flush'); assert.verifySteps(['child'], 'child destructor called'); destroy(parent); - assert.equal(isDestroying(parent), true, 'parent destroying after destroy()'); - assert.equal(isDestroyed(parent), false, 'parent not destroyed before flush'); + assert.true(isDestroying(parent), 'parent destroying after destroy()'); + assert.false(isDestroyed(parent), 'parent not destroyed before flush'); flush(); - assert.equal(isDestroying(parent), true, 'parent still destroying after flush'); - assert.equal(isDestroyed(parent), true, 'parent destroyed after flush'); + assert.true(isDestroying(parent), 'parent still destroying after flush'); + assert.true(isDestroyed(parent), 'parent destroyed after flush'); assert.verifySteps(['parent'], 'parent destructor called'); }); @@ -384,9 +372,11 @@ module('Destroyables', (hooks) => { associateDestroyableChild(parent, child); registerDestructor(parent, (_parent) => - assert.equal(parent, _parent, 'passed the correct value') + assert.strictEqual(parent, _parent, 'passed the correct value') + ); + registerDestructor(child, (_child) => + assert.strictEqual(child, _child, 'passed the correct value') ); - registerDestructor(child, (_child) => assert.equal(child, _child, 'passed the correct value')); destroy(parent); flush(); @@ -472,7 +462,11 @@ module('Destroyables', (hooks) => { try { assertDestroyablesDestroyed!(); } catch (error) { - assert.deepEqual(error.destroyables, [obj1, obj2], 'destroyables property'); + assert.deepEqual( + (error as { destroyables: unknown[] }).destroyables, + [obj1, obj2], + 'destroyables property' + ); } }); diff --git a/packages/@glimmer/dom-change-list/lib/dom-operations.ts b/packages/@glimmer/dom-change-list/lib/dom-operations.ts index 50b0a649ac..eb56a04de2 100644 --- a/packages/@glimmer/dom-change-list/lib/dom-operations.ts +++ b/packages/@glimmer/dom-change-list/lib/dom-operations.ts @@ -1,15 +1,16 @@ -import { Option } from '@glimmer/interfaces'; -import { dict, assert, assign } from '@glimmer/util'; -import { NodeToken, NodeTokensImpl } from './node-tokens'; import { - Namespace, - ElementNamespace, AttrNamespace, + ElementNamespace, + Namespace, + NodeToken, + Option, SimpleDocument, - SimpleNode, - SimpleElement, SimpleDocumentFragment, -} from '@simple-dom/interface'; + SimpleElement, + SimpleNode, +} from '@glimmer/interfaces'; +import { dict, assert, assign } from '@glimmer/util'; +import { NodeTokensImpl } from './node-tokens'; export enum ConstructionOperation { OpenElement, diff --git a/packages/@glimmer/dom-change-list/lib/node-tokens.ts b/packages/@glimmer/dom-change-list/lib/node-tokens.ts index e2d88dabb0..d14cc02031 100644 --- a/packages/@glimmer/dom-change-list/lib/node-tokens.ts +++ b/packages/@glimmer/dom-change-list/lib/node-tokens.ts @@ -1,7 +1,4 @@ -import { NodeTokens } from '@glimmer/interfaces'; -import { SimpleNode } from '@simple-dom/interface'; - -export type NodeToken = number; +import { NodeToken, NodeTokens, SimpleNode } from '@glimmer/interfaces'; export class NodeTokensImpl implements NodeTokens { private nodes: SimpleNode[] = []; diff --git a/packages/@glimmer/dom-change-list/lib/tree-builder.ts b/packages/@glimmer/dom-change-list/lib/tree-builder.ts index ce01ba4e05..220a581314 100644 --- a/packages/@glimmer/dom-change-list/lib/tree-builder.ts +++ b/packages/@glimmer/dom-change-list/lib/tree-builder.ts @@ -1,13 +1,15 @@ -import { Option, NodeTokens, Dict } from '@glimmer/interfaces'; -import { HTML } from './dom-operations'; -import { DOMTreeConstruction } from './tree-construction'; -import { NodeToken } from './node-tokens'; import { + Option, + NodeTokens, + Dict, Namespace, + NodeToken, SimpleElement, SimpleDocumentFragment, SimpleDocument, -} from '@simple-dom/interface'; +} from '@glimmer/interfaces'; +import { HTML } from './dom-operations'; +import { DOMTreeConstruction } from './tree-construction'; export const SVG_NAMESPACE = Namespace.SVG; export const HTML_NAMESPACE = Namespace.HTML; diff --git a/packages/@glimmer/dom-change-list/lib/tree-construction.ts b/packages/@glimmer/dom-change-list/lib/tree-construction.ts index cb72539ac8..6d92373b15 100644 --- a/packages/@glimmer/dom-change-list/lib/tree-construction.ts +++ b/packages/@glimmer/dom-change-list/lib/tree-construction.ts @@ -1,11 +1,12 @@ -import { NodeToken, NodeTokensImpl } from './node-tokens'; +import { NodeTokensImpl } from './node-tokens'; import { HTML, OperationsBuilder, run } from './dom-operations'; import { Namespace, SimpleDocument, SimpleElement, SimpleDocumentFragment, -} from '@simple-dom/interface'; + NodeToken, +} from '@glimmer/interfaces'; // https://github.com/whatwg/dom/issues/270 diff --git a/packages/@glimmer/dom-change-list/package.json b/packages/@glimmer/dom-change-list/package.json index 3a0493101d..3c5b0f7fae 100644 --- a/packages/@glimmer/dom-change-list/package.json +++ b/packages/@glimmer/dom-change-list/package.json @@ -3,10 +3,9 @@ "version": "0.84.3", "repository": "https://github.com/glimmerjs/glimmer-vm/tree/master/packages/@glimmer/dom-change-list", "dependencies": { - "@glimmer/util": "0.84.3", - "@glimmer/interfaces": "0.84.3", - "@simple-dom/document": "^1.4.0", - "@simple-dom/interface": "^1.4.0" + "@glimmer/util": "workspace:^", + "@glimmer/interfaces": "workspace:^", + "@simple-dom/document": "^1.4.0" }, "devDependencies": { "@simple-dom/serializer": "^1.4.0", diff --git a/packages/@glimmer/dom-change-list/test/change-list-test.ts b/packages/@glimmer/dom-change-list/test/change-list-test.ts index 8c70979f4a..805d4b85bb 100644 --- a/packages/@glimmer/dom-change-list/test/change-list-test.ts +++ b/packages/@glimmer/dom-change-list/test/change-list-test.ts @@ -7,7 +7,7 @@ import { SimpleDocument, SimpleElement, SimpleDocumentFragment, -} from '@simple-dom/interface'; +} from '@glimmer/interfaces'; import createDocument from '@simple-dom/document'; const SVG = Namespace.SVG; @@ -113,7 +113,7 @@ export class ChangeListTest extends TestCase { protected shouldEqual(expectedHTML: string) { let tokens = this.append(); let actualHTML = toHTML(this.parent); - QUnit.assert.equal(actualHTML, expectedHTML); + QUnit.assert.strictEqual(actualHTML, expectedHTML); let { expected, actual } = this.tree.reify(tokens); @@ -123,7 +123,7 @@ export class ChangeListTest extends TestCase { protected shouldEqualNS(expected: string) { this.append(); let actual = toHTMLNS(this.parent); - QUnit.assert.equal(actual, expected); + QUnit.assert.strictEqual(actual, expected); } } diff --git a/packages/@glimmer/dom-change-list/test/support.ts b/packages/@glimmer/dom-change-list/test/support.ts index 8e89f6a781..f410ce1617 100644 --- a/packages/@glimmer/dom-change-list/test/support.ts +++ b/packages/@glimmer/dom-change-list/test/support.ts @@ -7,7 +7,7 @@ import { SimpleElement, SimpleDocumentFragment, SimpleAttr, -} from '@simple-dom/interface'; +} from '@glimmer/interfaces'; import Serializer from '@simple-dom/serializer'; import voidMap from '@simple-dom/void-map'; diff --git a/packages/@glimmer/dom-change-list/test/test-case.ts b/packages/@glimmer/dom-change-list/test/test-case.ts index 689939b1ba..1685b1b934 100644 --- a/packages/@glimmer/dom-change-list/test/test-case.ts +++ b/packages/@glimmer/dom-change-list/test/test-case.ts @@ -41,15 +41,16 @@ export interface Constructor { prototype: Prototype; } -export function module(name: string): (klass: typeof TestCase & Constructor) => void { - return function (klass: typeof TestCase & Constructor) { +export function module(name: string): (klass: new () => TestCase) => void { + return function (klass: new () => TestCase) { QUnit.module(name); - let proto = (klass.prototype as any) as Dict; + let proto = klass.prototype as any as Dict; for (let prop in proto) { const test = proto[prop]; if (isTestFunction(test)) { + // eslint-disable-next-line qunit/require-expect QUnit.test(prop, (assert) => new klass().run(test, assert)); } } diff --git a/packages/@glimmer/dom-change-list/test/tree-builder-test.ts b/packages/@glimmer/dom-change-list/test/tree-builder-test.ts index 5f426c4e59..cfecfb8a6e 100644 --- a/packages/@glimmer/dom-change-list/test/tree-builder-test.ts +++ b/packages/@glimmer/dom-change-list/test/tree-builder-test.ts @@ -3,7 +3,7 @@ import { DOMTreeConstruction, NodeTokensImpl, TreeBuilder } from '..'; import { TestCase, module, test } from './test-case'; import { XLINK, Builder as TestBuilder, toHTML, toHTMLNS } from './support'; import createHTMLDocument from '@simple-dom/document'; -import { SimpleDocument, SimpleDocumentFragment, SimpleElement } from '@simple-dom/interface'; +import { SimpleDocument, SimpleDocumentFragment, SimpleElement } from '@glimmer/interfaces'; @module('[dom-change-list] TreeBuilder') export class ChangeListTest extends TestCase { @@ -107,7 +107,7 @@ export class ChangeListTest extends TestCase { protected shouldEqual(expectedHTML: string) { let tokens = this.append(); let actualHTML = toHTML(this.parent); - QUnit.assert.equal(actualHTML, expectedHTML); + QUnit.assert.strictEqual(actualHTML, expectedHTML); let { expected, actual } = this.tree.reify(tokens); @@ -117,7 +117,7 @@ export class ChangeListTest extends TestCase { protected shouldEqualNS(expected: string) { this.append(); let actual = toHTMLNS(this.parent); - QUnit.assert.equal(actual, expected); + QUnit.assert.strictEqual(actual, expected); } } diff --git a/packages/@glimmer/encoder/package.json b/packages/@glimmer/encoder/package.json index 012a3680dc..960b81ece2 100644 --- a/packages/@glimmer/encoder/package.json +++ b/packages/@glimmer/encoder/package.json @@ -4,7 +4,7 @@ "repository": "https://github.com/glimmerjs/glimmer-vm/tree/master/packages/@glimmer/encoder", "dependencies": { "@glimmer/env": "0.1.7", - "@glimmer/interfaces": "0.84.3", - "@glimmer/vm": "0.84.3" + "@glimmer/interfaces": "workspace:^", + "@glimmer/vm": "workspace:^" } } diff --git a/packages/@glimmer/integration-tests/lib/components/emberish-curly.ts b/packages/@glimmer/integration-tests/lib/components/emberish-curly.ts index a517f4d9e2..3ac973acac 100644 --- a/packages/@glimmer/integration-tests/lib/components/emberish-curly.ts +++ b/packages/@glimmer/integration-tests/lib/components/emberish-curly.ts @@ -1,37 +1,37 @@ +import { registerDestructor } from '@glimmer/destroyable'; import { - Option, - CapturedNamedArguments, Bounds, - WithDynamicTagName, - WithDynamicLayout, - Template, - VMArguments, - PreparedArguments, - DynamicScope, - ElementOperations, + CapturedNamedArguments, + CompilableProgram, Destroyable, Dict, + DynamicScope, + ElementOperations, + Environment, InternalComponentCapabilities, - WithCreateInstance, - CompilableProgram, + Reference, + Option, Owner, - Environment, + PreparedArguments, + Template, + VMArguments, + WithCreateInstance, + WithDynamicLayout, + WithDynamicTagName, } from '@glimmer/interfaces'; import { setInternalComponentManager } from '@glimmer/manager'; import { + childRefFor, + createComputeRef, createConstRef, createPrimitiveRef, valueForRef, - Reference, - childRefFor, - createComputeRef, } from '@glimmer/reference'; -import { createTag, dirtyTag, DirtyableTag, consumeTag, dirtyTagFor } from '@glimmer/validator'; -import { keys, EMPTY_ARRAY, assign, unwrapTemplate } from '@glimmer/util'; -import { registerDestructor } from '@glimmer/destroyable'; import { reifyNamed, reifyPositional } from '@glimmer/runtime'; -import { TestComponentConstructor } from './types'; +import { EMPTY_ARRAY, assign, keys, unwrapTemplate } from '@glimmer/util'; +import { DirtyableTag, consumeTag, createTag, dirtyTag, dirtyTagFor } from '@glimmer/validator'; import { TestJitRuntimeResolver } from '../modes/jit/resolver'; +import { TestComponentConstructor } from './types'; export type Attrs = Dict; export type AttrsDiff = { oldAttrs: Option; newAttrs: Attrs }; @@ -135,7 +135,8 @@ export class EmberishCurlyComponentManager implements WithCreateInstance, WithDynamicTagName, - WithDynamicLayout { + WithDynamicLayout +{ getDebugName(state: EmberishCurlyComponentFactory) { return state.name; } diff --git a/packages/@glimmer/integration-tests/lib/dom/assertions.ts b/packages/@glimmer/integration-tests/lib/dom/assertions.ts index 767df98224..333cc02612 100644 --- a/packages/@glimmer/integration-tests/lib/dom/assertions.ts +++ b/packages/@glimmer/integration-tests/lib/dom/assertions.ts @@ -1,4 +1,4 @@ -import { SimpleElement, SimpleNode } from '@simple-dom/interface'; +import { SimpleElement, SimpleNode } from '@glimmer/interfaces'; import { Dict } from '@glimmer/interfaces'; import { dict, assign } from '@glimmer/util'; @@ -178,7 +178,7 @@ export function assertSerializedInElement(result: string, expected: string, mess if (matched) { QUnit.assert.ok(true, `has cursor ${matched[0]}`); let [, trimmed] = result.split(matched![0]); - QUnit.assert.equal(trimmed, expected, message); + QUnit.assert.strictEqual(trimmed, expected, message); } else { QUnit.assert.ok(false, `does not have a cursor`); } diff --git a/packages/@glimmer/integration-tests/lib/dom/simple-utils.ts b/packages/@glimmer/integration-tests/lib/dom/simple-utils.ts index 69e1b9c402..b6e523a5ed 100644 --- a/packages/@glimmer/integration-tests/lib/dom/simple-utils.ts +++ b/packages/@glimmer/integration-tests/lib/dom/simple-utils.ts @@ -9,7 +9,7 @@ import { SimpleComment, SimpleText, SimpleDocument, -} from '@simple-dom/interface'; +} from '@glimmer/interfaces'; import Serializer from '@simple-dom/serializer'; import voidMap from '@simple-dom/void-map'; import { Option } from '@glimmer/interfaces'; @@ -34,12 +34,10 @@ export interface CastToBrowserDom { Node: { browser: Node; simple: SimpleNode }; } -export type CastableSimpleDOM< - Type extends CastableNodeType = CastableNodeType -> = CastToBrowserDom[Type]['simple']; -export type CastableBrowserDom< - Type extends CastableNodeType = CastableNodeType -> = CastToBrowserDom[Type]['browser']; +export type CastableSimpleDOM = + CastToBrowserDom[Type]['simple']; +export type CastableBrowserDom = + CastToBrowserDom[Type]['browser']; type NodeTypeFor = C['nodeType']; @@ -65,12 +63,12 @@ export function castToBrowser( return null; } else if (nodeType !== undefined) { if (node.nodeType === nodeType) { - return (node as unknown) as CastableBrowserDom; + return node as unknown as CastableBrowserDom; } else { throw new Error(`ASSERT: invalid cast to ${nodeType}`); } } else { - return (node as unknown) as CastableBrowserDom; + return node as unknown as CastableBrowserDom; } } @@ -100,7 +98,7 @@ export function castToSimple( } else if (node === null) { throw new Error(`unexpected null element passed to castToSimple (add assertNull: true)`); } else if (node.nodeType === nodeType) { - return (node as unknown) as CastableSimpleDOM; + return node as unknown as CastableSimpleDOM; } else { throw new Error(`unexpected`); } diff --git a/packages/@glimmer/integration-tests/lib/modes/jit/delegate.ts b/packages/@glimmer/integration-tests/lib/modes/jit/delegate.ts index 87ebbd7bb3..b8492fb5d4 100644 --- a/packages/@glimmer/integration-tests/lib/modes/jit/delegate.ts +++ b/packages/@glimmer/integration-tests/lib/modes/jit/delegate.ts @@ -14,7 +14,7 @@ import { RuntimeContext, } from '@glimmer/interfaces'; import { programCompilationContext } from '@glimmer/opcode-compiler'; -import { artifacts } from '@glimmer/program'; +import { artifacts, RuntimeOpImpl } from '@glimmer/program'; import { createConstRef, Reference } from '@glimmer/reference'; import { array, @@ -38,7 +38,7 @@ import { SimpleDocumentFragment, SimpleElement, SimpleText, -} from '@simple-dom/interface'; +} from '@glimmer/interfaces'; import { preprocess } from '../../compile'; import { ComponentKind, ComponentTypes } from '../../components'; import { UserHelper } from '../../helpers'; @@ -68,7 +68,11 @@ export function JitDelegateContext( env: EnvironmentDelegate ): JitTestDelegateContext { let sharedArtifacts = artifacts(); - let context = programCompilationContext(sharedArtifacts, new JitCompileTimeLookup(resolver)); + let context = programCompilationContext( + sharedArtifacts, + new JitCompileTimeLookup(resolver), + (heap) => new RuntimeOpImpl(heap) + ); let runtime = runtimeContext({ document: doc }, env, sharedArtifacts, resolver); return { runtime, program: context }; } diff --git a/packages/@glimmer/integration-tests/lib/modes/jit/register.ts b/packages/@glimmer/integration-tests/lib/modes/jit/register.ts index 5ea1c4ffa0..d679e3803f 100644 --- a/packages/@glimmer/integration-tests/lib/modes/jit/register.ts +++ b/packages/@glimmer/integration-tests/lib/modes/jit/register.ts @@ -125,7 +125,7 @@ export function registerComponent( registerEmberishCurlyComponent( registry, name, - (Class as any) as typeof EmberishCurlyComponent, + Class as any as typeof EmberishCurlyComponent, layout ); break; diff --git a/packages/@glimmer/integration-tests/lib/modes/node/env.ts b/packages/@glimmer/integration-tests/lib/modes/node/env.ts index 262df21e2c..6e8f63a694 100644 --- a/packages/@glimmer/integration-tests/lib/modes/node/env.ts +++ b/packages/@glimmer/integration-tests/lib/modes/node/env.ts @@ -1,6 +1,6 @@ import { GlimmerTreeChanges, GlimmerTreeConstruction } from '@glimmer/interfaces'; import createHTMLDocument from '@simple-dom/document'; -import { SimpleDocument } from '@simple-dom/interface'; +import { SimpleDocument } from '@glimmer/interfaces'; import { JitRenderDelegate } from '../jit/delegate'; import { RenderTest } from '../../render-test'; import RenderDelegate, { RenderDelegateOptions } from '../../render-delegate'; @@ -28,19 +28,19 @@ export class AbstractNodeTest extends RenderTest { assertHTML(html: string) { let serialized = toInnerHTML(this.element); - this.assert.equal(serialized, html); + this.assert.strictEqual(serialized, html); } assertComponent(html: string) { let el = assertElement(this.element.firstChild); if (this.testType !== 'Glimmer') { - this.assert.equal(el.getAttribute('class'), 'ember-view'); + this.assert.strictEqual(el.getAttribute('class'), 'ember-view'); this.assert.ok(el.getAttribute('id')); this.assert.ok(el.getAttribute('id')!.indexOf('ember') > -1); } let serialized = toInnerHTML(el); - this.assert.equal(serialized, html); + this.assert.strictEqual(serialized, html); } } diff --git a/packages/@glimmer/integration-tests/lib/modes/rehydration/builder.ts b/packages/@glimmer/integration-tests/lib/modes/rehydration/builder.ts index 7d3a6ae942..7b8c73234d 100644 --- a/packages/@glimmer/integration-tests/lib/modes/rehydration/builder.ts +++ b/packages/@glimmer/integration-tests/lib/modes/rehydration/builder.ts @@ -1,6 +1,6 @@ import { Cursor, ElementBuilder, Environment } from '@glimmer/interfaces'; import { RehydrateBuilder } from '@glimmer/runtime'; -import { NodeType, SimpleNode } from '@simple-dom/interface'; +import { NodeType, SimpleNode } from '@glimmer/interfaces'; export class DebugRehydrationBuilder extends RehydrateBuilder { clearedNodes: SimpleNode[] = []; diff --git a/packages/@glimmer/integration-tests/lib/modes/rehydration/delegate.ts b/packages/@glimmer/integration-tests/lib/modes/rehydration/delegate.ts index c27c1431d1..e23e5d8bd1 100644 --- a/packages/@glimmer/integration-tests/lib/modes/rehydration/delegate.ts +++ b/packages/@glimmer/integration-tests/lib/modes/rehydration/delegate.ts @@ -19,7 +19,7 @@ import { SimpleElement, SimpleNode, SimpleText, -} from '@simple-dom/interface'; +} from '@glimmer/interfaces'; import { ComponentKind } from '../../components'; import { replaceHTML, toInnerHTML } from '../../dom/simple-utils'; import { UserHelper } from '../../helpers'; diff --git a/packages/@glimmer/integration-tests/lib/modes/rehydration/partial-rehydration-delegate.ts b/packages/@glimmer/integration-tests/lib/modes/rehydration/partial-rehydration-delegate.ts index 6236001dd3..bf0d717c56 100644 --- a/packages/@glimmer/integration-tests/lib/modes/rehydration/partial-rehydration-delegate.ts +++ b/packages/@glimmer/integration-tests/lib/modes/rehydration/partial-rehydration-delegate.ts @@ -1,7 +1,7 @@ import { Dict, RenderResult } from '@glimmer/interfaces'; import { renderComponent, renderSync } from '@glimmer/runtime'; import { RehydrationDelegate } from './delegate'; -import { SimpleElement } from '@simple-dom/interface'; +import { SimpleElement } from '@glimmer/interfaces'; import { DebugRehydrationBuilder } from './builder'; export class PartialRehydrationDelegate extends RehydrationDelegate { diff --git a/packages/@glimmer/integration-tests/lib/modifiers.ts b/packages/@glimmer/integration-tests/lib/modifiers.ts index dc2f9069ca..db3d83b625 100644 --- a/packages/@glimmer/integration-tests/lib/modifiers.ts +++ b/packages/@glimmer/integration-tests/lib/modifiers.ts @@ -1,4 +1,4 @@ -import { SimpleElement } from '@simple-dom/interface'; +import { SimpleElement } from '@glimmer/interfaces'; import { Dict, Option, @@ -27,7 +27,8 @@ export class TestModifierDefinitionState { } export class TestModifierManager - implements InternalModifierManager { + implements InternalModifierManager +{ create( _owner: Owner, element: SimpleElement, diff --git a/packages/@glimmer/integration-tests/lib/render-delegate.ts b/packages/@glimmer/integration-tests/lib/render-delegate.ts index e831b275c6..06c4a92daa 100644 --- a/packages/@glimmer/integration-tests/lib/render-delegate.ts +++ b/packages/@glimmer/integration-tests/lib/render-delegate.ts @@ -4,7 +4,7 @@ import { ElementNamespace, SimpleDocumentFragment, SimpleDocument, -} from '@simple-dom/interface'; +} from '@glimmer/interfaces'; import { ASTPluginBuilder } from '@glimmer/syntax'; import { ComponentKind, ComponentTypes } from './components'; import { UserHelper } from './helpers'; diff --git a/packages/@glimmer/integration-tests/lib/render-test.ts b/packages/@glimmer/integration-tests/lib/render-test.ts index ed7513124f..205aed80ea 100644 --- a/packages/@glimmer/integration-tests/lib/render-test.ts +++ b/packages/@glimmer/integration-tests/lib/render-test.ts @@ -10,7 +10,7 @@ import { import { ASTPluginBuilder } from '@glimmer/syntax'; import { dirtyTagFor } from '@glimmer/validator'; import { assert, clearElement, dict, expect } from '@glimmer/util'; -import { SimpleElement, SimpleNode } from '@simple-dom/interface'; +import { SimpleElement, SimpleNode } from '@glimmer/interfaces'; import { ComponentBlueprint, ComponentKind, diff --git a/packages/@glimmer/integration-tests/lib/snapshot.ts b/packages/@glimmer/integration-tests/lib/snapshot.ts index 52904d15e3..df8c2de736 100644 --- a/packages/@glimmer/integration-tests/lib/snapshot.ts +++ b/packages/@glimmer/integration-tests/lib/snapshot.ts @@ -1,6 +1,6 @@ import { Option } from '@glimmer/interfaces'; import { castToSimple } from '@glimmer/util'; -import { NodeType, SimpleElement, SimpleNode } from '@simple-dom/interface'; +import { NodeType, SimpleElement, SimpleNode } from '@glimmer/interfaces'; import { EndTag, Token, tokenize } from 'simple-html-tokenizer'; import { replaceHTML, toInnerHTML } from './dom/simple-utils'; @@ -140,13 +140,13 @@ export function isServerMarker(node: SimpleNode) { export function normalizeSnapshot( oldSnapshot: NodesSnapshot, newSnapshot: NodesSnapshot, - except: Array -) { + except: SimpleNode[] +): { oldSnapshot: IndividualSnapshot[]; newSnapshot: IndividualSnapshot[] } { let oldIterator = new SnapshotIterator(oldSnapshot); let newIterator = new SnapshotIterator(newSnapshot); - let normalizedOld = []; - let normalizedNew = []; + let normalizedOld: IndividualSnapshot[] = []; + let normalizedNew: IndividualSnapshot[] = []; while (true) { let nextOld = oldIterator.peek(); @@ -161,8 +161,8 @@ export function normalizeSnapshot( oldIterator.skip(); newIterator.skip(); } else { - normalizedOld.push(oldIterator.next()); - normalizedNew.push(newIterator.next()); + normalizedOld.push(oldIterator.next() as IndividualSnapshot); + normalizedNew.push(newIterator.next() as IndividualSnapshot); } } diff --git a/packages/@glimmer/integration-tests/lib/suites/custom-dom-helper.ts b/packages/@glimmer/integration-tests/lib/suites/custom-dom-helper.ts index dc39748fbb..d85c9e2593 100644 --- a/packages/@glimmer/integration-tests/lib/suites/custom-dom-helper.ts +++ b/packages/@glimmer/integration-tests/lib/suites/custom-dom-helper.ts @@ -28,10 +28,10 @@ export class CompilationTests extends RenderTest { 'generates id in node'() { let template = precompile('hello'); let obj = JSON.parse(template); - this.assert.equal(obj.id, 'G0ggkEjw', 'short sha of template source'); + this.assert.strictEqual(obj.id, 'G0ggkEjw', 'short sha of template source'); template = precompile('hello', { meta: { moduleName: 'template/hello' } }); obj = JSON.parse(template); - this.assert.equal(obj.id, '4vC0bnaR', 'short sha of template source and meta'); + this.assert.strictEqual(obj.id, '4vC0bnaR', 'short sha of template source and meta'); } } @@ -106,6 +106,6 @@ export class SerializedDOMHelperTests extends DOMHelperTests { assertHTML(html: string) { let b = blockStack(); let serialized = toInnerHTML(this.element); - this.assert.equal(serialized, `${b(0)}${html}${b(0)}`); + this.assert.strictEqual(serialized, `${b(0)}${html}${b(0)}`); } } diff --git a/packages/@glimmer/integration-tests/lib/suites/debugger.ts b/packages/@glimmer/integration-tests/lib/suites/debugger.ts index 3963ee861e..75debb0cd1 100644 --- a/packages/@glimmer/integration-tests/lib/suites/debugger.ts +++ b/packages/@glimmer/integration-tests/lib/suites/debugger.ts @@ -21,15 +21,15 @@ export class DebuggerSuite extends RenderTest { setDebuggerCallback((context: any, get) => { callbackExecuted++; - this.assert.equal(context.foo, expectedContext.foo); - this.assert.equal(get('foo'), expectedContext.foo); + this.assert.strictEqual(context.foo, expectedContext.foo); + this.assert.strictEqual(get('foo'), expectedContext.foo); }); this.render( '{{#if this.a.b}}true{{debugger}}{{else}}false{{debugger}}{{/if}}', expectedContext ); - this.assert.equal(callbackExecuted, 1); + this.assert.strictEqual(callbackExecuted, 1); this.assertHTML('true'); this.assertStableRerender(); @@ -40,7 +40,7 @@ export class DebuggerSuite extends RenderTest { }, }; this.rerender(expectedContext); - this.assert.equal(callbackExecuted, 2); + this.assert.strictEqual(callbackExecuted, 2); this.assertHTML('false'); this.assertStableNodes(); @@ -51,7 +51,7 @@ export class DebuggerSuite extends RenderTest { }, }; this.rerender(expectedContext); - this.assert.equal(callbackExecuted, 3); + this.assert.strictEqual(callbackExecuted, 3); this.assertHTML('true'); this.assertStableNodes(); } @@ -68,8 +68,8 @@ export class DebuggerSuite extends RenderTest { setDebuggerCallback((context: any, get) => { callbackExecuted++; - this.assert.equal(get('foo'), expectedContext.foo); - this.assert.equal(get('bar'), expectedContext.foo); + this.assert.strictEqual(get('foo'), expectedContext.foo); + this.assert.strictEqual(get('bar'), expectedContext.foo); this.assert.deepEqual(get('this'), context); }); @@ -77,7 +77,7 @@ export class DebuggerSuite extends RenderTest { '{{#with this.foo as |bar|}}{{#if this.a.b}}true{{debugger}}{{else}}false{{debugger}}{{/if}}{{/with}}', expectedContext ); - this.assert.equal(callbackExecuted, 1); + this.assert.strictEqual(callbackExecuted, 1); this.assertHTML('true'); this.assertStableRerender(); @@ -88,7 +88,7 @@ export class DebuggerSuite extends RenderTest { }, }; this.rerender(expectedContext); - this.assert.equal(callbackExecuted, 2); + this.assert.strictEqual(callbackExecuted, 2); this.assertHTML('false'); this.assertStableNodes(); @@ -99,7 +99,7 @@ export class DebuggerSuite extends RenderTest { }, }; this.rerender(expectedContext); - this.assert.equal(callbackExecuted, 3); + this.assert.strictEqual(callbackExecuted, 3); this.assertHTML('true'); this.assertStableNodes(); } diff --git a/packages/@glimmer/integration-tests/lib/suites/each.ts b/packages/@glimmer/integration-tests/lib/suites/each.ts index e782794fac..e8402be692 100644 --- a/packages/@glimmer/integration-tests/lib/suites/each.ts +++ b/packages/@glimmer/integration-tests/lib/suites/each.ts @@ -659,8 +659,8 @@ export class EachSuite extends RenderTest { let changedNodes = stats.move + stats.retain; assert.ok(changedNodes <= arr.length, 'changed nodes count'); - assert.equal(stats.insert, 0, 'inserted nodes count'); - assert.equal(stats.delete, 0, 'deleted nodes count'); + assert.strictEqual(stats.insert, 0, 'inserted nodes count'); + assert.strictEqual(stats.delete, 0, 'deleted nodes count'); }); this.assertHTML(arr.join('')); diff --git a/packages/@glimmer/integration-tests/lib/suites/emberish-components.ts b/packages/@glimmer/integration-tests/lib/suites/emberish-components.ts index f23c523cb2..7bffd75ffa 100644 --- a/packages/@glimmer/integration-tests/lib/suites/emberish-components.ts +++ b/packages/@glimmer/integration-tests/lib/suites/emberish-components.ts @@ -1,6 +1,6 @@ import { RenderTest, Count } from '../render-test'; import { test } from '../test-decorator'; -import { SimpleElement } from '@simple-dom/interface'; +import { SimpleElement } from '@glimmer/interfaces'; import { EmberishCurlyComponent } from '../components'; import { classes, assertEmberishElement } from '../dom/assertions'; import { assertElement, toInnerHTML } from '../dom/simple-utils'; @@ -18,7 +18,7 @@ export class EmberishComponentTests extends RenderTest { didInsertElement() { count.expect('didInsertElement'); assert.ok(this.element, 'didInsertElement'); - assert.equal(this.element!.getAttribute('data-ok'), 'true', 'didInsertElement'); + assert.strictEqual(this.element!.getAttribute('data-ok'), 'true', 'didInsertElement'); } didUpdate() { diff --git a/packages/@glimmer/integration-tests/lib/suites/entry-point.ts b/packages/@glimmer/integration-tests/lib/suites/entry-point.ts index dc34efc63e..3ad829583b 100644 --- a/packages/@glimmer/integration-tests/lib/suites/entry-point.ts +++ b/packages/@glimmer/integration-tests/lib/suites/entry-point.ts @@ -23,7 +23,10 @@ export class EntryPointTest extends RenderTest { let title = createPrimitiveRef('renderComponent'); delegate.renderComponent(Title, { title }, element); - QUnit.assert.equal(castToBrowser(element, 'HTML').innerHTML, '

hello renderComponent

'); + QUnit.assert.strictEqual( + castToBrowser(element, 'HTML').innerHTML, + '

hello renderComponent

' + ); } @test @@ -34,12 +37,15 @@ export class EntryPointTest extends RenderTest { let element = delegate.getInitialElement(); let title = createPrimitiveRef('renderComponent'); delegate.renderComponent(Title, { title }, element); - QUnit.assert.equal(castToBrowser(element, 'HTML').innerHTML, '

hello renderComponent

'); + QUnit.assert.strictEqual( + castToBrowser(element, 'HTML').innerHTML, + '

hello renderComponent

' + ); element = delegate.getInitialElement(); let newTitle = createPrimitiveRef('new title'); delegate.renderComponent(Title, { title: newTitle }, element); - QUnit.assert.equal(castToBrowser(element, 'HTML').innerHTML, '

hello new title

'); + QUnit.assert.strictEqual(castToBrowser(element, 'HTML').innerHTML, '

hello new title

'); } @test @@ -51,12 +57,15 @@ export class EntryPointTest extends RenderTest { let element = delegate.getInitialElement(); let title = createPrimitiveRef('renderComponent'); delegate.renderComponent(Title, { title }, element); - QUnit.assert.equal(castToBrowser(element, 'HTML').innerHTML, '

hello renderComponent

'); + QUnit.assert.strictEqual( + castToBrowser(element, 'HTML').innerHTML, + '

hello renderComponent

' + ); element = delegate.getInitialElement(); let body = createPrimitiveRef('text'); delegate.renderComponent(Body, { body }, element); - QUnit.assert.equal(castToBrowser(element, 'HTML').innerHTML, '

body text

'); + QUnit.assert.strictEqual(castToBrowser(element, 'HTML').innerHTML, '

body text

'); } @test @@ -70,6 +79,6 @@ export class EntryPointTest extends RenderTest { }); delegate.renderComponent(Locale, {}, element, dynamicScope); - QUnit.assert.equal(castToBrowser(element, 'HTML').innerHTML, 'en_US'); + QUnit.assert.strictEqual(castToBrowser(element, 'HTML').innerHTML, 'en_US'); } } diff --git a/packages/@glimmer/integration-tests/lib/suites/in-element.ts b/packages/@glimmer/integration-tests/lib/suites/in-element.ts index 2ccda2374e..0f22fc5b7b 100644 --- a/packages/@glimmer/integration-tests/lib/suites/in-element.ts +++ b/packages/@glimmer/integration-tests/lib/suites/in-element.ts @@ -536,19 +536,19 @@ export class InElementSuite extends RenderTest { ); equalsElement(externalElement, 'div', {}, stripTight``); - this.assert.equal(destroyed, 0, 'component was destroyed'); + this.assert.strictEqual(destroyed, 0, 'component was destroyed'); this.assertHTML(''); this.assertStableRerender(); this.rerender({ showExternal: true }); equalsElement(externalElement, 'div', {}, stripTight`[destroy me!]`); - this.assert.equal(destroyed, 0, 'component was destroyed'); + this.assert.strictEqual(destroyed, 0, 'component was destroyed'); this.assertHTML(''); this.assertStableRerender(); this.rerender({ showExternal: false }); equalsElement(externalElement, 'div', {}, stripTight``); - this.assert.equal(destroyed, 1, 'component was destroyed'); + this.assert.strictEqual(destroyed, 1, 'component was destroyed'); this.assertHTML(''); this.assertStableRerender(); } diff --git a/packages/@glimmer/integration-tests/lib/suites/initial-render.ts b/packages/@glimmer/integration-tests/lib/suites/initial-render.ts index ef0facc148..d6798416c3 100644 --- a/packages/@glimmer/integration-tests/lib/suites/initial-render.ts +++ b/packages/@glimmer/integration-tests/lib/suites/initial-render.ts @@ -1,4 +1,4 @@ -import { Namespace, SimpleElement } from '@simple-dom/interface'; +import { Namespace, SimpleElement } from '@glimmer/interfaces'; import { RenderTest } from '../render-test'; import { test } from '../test-decorator'; import { castToBrowser, checkNode, strip, unwrap } from '@glimmer/util'; @@ -415,7 +415,7 @@ export class InitialRenderSuite extends RenderTest { `); let selectNode = checkNode(castToBrowser(this.element, 'HTML').firstElementChild, 'select'); - this.assert.equal(selectNode.selectedIndex, 1); + this.assert.strictEqual(selectNode.selectedIndex, 1); this.assertStableRerender(); this.rerender({ selected: false }); @@ -429,7 +429,7 @@ export class InitialRenderSuite extends RenderTest { selectNode = checkNode(castToBrowser(this.element, 'HTML').firstElementChild, 'select'); - this.assert.equal(selectNode.selectedIndex, 0); + this.assert.strictEqual(selectNode.selectedIndex, 0); this.assertStableNodes(); @@ -445,7 +445,7 @@ export class InitialRenderSuite extends RenderTest { selectNode = checkNode(castToBrowser(this.element, 'HTML').firstElementChild, 'select'); - this.assert.equal(selectNode.selectedIndex, 0); + this.assert.strictEqual(selectNode.selectedIndex, 0); this.assertStableNodes(); @@ -459,7 +459,7 @@ export class InitialRenderSuite extends RenderTest { `); selectNode = checkNode(castToBrowser(this.element, 'HTML').firstElementChild, 'select'); - this.assert.equal(selectNode.selectedIndex, 1); + this.assert.strictEqual(selectNode.selectedIndex, 1); this.assertStableNodes(); } @@ -509,13 +509,13 @@ export class InitialRenderSuite extends RenderTest { `); - this.assert.equal(selected.length, 2, 'two options are selected'); - this.assert.equal( + this.assert.strictEqual(selected.length, 2, 'two options are selected'); + this.assert.strictEqual( castToBrowser(selected[0], 'option').value, '1', 'first selected item is "1"' ); - this.assert.equal( + this.assert.strictEqual( castToBrowser(selected[1], 'option').value, '2', 'second selected item is "2"' @@ -608,7 +608,7 @@ export class InitialRenderSuite extends RenderTest { if (assertNodeTagName(svg, 'svg')) { let use = svg.firstChild; if (assertNodeTagName(use, 'use')) { - this.assert.equal(use.href.baseVal, 'home'); + this.assert.strictEqual(use.href.baseVal, 'home'); } } } @@ -626,7 +626,7 @@ export class InitialRenderSuite extends RenderTest { if (assertNodeTagName(svg, 'svg')) { let use = svg.firstChild; if (assertNodeTagName(use, 'use')) { - this.assert.equal(use.href.baseVal, 'home'); + this.assert.strictEqual(use.href.baseVal, 'home'); } } } @@ -637,8 +637,8 @@ export class InitialRenderSuite extends RenderTest { this.assertHTML(''); let svg = this.element.firstChild; if (assertNodeTagName(svg, 'svg')) { - this.assert.equal(svg.namespaceURI, Namespace.SVG); - this.assert.equal(svg.getAttribute('viewBox'), '0 0 0 0'); + this.assert.strictEqual(svg.namespaceURI, Namespace.SVG); + this.assert.strictEqual(svg.getAttribute('viewBox'), '0 0 0 0'); } this.assertStableRerender(); } @@ -652,16 +652,16 @@ export class InitialRenderSuite extends RenderTest { let svg = this.element.firstChild; if (assertNodeTagName(svg, 'svg')) { - this.assert.equal(svg.namespaceURI, Namespace.SVG); + this.assert.strictEqual(svg.namespaceURI, Namespace.SVG); let path = svg.firstChild; if (assertNodeTagName(path, 'path')) { - this.assert.equal( + this.assert.strictEqual( path.namespaceURI, Namespace.SVG, 'creates the path element with a namespace' ); - this.assert.equal(path.getAttribute('d'), d); + this.assert.strictEqual(path.getAttribute('d'), d); } } @@ -676,12 +676,12 @@ export class InitialRenderSuite extends RenderTest { let svg = this.element.firstChild; if (assertNodeTagName(svg, 'svg')) { - this.assert.equal(svg.namespaceURI, Namespace.SVG); + this.assert.strictEqual(svg.namespaceURI, Namespace.SVG); let foreignObject = svg.firstChild; if (assertNodeTagName(foreignObject, 'foreignObject')) { - this.assert.equal( + this.assert.strictEqual( foreignObject.namespaceURI, Namespace.SVG, 'creates the foreignObject element with a namespace' @@ -697,19 +697,19 @@ export class InitialRenderSuite extends RenderTest { this.render('
'); this.assertHTML('
'); - this.assert.equal( + this.assert.strictEqual( castToBrowser(unwrap(this.element.childNodes[0]), 'SVG').namespaceURI, Namespace.SVG, 'creates the first svg element with a namespace' ); - this.assert.equal( + this.assert.strictEqual( castToBrowser(this.element.childNodes[1], 'SVG').namespaceURI, Namespace.SVG, 'creates the second svg element with a namespace' ); - this.assert.equal( + this.assert.strictEqual( castToBrowser(this.element.childNodes[2], 'HTML').namespaceURI, XHTML_NAMESPACE, 'creates the div element without a namespace' @@ -729,7 +729,7 @@ export class InitialRenderSuite extends RenderTest { this.assertHTML('
'); if (assertNodeTagName(firstDiv, 'div')) { - this.assert.equal( + this.assert.strictEqual( firstDiv.namespaceURI, XHTML_NAMESPACE, "first div's namespace is xhtmlNamespace" @@ -737,11 +737,11 @@ export class InitialRenderSuite extends RenderTest { } if (assertNodeTagName(svg, 'svg')) { - this.assert.equal(svg.namespaceURI, Namespace.SVG, "svg's namespace is svgNamespace"); + this.assert.strictEqual(svg.namespaceURI, Namespace.SVG, "svg's namespace is svgNamespace"); } if (assertNodeTagName(secondDiv, 'div')) { - this.assert.equal( + this.assert.strictEqual( secondDiv.namespaceURI, XHTML_NAMESPACE, "last div's namespace is xhtmlNamespace" diff --git a/packages/@glimmer/integration-tests/lib/test-helpers/module.ts b/packages/@glimmer/integration-tests/lib/test-helpers/module.ts index 5e88383196..5705a59700 100644 --- a/packages/@glimmer/integration-tests/lib/test-helpers/module.ts +++ b/packages/@glimmer/integration-tests/lib/test-helpers/module.ts @@ -70,7 +70,7 @@ export function suite( if (shouldRunTest(Delegate)) { componentModule( `${Delegate.style} :: Components :: ${suiteName}`, - (klass as any) as RenderTestConstructor, + klass as any as RenderTestConstructor, Delegate ); } @@ -99,7 +99,7 @@ export function suite( instance!.count.assert(); }); } else { - // eslint-disable-next-line no-loop-func + // eslint-disable-next-line no-loop-func, qunit/require-expect QUnit.test(prop, (assert) => { let result = test.call(instance!, assert, instance!.count); instance!.count.assert(); @@ -131,6 +131,7 @@ function componentModule( return (type: ComponentKind, klass: RenderTestConstructor) => { if (!shouldSkip) { + // eslint-disable-next-line qunit/require-expect QUnit.test(prop, (assert) => { let instance = new klass(new Delegate()); instance.testType = type; diff --git a/packages/@glimmer/integration-tests/package.json b/packages/@glimmer/integration-tests/package.json index ca152052c1..db2c7154c7 100644 --- a/packages/@glimmer/integration-tests/package.json +++ b/packages/@glimmer/integration-tests/package.json @@ -4,28 +4,28 @@ "private": true, "repository": "https://github.com/glimmerjs/glimmer-vm/tree/master/packages/@glimmer/integration-tests", "dependencies": { - "@glimmer/destroyable": "0.84.3", - "@glimmer/global-context": "0.84.3", - "@glimmer/reference": "0.84.3", - "@glimmer/runtime": "0.84.3", - "@glimmer/manager": "0.84.3", - "@glimmer/syntax": "0.84.3", - "@glimmer/validator": "0.84.3", - "@glimmer/compiler": "0.84.3", - "@glimmer/util": "0.84.3", - "@glimmer/wire-format": "0.84.3", - "@glimmer/interfaces": "0.84.3", - "@glimmer/node": "0.84.3", - "@glimmer/opcode-compiler": "0.84.3", - "@glimmer/owner": "0.84.3", - "@glimmer/program": "0.84.3", + "@glimmer/destroyable": "workspace:^", + "@glimmer/global-context": "workspace:^", + "@glimmer/reference": "workspace:^", + "@glimmer/runtime": "workspace:^", + "@glimmer/manager": "workspace:^", + "@glimmer/syntax": "workspace:^", + "@glimmer/validator": "workspace:^", + "@glimmer/compiler": "workspace:^", + "@glimmer/util": "workspace:^", + "@glimmer/wire-format": "workspace:^", + "@glimmer/interfaces": "workspace:^", + "@glimmer/node": "workspace:^", + "@glimmer/opcode-compiler": "workspace:^", + "@glimmer/owner": "workspace:^", + "@glimmer/program": "workspace:^", "@simple-dom/document": "^1.4.0", - "@simple-dom/interface": "^1.4.0", "@simple-dom/serializer": "^1.4.0", "@simple-dom/void-map": "^1.4.0", "simple-html-tokenizer": "^0.5.11" }, "devDependencies": { - "@types/qunit": "^2.9.0" + "@glimmer/local-debug-flags": "workspace:^", + "@types/qunit": "^2.19.5" } } diff --git a/packages/@glimmer/integration-tests/test/attributes-test.ts b/packages/@glimmer/integration-tests/test/attributes-test.ts index 279ae2d081..33657566a6 100644 --- a/packages/@glimmer/integration-tests/test/attributes-test.ts +++ b/packages/@glimmer/integration-tests/test/attributes-test.ts @@ -1,6 +1,6 @@ import { normalizeProperty } from '@glimmer/runtime'; import { assertElement, hasAttribute, jitSuite, RenderTest, test, tracked } from '..'; -import { Namespace, SimpleElement } from '@simple-dom/interface'; +import { Namespace, SimpleElement } from '@glimmer/interfaces'; import { castToBrowser, expect } from '@glimmer/util'; export class AttributesTests extends RenderTest { @@ -156,28 +156,28 @@ export class AttributesTests extends RenderTest { @test 'can read attributes'() { this.render('
'); - this.assert.equal(this.readDOMAttr('data-bar'), 'bar'); + this.assert.strictEqual(this.readDOMAttr('data-bar'), 'bar'); this.assertStableRerender(); } @test 'can read attributes from namespace elements'() { this.render(''); - this.assert.equal(this.readDOMAttr('viewBox'), '0 0 0 0'); + this.assert.strictEqual(this.readDOMAttr('viewBox'), '0 0 0 0'); this.assertStableRerender(); } @test 'can read properties'() { this.render(''); - this.assert.equal(this.readDOMAttr('value'), 'gnargnar'); + this.assert.strictEqual(this.readDOMAttr('value'), 'gnargnar'); this.assertStableRerender(); } @test 'can read the form attribute'() { this.render('