diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 14770e530f6..0a5e4108d9a 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -13,7 +13,7 @@ inputs: runs: using: 'composite' steps: - - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 + - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 name: Install pnpm with: run_install: false diff --git a/.github/workflows/ci-jobs.yml b/.github/workflows/ci-jobs.yml index de5b6856e8b..716194715cf 100644 --- a/.github/workflows/ci-jobs.yml +++ b/.github/workflows/ci-jobs.yml @@ -37,8 +37,6 @@ jobs: run: pnpm build:types - name: Check internal types run: pnpm type-check:internals - - name: Check @handlebars/parser types - run: pnpm type-check:handlebars - name: Check published types run: pnpm type-check:types @@ -61,6 +59,20 @@ jobs: - name: Check published types run: pnpm type-check:types + build-test: + name: package preparation test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - uses: ./.github/actions/setup + with: + use_lockfile: "false" + - name: build + run: pnpm build + - uses: wyvox/action-no-git-diff@6d1f5759a221e2ea447974af795e395672e33328 # v1.0.1 + basic-test: name: Basic Test runs-on: ubuntu-latest @@ -150,7 +162,7 @@ jobs: smoke-test: name: Smoke tests (Full Ember Apps) runs-on: ubuntu-latest - needs: [basic-test, lint, types] + needs: [basic-test, lint, types, build-test] strategy: fail-fast: false matrix: ${{fromJson(needs.lint.outputs.matrix)}} @@ -170,10 +182,34 @@ jobs: env: MATRIX_COMMAND: ${{ matrix.command }} + smoke-test-with-deprecations-removed: + name: Smoke tests with Deprecations Removed (Full Ember Apps) + runs-on: ubuntu-latest + needs: [basic-test, lint, types, build-test] + strategy: + fail-fast: false + matrix: ${{fromJson(needs.lint.outputs.matrix)}} + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - uses: ./.github/actions/setup + with: + use_lockfile: "false" + - name: build + run: pnpm build + - name: test + env: + OVERRIDE_DEPRECATION_VERSION: "15.0.0" + MATRIX_COMMAND: ${{ matrix.command }} + working-directory: smoke-tests/scenarios + run: | + ${MATRIX_COMMAND} + node-test: name: Node.js Tests runs-on: ubuntu-latest - needs: [basic-test, lint, types] + needs: [basic-test, lint, types, build-test] steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -184,7 +220,7 @@ jobs: SHOULD_TRANSPILE_FOR_NODE: true run: pnpm build - name: test - run: pnpm test:node && pnpm --filter "@handlebars/parser" test + run: pnpm test:node blueprint-test: name: Blueprint Tests diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4d11c80c148..bf3274c2b11 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -39,7 +39,7 @@ jobs: path: ember-api-docs-data persist-credentials: false - - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 + - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 name: Install pnpm with: run_install: false diff --git a/.github/workflows/glimmer-syntax-prettier-smoke-test.yml b/.github/workflows/glimmer-syntax-prettier-smoke-test.yml index 3b87973841f..391af75c8f9 100644 --- a/.github/workflows/glimmer-syntax-prettier-smoke-test.yml +++ b/.github/workflows/glimmer-syntax-prettier-smoke-test.yml @@ -17,7 +17,6 @@ on: - "packages/@glimmer/interfaces/**" - "packages/@glimmer/util/**" - "packages/@glimmer/wire-format/**" - - "packages/@handlebars/parser/**" pull_request: paths: - ".github/workflows/glimmer-syntax-prettier-smoke-test.yml" @@ -27,7 +26,6 @@ on: - "packages/@glimmer/interfaces/**" - "packages/@glimmer/util/**" - "packages/@glimmer/wire-format/**" - - "packages/@handlebars/parser/**" workflow_dispatch: permissions: @@ -63,6 +61,10 @@ jobs: working-directory: prettier-repo run: yarn add "@glimmer/syntax@file:${{ github.workspace }}/glimmer-syntax.tgz" + - name: Update error snapshots (our error messages differ from Jison's verbose format) + working-directory: prettier-repo + run: yarn jest --updateSnapshot tests/format/handlebars/_errors_/ + - name: Run prettier handlebars tests working-directory: prettier-repo run: yarn jest tests/format/handlebars diff --git a/.github/workflows/smoke-test-app-template-updates.yml b/.github/workflows/smoke-test-app-template-updates.yml index de176b9eac1..93fc561a9f8 100644 --- a/.github/workflows/smoke-test-app-template-updates.yml +++ b/.github/workflows/smoke-test-app-template-updates.yml @@ -12,14 +12,20 @@ jobs: gate: name: Gate to every 10 weeks runs-on: ubuntu-latest + outputs: + should_run: ${{ steps.check.outputs.should_run }} steps: - name: Check schedule + id: check run: | set -euo pipefail week=$(date +%V) if [ $((10#$week % 10)) -ne 0 ]; then echo "Skipping: ISO week $week is not a 10-week interval." - exit 0 + echo "should_run=false" >> "$GITHUB_OUTPUT" + else + echo "Running: ISO week $week is a 10-week interval." + echo "should_run=true" >> "$GITHUB_OUTPUT" fi update-app-template: @@ -29,6 +35,7 @@ jobs: contents: write pull-requests: write needs: gate + if: needs.gate.outputs.should_run == 'true' steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -38,7 +45,7 @@ jobs: with: node-version: 20 - name: Setup pnpm - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 + uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 - name: Generate ember-test-app using classic blueprint run: | set -euo pipefail @@ -68,6 +75,7 @@ jobs: name: Regenerate smoke-tests v2 app template runs-on: ubuntu-latest needs: gate + if: needs.gate.outputs.should_run == 'true' permissions: contents: write pull-requests: write @@ -80,7 +88,7 @@ jobs: with: node-version: 20 - name: Setup pnpm - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 + uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 - name: Generate v2-app-template run: | set -euo pipefail diff --git a/.gitignore b/.gitignore index 4a4c99b4f3e..9bf32df156f 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ assets/bpm_libs.js assets/bpm_styles.css coverage dist +dist-prod /docs lib/*/tests/all.js lib/*/tests/qunit* diff --git a/.prettierignore b/.prettierignore index aad3009a647..ba24e3a5116 100644 --- a/.prettierignore +++ b/.prettierignore @@ -7,8 +7,6 @@ docs/ **/smoke-tests/ **/types/ **/type-tests/ -packages/@handlebars/**/*.l -packages/@handlebars/**/*.yy CHANGELOG.md package.json pnpm-lock.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a554090b6e..bb14c255a15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,45 @@ # Ember Changelog -## v6.12.0-beta.2 (March 9, 2026) +## v7.0.0-beta.1 (March 31, 2026) + +- [#21240](https://github.com/emberjs/ember.js/pull/21240) [CLEANUP] Remove deprecated amd bundles and `use-ember-modules` optional feature per [RFC #1101](https://rfcs.emberjs.com/id/1101-deprecate-ember-vendor-bundles). +- [#21275](https://github.com/emberjs/ember.js/pull/21275) [CLEANUP] Remove ember barrel file (`import Ember from 'ember'`) per [RFC #1003](https://rfcs.emberjs.com/id/1003-deprecation-import-ember-from-ember). +- [#21056](https://github.com/emberjs/ember.js/pull/21056) [CLEANUP] Remove '@ember/application's lazy load / onLoad stuff (private API) +- [#21058](https://github.com/emberjs/ember.js/pull/21058) [CLEANUP] Remove template-compiler bootstrap for script tags +- [#21198](https://github.com/emberjs/ember.js/pull/21198) [CLEANUP] Remove `_globalsMode` and `_prepareForGlobalsMode` from `Application` +- [#21079](https://github.com/emberjs/ember.js/pull/21079) [CLEANUP] Remove some IE11 support (Symbols) +- [#21204](https://github.com/emberjs/ember.js/pull/21204) [CLEANUP] Remove old browser workarounds +- [#21206](https://github.com/emberjs/ember.js/pull/21206) [CLEANUP] Remove unused exports, variables, imports and dependencies +- [#21257](https://github.com/emberjs/ember.js/pull/21257) [CLEANUP] Remove old testing apis. +- [#21067](https://github.com/emberjs/ember.js/pull/21067) [BUGFIX] Remove @ember/runloop from initializer test blueprints +- [#21076](https://github.com/emberjs/ember.js/pull/21076) [BUGFIX] Support default globals for strict mode with the runtime compiler per [RFC #1070](https://rfcs.emberjs.com/id/1070-default-globals-for-strict-mode/). +- [#21098](https://github.com/emberjs/ember.js/pull/21098) [BUGFIX] Add support for `this` in explicit scope for the runtime template compiler. +- [#21107](https://github.com/emberjs/ember.js/pull/21107) [BUGFIX] Fix LinkTo inside inline SVG reloads application +- [#21108](https://github.com/emberjs/ember.js/pull/21108) [BUGFIX] Fix unhelpful error message when the function for on modifier was forgotten as param. +- [#21109](https://github.com/emberjs/ember.js/pull/21109) [BUGFIX] Fix missing value attribute on radio/checkbox inputs bound to empty string +- [#21122](https://github.com/emberjs/ember.js/pull/21122) [BUGFIX] Fix tracked collections delete() returning true for non-existent entries +- [#21124](https://github.com/emberjs/ember.js/pull/21124) [BUGFIX] Fix {{#each}} runtime crash when array contains null/undefined items with key +- [#21125](https://github.com/emberjs/ember.js/pull/21125) [BUGFIX] Fix crash when accessing negative index of helper positional args #20912 +- [#21128](https://github.com/emberjs/ember.js/pull/21128) [BUGFIX] Fix trackedMap and trackedWeakMap reactivity for existing keys +- [#21139](https://github.com/emberjs/ember.js/pull/21139) [BUGFIX] Port BrandedArray fix for Array-as-parent bug in destroyables +- [#21168](https://github.com/emberjs/ember.js/pull/21168) [BUGFIX] Fix EmberArray.reduce to match native behavior +- [#21189](https://github.com/emberjs/ember.js/pull/21189) [BUGFIX] Clear stale metadata references after destruction to allow GC +- [#21202](https://github.com/emberjs/ember.js/pull/21202) [BUGFIX] Fix ``'s `@current-when` argument with nested routes containing dynamic segments +- [#21211](https://github.com/emberjs/ember.js/pull/21211) Pull router_js into the Ember monorepo +- [#21069](https://github.com/emberjs/ember.js/pull/21069) Internalize @handlebars/parser +- [#21129](https://github.com/emberjs/ember.js/pull/21129) Add prod build via package.json#exports +- [#21141](https://github.com/emberjs/ember.js/pull/21141) Run smoke-tests with and without deprecations removed +- [#21147](https://github.com/emberjs/ember.js/pull/21147) Migrate node tests to scenarios +- [#21169](https://github.com/emberjs/ember.js/pull/21169) Migrate smoke tests to use ESM Ember -- ES'Mber +- [#21173](https://github.com/emberjs/ember.js/pull/21173) Update actions + lock down to shas +- [#21185](https://github.com/emberjs/ember.js/pull/21185) Use zizmor to lint actions & workflows +- [#21188](https://github.com/emberjs/ember.js/pull/21188) Prepare @glimmer/syntax publishing again and add smoke tests for prettier's use of it +- [#21234](https://github.com/emberjs/ember.js/pull/21234) Refactor tracked collections to use Proxy-based approach + +## v6.12.0 (March 31, 2026) -- [#21144](https://github.com/emberjs/ember.js/pull/21144) [BUGFIX] Fix crash *during* destroy in fastboot - -## v6.12.0-beta.1 (February 17, 2026) - [#20908](https://github.com/emberjs/ember.js/pull/20908) / [#21020](https://github.com/emberjs/ember.js/pull/21020) Merge [glimmerjs/glimmer-vm](https://github.com/glimmerjs/glimmer-vm) into the `emberjs/ember.js` monorepo. - - All `@glimmer/*` packages that were formerly dependencies of `ember-source` are now included in the monorepo. This enables us to more easily iterate + - All `@glimmer/*` packages that were formerly dependencies of `ember-source` are now included in the monorepo. This enables us to more easily iterate on the Glimmer VM and related packages, avoid an integration step with `ember.js` and to more easily share code between them and `ember-source`. - Only a few of the packages from the `glimmer-vm` repo will continue to be published as separate packages, for example, `@glimmer/syntax` will be published. - The `glimmer-vm` repo has been archived and relevant issues have been moved to the `emberjs/ember.js` repo. If you have an issue that was not moved, please reopen it on ember.js, after a search. @@ -20,6 +53,17 @@ - [#21046](https://github.com/emberjs/ember.js/pull/21046) Add benchmark infrastructure - [#21090](https://github.com/emberjs/ember.js/pull/21090) Swap nightly ts test of ts-nightly with ts-latest for better signal-to-noise +## v6.8.4 (March 27, 2026) + +- [#20574](https://github.com/emberjs/ember.js/pull/20574) [BUGFIX] Update ApplicationInstance#visit to use `followRedirects()` to fix `visit()` throws `TransitionAborted` error +- [#21144](https://github.com/emberjs/ember.js/pull/21144) [BUGFIX] Fix crash *during* destroy in fastboot + +## v6.11.1 (March 27, 2026) + +- [#20574](https://github.com/emberjs/ember.js/pull/20574) [BUGFIX] Update ApplicationInstance#visit to use `followRedirects()` to fix `visit()` throws `TransitionAborted` error +- [#21144](https://github.com/emberjs/ember.js/pull/21144) [BUGFIX] Fix crash *during* destroy in fastboot +- [#21244](https://github.com/emberjs/ember.js/pull/21244) [BUGFIX] Fix implicit-modules naming to fix use of `use-ember-modules` with a classic build + ## v6.11.0 (February 17, 2026) - [#21024](https://github.com/emberjs/ember.js/pull/21024) [Bugfix] Add @ember/reactive into the AMD bundles diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000000..07fcf942e88 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,298 @@ +# CLAUDE.md + +This file provides guidance to Claude Code when working with the ember.js repository. + +## Build System + +There are **two separate build pipelines**. Getting them confused wastes significant time. + +### Library Build (Rollup) + +```bash +pnpm build # runs rollup --config + types +``` + +- Builds `ember-source` and other publishable packages +- Output goes to `dist/` but this is the **library** output, not the test suite +- Required before running **smoke tests** (they link to the built packages) +- **Expected time: ~20s** + +### Test Build (Vite) + +```bash +npx vite build --mode development --minify false +``` + +- Builds the **test suite** into `dist/` (overwrites/augments library output) +- `pnpm test` runs against whatever is in `dist/` — it does NOT rebuild anything +- If you change test files or runtime source, you MUST run the vite build before `pnpm test` +- Config is in `vite.config.mjs` — note `enableLocalDebug: true` (LOCAL_DEBUG=true in tests) +- **Expected time: ~30s** + +### The critical workflow for testing source changes: + +```bash +npx vite build --mode development --minify false && pnpm test +``` + +Or use the combined command: + +```bash +pnpm test:wip # vite build + testem ci +``` + +## Running Tests + +**IMPORTANT: Always set timeouts on test commands. Never use the default 2-minute timeout.** + +### Main test suite (browser, Chrome via Testem) + +```bash +pnpm test # runs testem against pre-built dist/ +pnpm test:wip # rebuilds via vite first, then runs testem +``` + +- **Expected time: ~2 minutes. Use timeout 300000 (5 min).** +- Uses `FailureOnlyReporter` — only failing tests appear in output +- 8700+ tests; if the count doesn't change after adding a test, the build is stale +- To verify a test runs: add a deliberate `assert.strictEqual(1, 2, 'canary')` failure +- To grep results: `pnpm test 2>&1 | grep -i "keyword"` +- `pnpm test` does NOT accept `--filter`. There is no way to run a subset from CLI. + +### Smoke tests (published build simulation) + +```bash +pnpm build # rebuild library first (rollup) +cd smoke-tests/scenarios +pnpm test # builds real Ember apps and runs their test suites +``` + +- **Expected time: ~2-3 minutes total. Use timeout 600000 (10 min).** +- Creates actual Ember applications using `scenario-tester` +- Links to workspace ember-source (the built output from `pnpm build`) +- **LOCAL_DEBUG=false, DEBUG=true** — matches real user dev environments +- Tests are defined inline in `basic-test.ts` via `project.mergeFiles()` +- Only the `embroiderVite` scenario is relevant for current work (v1 has pre-existing failures) +- **To skip v1 failures**: comment out `basicTest(v1AppScenarios, 'ember-test-app');` in `smoke-tests/scenarios/basic-test.ts` before running (don't commit this change) + +### Node tests + +```bash +pnpm test:node # QUnit tests in tests/node/ +``` + +- **Expected time: ~30s. Use timeout 120000 (2 min).** +- Currently has pre-existing failures on main (ember 7.0 deprecation removals) + +### Linting + +```bash +npx prettier --check . # check formatting +npx prettier --write . # fix formatting +pnpm lint # eslint (smoke-tests/ is excluded from eslint config) +``` + +- **Expected time: ~10s each. Use timeout 60000 (1 min).** + +### Expected times summary + +| Command | Expected | Timeout to use | Notes | +| ---------------- | -------- | -------------- | ----------------------------- | +| `pnpm build` | ~20s | 120000 | Library only, not tests | +| `vite build` | ~30s | 120000 | Test suite build | +| `pnpm test` | ~2 min | 300000 | Does NOT rebuild | +| `pnpm test:wip` | ~2.5 min | 300000 | Rebuilds + runs | +| smoke tests | ~2-3 min | 600000 | Needs `pnpm build` first | +| `pnpm test:node` | ~30s | 120000 | Pre-existing failures on main | +| `pnpm lint` | ~10s | 60000 | | +| `prettier` | ~10s | 60000 | | + +**If any command takes more than 2x the expected time, something is wrong. Stop and investigate — do not retry in a loop.** + +## Debug Flags + +Understanding these flags is critical for writing correct validation code: + +| Flag | Where it's true | Guard mechanism | +| ------------- | ------------------------------------- | ---------------------------- | +| `LOCAL_DEBUG` | Inside this repo's test suite only | `@glimmer/local-debug-flags` | +| `DEBUG` | User app dev mode + this repo's tests | `@glimmer/env` | + +- `check()` from `@glimmer/debug` — **no-op when LOCAL_DEBUG=false**. Returns value as-is. +- `localAssert()` from `@glimmer/debug-util` — **no-op when LOCAL_DEBUG=false**. +- `if (DEBUG) { ... }` — runs in user dev mode. Use this for user-facing validation. + +### Common bug pattern + +Using `check()` or `localAssert()` for user-facing validation means errors are only caught inside this repo's tests, not in user apps. Use `if (DEBUG)` instead: + +```typescript +// BAD: stripped in published builds, users get unhelpful TypeError +localAssert(typeof callback === 'function', 'Must pass a function'); + +// GOOD: works in user dev mode +if (DEBUG && typeof callback !== 'function') { + throw new Error('Must pass a function'); +} +``` + +## Test File Discovery + +Tests are discovered via `import.meta.glob` in `index.html`: + +```javascript +// packages/@ember/-internals/*/tests/**/*.{js,ts,gjs,gts} +// packages/*/*/tests/**/*.{js,ts,gjs,gts} +// packages/*/tests/**/*.{js,ts,gjs,gts} +``` + +Test files matching these globs are auto-discovered — no explicit imports needed. + +## Smoke Test Patterns + +### Testing error messages (setupOnerror) + +For errors thrown during Ember's render loop, use `setupOnerror`/`resetOnerror`: + +```javascript +import { render, setupOnerror, resetOnerror } from '@ember/test-helpers'; + +hooks.afterEach(function () { + resetOnerror(); +}); + +test('throws helpful error', async function (assert) { + assert.expect(1); + setupOnerror((error) => { + assert.true(/expected pattern/.test(error.message)); + }); + await render(); +}); +``` + +For errors that throw synchronously from render (not caught by Ember's error handler), use try/catch: + +```javascript +test('throws helpful error', async function (assert) { + assert.expect(1); + try { + await render(); + assert.true(false, 'Expected render to throw'); + } catch (error) { + assert.true(/expected pattern/.test(error.message)); + } +}); +``` + +### Available imports in smoke test .gjs files + +```javascript +import { fn } from '@ember/helper'; +import { on } from '@ember/modifier'; +import { render, click, setupOnerror, resetOnerror } from '@ember/test-helpers'; +import { setupRenderingTest } from 'ember-qunit'; +``` + +## Performance investigation: @glimmer/syntax + +### Goal + +Investigate whether `@glimmer/syntax`'s `preprocess()` function can be made faster for the IDE hot-path use case. This parser is the #1 bottleneck in Glint's per-keystroke pipeline, taking **2.3ms (56%)** of the ~4ms total `rewriteModule` cost. Profiled in a real Ember project (proapi-webapp) via instrumented Glint language server. + +### Background + +Glint is a TypeScript language server for Ember/Glimmer templates. On every keystroke in a `.gts` file, Glint calls `@glimmer/syntax`'s `preprocess()` to parse the Handlebars template, then generates TypeScript from the resulting AST. The 2.3ms includes both the parse and Glint's codegen — we need to split them. + +The `@glimmer/syntax` package lives at `packages/@glimmer/syntax/` in this repo. +Glint uses `@glimmer/syntax@^0.95.0`. + +### Investigation steps + +#### 1. Benchmark the parser in isolation + +Create a benchmark script (e.g., `packages/@glimmer/syntax/bench.mjs`): + +```js +import { preprocess } from './lib/index.js'; // adjust path as needed + +const small = `
{{this.title}}
`; + +const medium = ` +
+

{{this.title}}

+ {{#each this.items as |item index|}} +
+ {{item.name}} + +
+ {{/each}} + {{#if this.showFooter}} +
{{this.footerText}}
+ {{/if}} +
`; + +const large = medium.repeat(10); + +for (const [name, tpl] of [ + ['small', small], + ['medium', medium], + ['large', large], +]) { + const start = performance.now(); + const N = 1000; + for (let i = 0; i < N; i++) preprocess(tpl); + const elapsed = performance.now() - start; + console.log(`${name}: ${(elapsed / N).toFixed(3)}ms per parse (${tpl.length} chars)`); +} +``` + +#### 2. Profile what preprocess() does internally + +Read the source in `packages/@glimmer/syntax/lib/` to understand: + +- What parser is used? (hand-written? PEG?) +- What phases: tokenize → parse → AST transform? +- Does it do work an IDE consumer doesn't need? (source printing, validation, normalization) +- Add `performance.now()` timing between phases to get a breakdown + +#### 3. Check preprocess() options + +Look at the function signature for options to: + +- Skip AST plugins or transforms +- Use a lighter/partial mode +- Return a simpler AST + +#### 4. Look for low-hanging fruit + +- Unnecessary string allocations during tokenization +- Regex-heavy parsing that could use indexOf/charCodeAt +- AST node fields that Glint never reads +- Normalization passes that don't affect structure + +#### 5. Check if incremental parsing is feasible + +If only `{{item.name}}` changed to `{{item.label}}`, could we reparse just that node? Is there anything in the parser architecture that supports this? + +#### 6. Compare versions + +Check git log for perf-related changes. Run benchmark on the version Glint uses vs latest. + +### What Glint needs from the AST + +- All node types (ElementNode, MustacheStatement, BlockStatement, etc.) +- Source locations (loc.start, loc.end) for every node +- Full tree structure +- PathExpression head/tail for scope resolution + +Glint does NOT need: + +- Pretty-printing / source generation +- AST transforms (Glint does its own) + +### Deliverables + +1. Per-parse benchmark: small/medium/large templates +2. Breakdown of time inside `preprocess()` (tokenize vs parse vs post-process) +3. Concrete optimization opportunities with estimated impact +4. If quick wins exist, implement them and show before/after numbers diff --git a/bench.mjs b/bench.mjs new file mode 100644 index 00000000000..6c298ab7c99 --- /dev/null +++ b/bench.mjs @@ -0,0 +1,223 @@ +/** + * 3-way benchmark: main (Jison) vs v2-parser vs unified-1pass + * + * Two use cases: + * IDE case — parse-only (preprocess / unifiedPreprocess), the Glint hot-path + * Build case — full precompile() pipeline → wire format + * + * Run: node bench.mjs + */ + +const MAIN_COMPILER = '/tmp/ember-main/dist/packages/ember-template-compiler/index.js'; +const MAIN_SYNTAX = '/tmp/ember-main/packages/@glimmer/syntax/dist/es/index.js'; +const HERE_COMPILER = `${new URL('.', import.meta.url).pathname}dist/dev/packages/ember-template-compiler/index.js`; +const HERE_SYNTAX = `${new URL('.', import.meta.url).pathname}packages/@glimmer/syntax/dist/es/index.js`; + +const { precompile: compileMain } = await import(MAIN_COMPILER); +const { precompile: compileV2 } = await import(HERE_COMPILER); +const { preprocess: parseMain } = await import(MAIN_SYNTAX); +const { preprocess: parseV2, unifiedPreprocess: parseUni } = await import(HERE_SYNTAX); + +// ── Templates ────────────────────────────────────────────────────────────────── + +const small = `
{{this.title}}
`; + +const medium = ` +
+

{{this.title}}

+ {{#each this.items as |item index|}} +
+ {{item.name}} + +
+ {{/each}} + {{#if this.showFooter}} +
{{this.footerText}}
+ {{/if}} +
`; + +const realWorld = ` +
+
+ {{this.username}} +

{{this.displayName}}

+

{{this.bio}}

+ {{#if this.isOwnProfile}} + + {{/if}} +
+ +
+ {{#if (eq this.activeTab "posts")}} + {{#each this.posts as |post|}} +
+

{{post.title}}

{{post.excerpt}}

+
{{post.views}} views
+
+ {{else}} +

No posts yet.

+ {{/each}} + {{else if (eq this.activeTab "followers")}} + {{#each this.followers as |follower|}} +
+ {{follower.name}} + {{follower.name}} + +
+ {{/each}} + {{/if}} +
+
`; + +const large = medium.repeat(10); + +const templates = [ + ['small', small, 5000], + ['medium', medium, 2000], + ['real-world', realWorld, 1000], + ['large (10x)', large, 300], +]; + +// ── Helpers ──────────────────────────────────────────────────────────────────── + +function bench(fn, tpl, N) { + for (let i = 0; i < Math.min(100, N); i++) fn(tpl); + const t = performance.now(); + for (let i = 0; i < N; i++) fn(tpl); + return (performance.now() - t) / N; +} + +function pct(part, total) { + return ((part / total) * 100).toFixed(0) + '%'; +} + +// ── IDE case: parse-only ─────────────────────────────────────────────────────── + +console.log('━'.repeat(72)); +console.log('IDE CASE — parse-only: preprocess() / unifiedPreprocess() (ms/call, warmed JIT)'); +console.log('━'.repeat(72)); +console.log( + 'template'.padEnd(14) + + 'chars'.padStart(7) + + ' Jison'.padStart(10) + + ' v2-parser'.padStart(12) + + ' unified-1pass'.padStart(16) +); +console.log('─'.repeat(59)); + +const parseResults = {}; +for (const [name, tpl, N] of templates) { + const mMs = bench(parseMain, tpl, N); + const v2Ms = bench(parseV2, tpl, N); + const uMs = bench(parseUni, tpl, N); + parseResults[name] = { mMs, v2Ms, uMs, chars: tpl.length }; + console.log( + name.padEnd(14) + + String(tpl.length).padStart(7) + + mMs.toFixed(4).padStart(10) + + 'ms' + + v2Ms.toFixed(4).padStart(10) + + 'ms' + + uMs.toFixed(4).padStart(14) + + 'ms' + ); +} + +// ── Build case: full precompile() pipeline ───────────────────────────────────── +// unified column = unified_parse + (precompile_v2 - preprocess_v2) +// (compile step is identical code in all parsers) + +console.log('\n' + '━'.repeat(72)); +console.log('BUILD CASE — full precompile() → wire format (ms/call, warmed JIT)'); +console.log(' unified-1pass column = unified_parse + (precompile_v2 − preprocess_v2)'); +console.log('━'.repeat(72)); +console.log( + 'template'.padEnd(14) + + 'chars'.padStart(7) + + ' Jison'.padStart(10) + + ' v2-parser'.padStart(12) + + ' unified-1pass'.padStart(16) +); +console.log('─'.repeat(59)); + +const fullResults = {}; +for (const [name, tpl, N] of templates) { + const { v2Ms, uMs } = parseResults[name]; + const fullMMs = bench(compileMain, tpl, N); + const fullV2Ms = bench(compileV2, tpl, N); + const compileMs = fullV2Ms - v2Ms; // compile step (identical across parsers) + const fullUMs = uMs + compileMs; // projected unified full pipeline + fullResults[name] = { fullMMs, fullV2Ms, fullUMs }; + console.log( + name.padEnd(14) + + String(tpl.length).padStart(7) + + fullMMs.toFixed(4).padStart(10) + + 'ms' + + fullV2Ms.toFixed(4).padStart(10) + + 'ms' + + fullUMs.toFixed(4).padStart(14) + + 'ms' + ); +} + +// ── Parse vs compile split (medium) ─────────────────────────────────────────── + +console.log('\n' + '━'.repeat(72)); +console.log('PARSE vs COMPILE SPLIT (medium template)'); +console.log('━'.repeat(72)); + +const N_SPLIT = 3000; +const sMainParse = bench(parseMain, medium, N_SPLIT); +const sV2Parse = bench(parseV2, medium, N_SPLIT); +const sUniParse = bench(parseUni, medium, N_SPLIT); +const sMainFull = bench(compileMain, medium, N_SPLIT); +const sV2Full = bench(compileV2, medium, N_SPLIT); +const sCompile = sV2Full - sV2Parse; // shared compile step +const sUniFull = sUniParse + sCompile; + +console.log('\n' + ' Jison v2-parser unified-1pass'); +console.log('─'.repeat(70)); +console.log( + 'preprocess() only ' + + `${sMainParse.toFixed(3)}ms (${pct(sMainParse, sMainFull)})`.padEnd(22) + + `${sV2Parse.toFixed(3)}ms (${pct(sV2Parse, sV2Full)})`.padEnd(22) + + `${sUniParse.toFixed(3)}ms (${pct(sUniParse, sUniFull)})` +); +console.log( + 'compile only ' + + `${(sMainFull - sMainParse).toFixed(3)}ms (${pct(sMainFull - sMainParse, sMainFull)})`.padEnd( + 22 + ) + + `${sCompile.toFixed(3)}ms (${pct(sCompile, sV2Full)})`.padEnd(22) + + `${sCompile.toFixed(3)}ms (${pct(sCompile, sUniFull)})` +); +console.log( + 'total ' + + `${sMainFull.toFixed(3)}ms`.padEnd(22) + + `${sV2Full.toFixed(3)}ms`.padEnd(22) + + `${sUniFull.toFixed(3)}ms` +); + +// ── 500-template build projection ───────────────────────────────────────────── + +console.log('\n' + '━'.repeat(72)); +console.log('500-TEMPLATE BUILD PROJECTION (real-world template × 500)'); +console.log('━'.repeat(72)); + +const { fullMMs: rwM, fullV2Ms: rwV2, fullUMs: rwUni } = fullResults['real-world']; +const scale = 500; +console.log(`\n Jison: ${(rwM * scale).toFixed(0)}ms (${rwM.toFixed(3)}ms × ${scale})`); +console.log( + ` v2-parser: ${(rwV2 * scale).toFixed(0)}ms (${rwV2.toFixed(3)}ms × ${scale}) — ${(rwM / rwV2).toFixed(2)}x vs Jison` +); +console.log( + ` unified-1pass: ${(rwUni * scale).toFixed(0)}ms (${rwUni.toFixed(3)}ms × ${scale}) — ${(rwM / rwUni).toFixed(2)}x vs Jison, ${(rwV2 / rwUni).toFixed(2)}x vs v2` +); diff --git a/bin/benchmark.mjs b/bin/benchmark.mjs index c7e734c71d5..7affa4ac0ac 100644 --- a/bin/benchmark.mjs +++ b/bin/benchmark.mjs @@ -17,7 +17,6 @@ Options: --force delete cached directories before running --reuse reuse existing apps and tarballs, if available (by default only the control app/tarball is reused) --no-headless run Chrome without headless mode (opens visible browser windows) - On macOS, benchmarks will run sequentially (one browser at a time) Notes: - This script runs \`pnpm install\` and \`node ./bin/build-for-publishing.js\` in both repos. diff --git a/bin/benchmark/run.mjs b/bin/benchmark/run.mjs index 04c7c8b929d..aadcea3197a 100644 --- a/bin/benchmark/run.mjs +++ b/bin/benchmark/run.mjs @@ -6,7 +6,7 @@ import fs from 'fs-extra'; import { getOrBuildControlTarball } from './control.mjs'; import { buildExperimentTarball } from './experiment.mjs'; -import { run, prepareApp, sleep, startVitePreview, lsof } from './utils.mjs'; +import { run, prepareApp, startVitePreview, waitForServer } from './utils.mjs'; const { ensureDir, remove } = fs; @@ -112,12 +112,19 @@ export async function runBenchmark({ force = false, reuse = false, headless = tr ]); // These will error if the parts are occupied (--strict-port) - startVitePreview({ appDir: CONTROL_DIRS.app, port: DEFAULT_CONTROL_PORT }); - startVitePreview({ + const controlServer = startVitePreview({ appDir: CONTROL_DIRS.app, port: DEFAULT_CONTROL_PORT }); + const experimentServer = startVitePreview({ appDir: EXPERIMENT_DIRS.app, port: DEFAULT_EXPERIMENT_PORT, }); + controlServer.catch((err) => { + console.error('Control server exited unexpectedly:', err.message); + }); + experimentServer.catch((err) => { + console.error('Experiment server exited unexpectedly:', err.message); + }); + try { await bootAndRun({ headless }); } finally { @@ -132,20 +139,12 @@ async function bootAndRun({ headless = true } = {}) { const experimentUrl = `http://127.0.0.1:${DEFAULT_EXPERIMENT_PORT}`; const markersString = buildMarkersString(DEFAULT_MARKERS); - // give servers a moment to start - await sleep(5000); - - /** - * We need to make sure both servers are running before starting the benchmark. - */ - let controlLsof = await lsof(DEFAULT_CONTROL_PORT); - let experimentLsof = await lsof(DEFAULT_EXPERIMENT_PORT); - - if (!controlLsof || !experimentLsof) { - throw new Error( - `One of the servers failed to start. Control server lsof:\n${controlLsof}\n\nExperiment server lsof:\n${experimentLsof}` - ); - } + console.log('\n\tWaiting for servers to be ready...'); + await Promise.all([ + waitForServer(controlUrl, { timeout: 30_000 }), + waitForServer(experimentUrl, { timeout: 30_000 }), + ]); + console.log('\tBoth servers are ready.\n'); const tracerbenchBin = join(REPO_ROOT, 'node_modules/tracerbench/bin/run'); diff --git a/bin/benchmark/utils.mjs b/bin/benchmark/utils.mjs index 7baa6e14b51..7a39618738f 100644 --- a/bin/benchmark/utils.mjs +++ b/bin/benchmark/utils.mjs @@ -5,7 +5,7 @@ import { fileURLToPath } from 'node:url'; import { basename, join } from 'node:path'; import { styleText } from 'node:util'; -import execa from 'execa'; +import { execa } from 'execa'; import fs from 'fs-extra'; import { existsSync } from 'node:fs'; @@ -23,8 +23,37 @@ export function sleep(ms) { return new Promise((resolve) => setTimeout(resolve, ms)); } -export async function lsof(port) { - return execSync(`lsof -i :${port} -P -n`).toString; +export function lsof(port) { + try { + return execSync(`lsof -i :${port} -P -n`).toString(); + } catch { + return null; + } +} + +/** + * Wait for a server to respond to HTTP requests. + * Polls with fetch until the server returns a response (any status), + * retrying on connection errors. + * + * @param {string} url - The URL to poll + * @param {object} [options] + * @param {number} [options.timeout=30000] - Max time to wait in ms + * @param {number} [options.interval=500] - Time between retries in ms + */ +export async function waitForServer(url, { timeout = 30_000, interval = 500 } = {}) { + const deadline = Date.now() + timeout; + + while (Date.now() < deadline) { + try { + await fetch(url); + return; + } catch { + await sleep(interval); + } + } + + throw new Error(`Server at ${url} did not respond within ${timeout}ms`); } export async function buildEmberSource(cwd) { diff --git a/bin/build-for-publishing.js b/bin/build-for-publishing.js index 00c79202b53..46c77df669a 100755 --- a/bin/build-for-publishing.js +++ b/bin/build-for-publishing.js @@ -2,15 +2,13 @@ const fs = require('fs'); const path = require('path'); -const execa = require('execa'); const buildInfo = require('../broccoli/build-info').buildInfo(); -function exec(command, args) { +async function exec(command, args) { + const { execa } = await import('execa'); // eslint-disable-next-line console.log(`\n\tRunning: \`${command} ${args.join(' ')}\``); - let stream = execa(command, args); - stream.stdout.pipe(process.stdout); - return stream; + return execa(command, args, { stdout: 'inherit', stderr: 'inherit' }); } /* diff --git a/bin/changelog.js b/bin/changelog.js index 3ae7deebb93..a9b6a903bb3 100755 --- a/bin/changelog.js +++ b/bin/changelog.js @@ -14,47 +14,69 @@ * bin/changelog.js */ -const RSVP = require('rsvp'); -const GitHubApi = require('github'); +const { Octokit } = require('@octokit/rest'); const execSync = require('child_process').execSync; -const github = new GitHubApi({ version: '3.0.0' }); -if (process.env.GITHUB_TOKEN) { - github.authenticate({ - type: 'token', - token: process.env.GITHUB_TOKEN, - }); -} -const compareCommits = RSVP.denodeify(github.repos.compareCommits); -const getPullRequest = RSVP.denodeify(github.pullRequests.get); +const octokit = new Octokit({ + auth: process.env.GITHUB_TOKEN, +}); + +const DEBUG = process.env.DEBUG === 'true'; +const debug = (...args) => DEBUG && console.error('[DEBUG]', ...args); const currentVersion = process.env.PRIOR_VERSION; -const head = process.env.HEAD || execSync('git rev-parse HEAD', { encoding: 'UTF-8' }); +const head = (process.env.HEAD || execSync('git rev-parse HEAD', { encoding: 'UTF-8' })).trim(); + +debug('Current version:', currentVersion); +debug('Head:', head); generateChangelog() .then(console.log) .catch((err) => console.error(err)); async function fetchAllChanges() { - let result = await compareCommits({ - user: 'emberjs', + debug('Fetching comparison:', `${currentVersion}...${head}`); + const comparison = await octokit.repos.compareCommitsWithBasehead({ + owner: 'emberjs', repo: 'ember.js', - base: currentVersion, - head, + basehead: `${currentVersion}...${head}`, + per_page: 100, }); - let data = result.commits; - while (github.hasNextPage(result)) { - result = await github.getNextPage(result); - data.concat(result.commits); + + let commits = comparison.data.commits; + const totalCommits = comparison.data.total_commits; + debug('Total commits:', totalCommits, 'Fetched:', commits.length); + + // If there are more commits than returned, fetch them page by page + if (totalCommits > commits.length) { + let page = 2; + while (commits.length < totalCommits) { + debug('Fetching page:', page); + const nextPage = await octokit.repos.compareCommitsWithBasehead({ + owner: 'emberjs', + repo: 'ember.js', + basehead: `${currentVersion}...${head}`, + per_page: 100, + page: page, + }); + commits = commits.concat(nextPage.data.commits); + debug('Now have', commits.length, 'commits'); + page++; + + // Safety check to prevent infinite loops + if (nextPage.data.commits.length === 0) break; + } } - return data; + return commits; } async function generateChangelog() { let commits = await fetchAllChanges(); + debug('Processing', commits.length, 'commits'); let contributions = commits.filter(excludeDependabot).filter(isMergeOrCherryPick); + debug('Found', contributions.length, 'contributions after filtering'); let changes = await Promise.all( contributions.map(async function (commitInfo) { @@ -83,10 +105,12 @@ async function generateChangelog() { result.title = message.split('\n\n')[0]; } + debug('Processed commit:', result.number || result.sha.slice(0, 8), '-', result.title); return result; }) ); + debug('Sorting and deduplicating changes'); return changes .sort(comparePrNumber) .filter(uniqueByPrNumber) @@ -112,6 +136,7 @@ async function getCommitMessage(commitInfo) { let matches; if (message.indexOf('cherry picked from commit') > -1) { + debug('Processing cherry-pick commit:', commitInfo.sha.slice(0, 8)); let cherryPickRegex = /cherry picked from commit ([a-z0-9]+)/; let originalCommit = cherryPickRegex.exec(message)[1]; @@ -125,7 +150,9 @@ async function getCommitMessage(commitInfo) { '..origin/main --first-parent | cat -n) | sort -k2 | uniq -f1 -d | sort -n | tail -1 | cut -f2) && git show --format="%s\n\n%b" $commit', { encoding: 'utf8' } ); + debug('Found original merge commit for cherry-pick'); } catch { + debug('Could not find original merge commit for cherry-pick'); // ignored } } @@ -139,10 +166,11 @@ async function getCommitMessage(commitInfo) { let lines = message.split(/\n\n/); if (!lines[1]) { - let pullRequest = await getPullRequest({ - user: 'emberjs', + debug('Fetching PR title for #' + prNumber); + let { data: pullRequest } = await octokit.pulls.get({ + owner: 'emberjs', repo: 'ember.js', - number: prNumber, + pull_number: prNumber, }); return `Merge pull request #${prNumber}\n\n${pullRequest.title}`; } diff --git a/bin/run-browserstack-tests.js b/bin/run-browserstack-tests.js index 29a51c37bcd..eee86111b29 100755 --- a/bin/run-browserstack-tests.js +++ b/bin/run-browserstack-tests.js @@ -1,16 +1,12 @@ /* eslint-disable no-console */ -const execa = require('execa'); const chalk = require('chalk'); -function run(command, args = []) { +async function run(command, args = []) { + const { execa } = await import('execa'); console.log(chalk.dim('$ ' + command + ' ' + args.join(' '))); - let p = execa(command, args); - p.stdout.pipe(process.stdout); - p.stderr.pipe(process.stderr); - - return p; + return execa(command, args, { stdout: 'inherit', stderr: 'inherit' }); } (async function () { diff --git a/broccoli/amd-compat-entrypoints/ember-template-compiler.js b/broccoli/amd-compat-entrypoints/ember-template-compiler.js deleted file mode 100644 index 06f1a57d9aa..00000000000 --- a/broccoli/amd-compat-entrypoints/ember-template-compiler.js +++ /dev/null @@ -1,206 +0,0 @@ -/* eslint-disable */ - -// This file was derived from the output of the classic broccoli-based build of -// ember-template-compiler.js. It's intended to convey exactly how the authored ES modules -// get mapped into backward-compatible AMD defines. - -import d from 'amd-compat-entrypoint-definition'; - -import * as emberinternalsBrowserEnvironmentIndex from '@ember/-internals/browser-environment/index'; -d('@ember/-internals/browser-environment/index', emberinternalsBrowserEnvironmentIndex); - -import * as emberinternalsEnvironmentIndex from '@ember/-internals/environment/index'; -d('@ember/-internals/environment/index', emberinternalsEnvironmentIndex); - -import * as emberinternalsUtilsIndex from '@ember/-internals/utils/index'; -d('@ember/-internals/utils/index', emberinternalsUtilsIndex); - -import * as emberCanaryFeaturesIndex from '@ember/canary-features/index'; -d('@ember/canary-features/index', emberCanaryFeaturesIndex); - -/* - -The classic build included these modules but not their dependencies, so they -never worked. Keeping this comment to document why the list of modules differs in -this way. - -import * as emberDebugContainerDebugAdapter from '@ember/debug/container-debug-adapter'; -d('@ember/debug/container-debug-adapter', emberDebugContainerDebugAdapter); - -import * as emberDebugDataAdapter from '@ember/debug/data-adapter'; -d('@ember/debug/data-adapter', emberDebugDataAdapter); - -*/ - -import * as emberDebugIndex from '@ember/debug/index'; -d('@ember/debug/index', emberDebugIndex); - -import * as emberDebugLibCaptureRenderTree from '@ember/debug/lib/capture-render-tree'; -d('@ember/debug/lib/capture-render-tree', emberDebugLibCaptureRenderTree); - -import * as emberDebugLibDeprecate from '@ember/debug/lib/deprecate'; -d('@ember/debug/lib/deprecate', emberDebugLibDeprecate); - -import * as emberDebugLibHandlers from '@ember/debug/lib/handlers'; -d('@ember/debug/lib/handlers', emberDebugLibHandlers); - -import * as emberDebugLibInspect from '@ember/debug/lib/inspect'; -d('@ember/debug/lib/inspect', emberDebugLibInspect); - -import * as emberDebugLibTesting from '@ember/debug/lib/testing'; -d('@ember/debug/lib/testing', emberDebugLibTesting); - -import * as emberDebugLibWarn from '@ember/debug/lib/warn'; -d('@ember/debug/lib/warn', emberDebugLibWarn); - -import * as emberDeprecatedFeaturesIndex from '@ember/deprecated-features/index'; -d('@ember/deprecated-features/index', emberDeprecatedFeaturesIndex); - -import * as glimmerCompiler from '@glimmer/compiler'; -d('@glimmer/compiler', glimmerCompiler); - -import * as glimmerEnv from '@glimmer/env'; -d('@glimmer/env', glimmerEnv); - -import * as glimmerSyntax from '@glimmer/syntax'; -d('@glimmer/syntax', glimmerSyntax); - -import * as glimmerUtil from '@glimmer/util'; -d('@glimmer/util', glimmerUtil); - -import * as glimmerVm from '@glimmer/vm'; -d('@glimmer/vm', glimmerVm); - -import * as glimmerWireFormat from '@glimmer/wire-format'; -d('@glimmer/wire-format', glimmerWireFormat); - -import * as handlebarsParserIndex from '@handlebars/parser'; -d('@handlebars/parser/index', handlebarsParserIndex); - -import * as emberTemplateCompilerIndex from 'ember-template-compiler/index'; -d('ember-template-compiler/index', emberTemplateCompilerIndex); - -import * as emberTemplateCompilerLibPluginsAssertAgainstAttrs from 'ember-template-compiler/lib/plugins/assert-against-attrs'; -d( - 'ember-template-compiler/lib/plugins/assert-against-attrs', - emberTemplateCompilerLibPluginsAssertAgainstAttrs -); - -import * as emberTemplateCompilerLibPluginsAssertAgainstNamedOutlets from 'ember-template-compiler/lib/plugins/assert-against-named-outlets'; -d( - 'ember-template-compiler/lib/plugins/assert-against-named-outlets', - emberTemplateCompilerLibPluginsAssertAgainstNamedOutlets -); - -import * as emberTemplateCompilerLibPluginsAssertInputHelperWithoutBlock from 'ember-template-compiler/lib/plugins/assert-input-helper-without-block'; -d( - 'ember-template-compiler/lib/plugins/assert-input-helper-without-block', - emberTemplateCompilerLibPluginsAssertInputHelperWithoutBlock -); - -import * as emberTemplateCompilerLibPluginsAssertReservedNamedArguments from 'ember-template-compiler/lib/plugins/assert-reserved-named-arguments'; -d( - 'ember-template-compiler/lib/plugins/assert-reserved-named-arguments', - emberTemplateCompilerLibPluginsAssertReservedNamedArguments -); - -import * as emberTemplateCompilerLibPluginsIndex from 'ember-template-compiler/lib/plugins/index'; -d('ember-template-compiler/lib/plugins/index', emberTemplateCompilerLibPluginsIndex); - -import * as emberTemplateCompilerLibPluginsTransformActionSyntax from 'ember-template-compiler/lib/plugins/transform-action-syntax'; -d( - 'ember-template-compiler/lib/plugins/transform-action-syntax', - emberTemplateCompilerLibPluginsTransformActionSyntax -); - -import * as emberTemplateCompilerLibPluginsTransformEachInIntoEach from 'ember-template-compiler/lib/plugins/transform-each-in-into-each'; -d( - 'ember-template-compiler/lib/plugins/transform-each-in-into-each', - emberTemplateCompilerLibPluginsTransformEachInIntoEach -); - -import * as emberTemplateCompilerLibPluginsTransformEachTrackArray from 'ember-template-compiler/lib/plugins/transform-each-track-array'; -d( - 'ember-template-compiler/lib/plugins/transform-each-track-array', - emberTemplateCompilerLibPluginsTransformEachTrackArray -); - -import * as emberTemplateCompilerLibPluginsTransformInElement from 'ember-template-compiler/lib/plugins/transform-in-element'; -d( - 'ember-template-compiler/lib/plugins/transform-in-element', - emberTemplateCompilerLibPluginsTransformInElement -); - -import * as emberTemplateCompilerLibPluginsTransformQuotedBindingsIntoJustBindings from 'ember-template-compiler/lib/plugins/transform-quoted-bindings-into-just-bindings'; -d( - 'ember-template-compiler/lib/plugins/transform-quoted-bindings-into-just-bindings', - emberTemplateCompilerLibPluginsTransformQuotedBindingsIntoJustBindings -); - -import * as emberTemplateCompilerLibPluginsTransformResolutions from 'ember-template-compiler/lib/plugins/transform-resolutions'; -d( - 'ember-template-compiler/lib/plugins/transform-resolutions', - emberTemplateCompilerLibPluginsTransformResolutions -); - -import * as emberTemplateCompilerLibPluginsTransformWrapMountAndOutlet from 'ember-template-compiler/lib/plugins/transform-wrap-mount-and-outlet'; -d( - 'ember-template-compiler/lib/plugins/transform-wrap-mount-and-outlet', - emberTemplateCompilerLibPluginsTransformWrapMountAndOutlet -); - -import * as emberTemplateCompilerLibPluginsUtils from 'ember-template-compiler/lib/plugins/utils'; -d('ember-template-compiler/lib/plugins/utils', emberTemplateCompilerLibPluginsUtils); - -import * as emberTemplateCompilerLibPublicApi from 'ember-template-compiler/lib/public-api'; -d('ember-template-compiler/lib/public-api', emberTemplateCompilerLibPublicApi); - -import * as emberTemplateCompilerLibSystemBootstrap from 'ember-template-compiler/lib/system/bootstrap'; -d('ember-template-compiler/lib/system/bootstrap', emberTemplateCompilerLibSystemBootstrap); - -import * as emberTemplateCompilerLibSystemCalculateLocationDisplay from 'ember-template-compiler/lib/system/calculate-location-display'; -d( - 'ember-template-compiler/lib/system/calculate-location-display', - emberTemplateCompilerLibSystemCalculateLocationDisplay -); - -import * as emberTemplateCompilerLibSystemCompileOptions from 'ember-template-compiler/lib/system/compile-options'; -d( - 'ember-template-compiler/lib/system/compile-options', - emberTemplateCompilerLibSystemCompileOptions -); - -import * as emberTemplateCompilerLibSystemCompile from 'ember-template-compiler/lib/system/compile'; -d('ember-template-compiler/lib/system/compile', emberTemplateCompilerLibSystemCompile); - -import * as emberTemplateCompilerLibSystemDasherizeComponentName from 'ember-template-compiler/lib/system/dasherize-component-name'; -d( - 'ember-template-compiler/lib/system/dasherize-component-name', - emberTemplateCompilerLibSystemDasherizeComponentName -); - -import * as emberTemplateCompilerLibSystemInitializer from 'ember-template-compiler/lib/system/initializer'; -d('ember-template-compiler/lib/system/initializer', emberTemplateCompilerLibSystemInitializer); - -import * as emberTemplateCompilerLibSystemPrecompile from 'ember-template-compiler/lib/system/precompile'; -d('ember-template-compiler/lib/system/precompile', emberTemplateCompilerLibSystemPrecompile); - -import * as emberTemplateCompilerLibTypes from 'ember-template-compiler/lib/types'; -d('ember-template-compiler/lib/types', emberTemplateCompilerLibTypes); - -import * as emberTemplateCompilerMinimal from 'ember-template-compiler/minimal'; -d('ember-template-compiler/minimal', emberTemplateCompilerMinimal); - -import * as emberVersion from 'ember/version'; -d('ember/version', emberVersion); - -import * as simpleHtmlTokenizer from 'simple-html-tokenizer'; -d('simple-html-tokenizer', simpleHtmlTokenizer); - -if (typeof module === 'object' && module.exports) { - module.exports = emberTemplateCompilerIndex; -} - -console.log( - '\n\n--------\n+ Your app is using the legacy ember-template-compiler.js AMD bundle. This will be removed in ember-source 7.0. See https://deprecations.emberjs.com/id/using-amd-bundles for more details.\n--------' -); diff --git a/broccoli/amd-compat-entrypoints/ember-testing.js b/broccoli/amd-compat-entrypoints/ember-testing.js deleted file mode 100644 index 1c3df0cf0bf..00000000000 --- a/broccoli/amd-compat-entrypoints/ember-testing.js +++ /dev/null @@ -1,79 +0,0 @@ -/* eslint-disable */ - -// This file was derived from the output of the classic broccoli-based build of -// ember-testing.js. It's intended to convey exactly how the authored ES modules -// get mapped into backward-compatible AMD defines. - -import d from 'amd-compat-entrypoint-definition'; - -import * as emberTestingIndex from 'ember-testing/index'; -d('ember-testing/index', emberTestingIndex); - -import * as emberTestingLibAdaptersAdapter from 'ember-testing/lib/adapters/adapter'; -d('ember-testing/lib/adapters/adapter', emberTestingLibAdaptersAdapter); - -import * as emberTestingLibAdaptersQunit from 'ember-testing/lib/adapters/qunit'; -d('ember-testing/lib/adapters/qunit', emberTestingLibAdaptersQunit); - -import * as emberTestingLibExtApplication from 'ember-testing/lib/ext/application'; -d('ember-testing/lib/ext/application', emberTestingLibExtApplication); - -import * as emberTestingLibExtRsvp from 'ember-testing/lib/ext/rsvp'; -d('ember-testing/lib/ext/rsvp', emberTestingLibExtRsvp); - -import * as emberTestingLibHelpers from 'ember-testing/lib/helpers'; -d('ember-testing/lib/helpers', emberTestingLibHelpers); - -import * as emberTestingLibHelpersAndThen from 'ember-testing/lib/helpers/and_then'; -d('ember-testing/lib/helpers/and_then', emberTestingLibHelpersAndThen); - -import * as emberTestingLibHelpersCurrentPath from 'ember-testing/lib/helpers/current_path'; -d('ember-testing/lib/helpers/current_path', emberTestingLibHelpersCurrentPath); - -import * as emberTestingLibHelpersCurrentRouteName from 'ember-testing/lib/helpers/current_route_name'; -d('ember-testing/lib/helpers/current_route_name', () => emberTestingLibHelpersCurrentRouteName); - -import * as emberTestingLibHelpersCurrentUrl from 'ember-testing/lib/helpers/current_url'; -d('ember-testing/lib/helpers/current_url', emberTestingLibHelpersCurrentUrl); - -import * as emberTestingLibHelpersPauseTest from 'ember-testing/lib/helpers/pause_test'; -d('ember-testing/lib/helpers/pause_test', emberTestingLibHelpersPauseTest); - -import * as emberTestingLibHelpersVisit from 'ember-testing/lib/helpers/visit'; -d('ember-testing/lib/helpers/visit', emberTestingLibHelpersVisit); - -import * as emberTestingLibHelpersWait from 'ember-testing/lib/helpers/wait'; -d('ember-testing/lib/helpers/wait', emberTestingLibHelpersWait); - -import * as emberTestingLibInitializers from 'ember-testing/lib/initializers'; -d('ember-testing/lib/initializers', emberTestingLibInitializers); - -import * as emberTestingLibPublicApi from 'ember-testing/lib/public-api'; -d('ember-testing/lib/public-api', emberTestingLibPublicApi); - -import * as emberTestingLibSetupForTesting from 'ember-testing/lib/setup_for_testing'; -d('ember-testing/lib/setup_for_testing', emberTestingLibSetupForTesting); - -import * as emberTestingLibTest from 'ember-testing/lib/test'; -d('ember-testing/lib/test', emberTestingLibTest); - -import * as emberTestingLibTestAdapter from 'ember-testing/lib/test/adapter'; -d('ember-testing/lib/test/adapter', emberTestingLibTestAdapter); - -import * as emberTestingLibTestHelpers from 'ember-testing/lib/test/helpers'; -d('ember-testing/lib/test/helpers', emberTestingLibTestHelpers); - -import * as emberTestingLibTestOnInjectHelpers from 'ember-testing/lib/test/on_inject_helpers'; -d('ember-testing/lib/test/on_inject_helpers', emberTestingLibTestOnInjectHelpers); - -import * as emberTestingLibTestPendingRequests from 'ember-testing/lib/test/pending_requests'; -d('ember-testing/lib/test/pending_requests', emberTestingLibTestPendingRequests); - -import * as emberTestingLibTestPromise from 'ember-testing/lib/test/promise'; -d('ember-testing/lib/test/promise', emberTestingLibTestPromise); - -import * as emberTestingLibTestRun from 'ember-testing/lib/test/run'; -d('ember-testing/lib/test/run', emberTestingLibTestRun); - -import * as emberTestingLibTestWaiters from 'ember-testing/lib/test/waiters'; -d('ember-testing/lib/test/waiters', emberTestingLibTestWaiters); diff --git a/broccoli/amd-compat-entrypoints/ember.debug.js b/broccoli/amd-compat-entrypoints/ember.debug.js deleted file mode 100644 index 51123e1ae4f..00000000000 --- a/broccoli/amd-compat-entrypoints/ember.debug.js +++ /dev/null @@ -1,487 +0,0 @@ -/* eslint-disable */ - -// This file was derived from the output of the classic broccoli-based build of -// ember.debug.js. It's intended to convey exactly how the authored ES modules -// get mapped into backward-compatible AMD defines. -// -// The testing-specific modules that only appear in this bundle in development -// builds are not included in this file. They're in ./ember-testing.js, which -// our legacy bundle rollup config concatenates with this one for dev builds. -// -// (Typical apps actually work fine if we *don't* stick the testing modules into -// this bundle at all! Because the ember-testing.js bundle itself gets into the -// classic test-support.js. So they are double-included. But as these are -// backward-compatibility bundles, I'm going to keep that wacky behavior for -// them since somebody could be relying on the timing of having the test modules -// available before test-support.js evals. - -import d from 'amd-compat-entrypoint-definition'; - -import * as emberinternalsBrowserEnvironmentIndex from '@ember/-internals/browser-environment/index'; -d('@ember/-internals/browser-environment/index', emberinternalsBrowserEnvironmentIndex); - -import * as emberinternalsContainerIndex from '@ember/-internals/container/index'; -d('@ember/-internals/container/index', emberinternalsContainerIndex); - -import * as emberinternalsDeprecationsIndex from '@ember/-internals/deprecations/index'; -d('@ember/-internals/deprecations/index', emberinternalsDeprecationsIndex); - -import * as emberinternalsEnvironmentIndex from '@ember/-internals/environment/index'; -d('@ember/-internals/environment/index', emberinternalsEnvironmentIndex); - -import * as emberinternalsErrorHandlingIndex from '@ember/-internals/error-handling/index'; -d('@ember/-internals/error-handling/index', emberinternalsErrorHandlingIndex); - -import * as emberinternalsGlimmerIndex from '@ember/-internals/glimmer/index'; -d('@ember/-internals/glimmer/index', emberinternalsGlimmerIndex); - -import * as emberinternalsMetaIndex from '@ember/-internals/meta/index'; -d('@ember/-internals/meta/index', emberinternalsMetaIndex); - -import * as emberinternalsMetaLibMeta from '@ember/-internals/meta/lib/meta'; -d('@ember/-internals/meta/lib/meta', emberinternalsMetaLibMeta); - -import * as emberinternalsMetalIndex from '@ember/-internals/metal/index'; -d('@ember/-internals/metal/index', emberinternalsMetalIndex); - -import * as emberinternalsOwnerIndex from '@ember/-internals/owner/index'; -d('@ember/-internals/owner/index', emberinternalsOwnerIndex); - -import * as emberinternalsRoutingIndex from '@ember/-internals/routing/index'; -d('@ember/-internals/routing/index', emberinternalsRoutingIndex); - -import * as emberinternalsRuntimeIndex from '@ember/-internals/runtime/index'; -d('@ember/-internals/runtime/index', emberinternalsRuntimeIndex); - -import * as emberinternalsRuntimeLibExtRsvp from '@ember/-internals/runtime/lib/ext/rsvp'; -d('@ember/-internals/runtime/lib/ext/rsvp', emberinternalsRuntimeLibExtRsvp); - -import * as emberinternalsRuntimeLibMixinsproxy from '@ember/-internals/runtime/lib/mixins/-proxy'; -d('@ember/-internals/runtime/lib/mixins/-proxy', emberinternalsRuntimeLibMixinsproxy); - -import * as emberinternalsRuntimeLibMixinsActionHandler from '@ember/-internals/runtime/lib/mixins/action_handler'; -d( - '@ember/-internals/runtime/lib/mixins/action_handler', - emberinternalsRuntimeLibMixinsActionHandler -); - -import * as emberinternalsRuntimeLibMixinsComparable from '@ember/-internals/runtime/lib/mixins/comparable'; -d('@ember/-internals/runtime/lib/mixins/comparable', emberinternalsRuntimeLibMixinsComparable); - -import * as emberinternalsRuntimeLibMixinsContainerProxy from '@ember/-internals/runtime/lib/mixins/container_proxy'; -d( - '@ember/-internals/runtime/lib/mixins/container_proxy', - emberinternalsRuntimeLibMixinsContainerProxy -); - -import * as emberinternalsRuntimeLibMixinsRegistryProxy from '@ember/-internals/runtime/lib/mixins/registry_proxy'; -d( - '@ember/-internals/runtime/lib/mixins/registry_proxy', - emberinternalsRuntimeLibMixinsRegistryProxy -); - -import * as emberinternalsRuntimeLibMixinsTargetActionSupport from '@ember/-internals/runtime/lib/mixins/target_action_support'; -d( - '@ember/-internals/runtime/lib/mixins/target_action_support', - emberinternalsRuntimeLibMixinsTargetActionSupport -); - -import * as emberinternalsStringIndex from '@ember/-internals/string/index'; -d('@ember/-internals/string/index', emberinternalsStringIndex); - -import * as emberinternalsUtilityTypesIndex from '@ember/-internals/utility-types/index'; -d('@ember/-internals/utility-types/index', emberinternalsUtilityTypesIndex); - -import * as emberinternalsUtilsIndex from '@ember/-internals/utils/index'; -d('@ember/-internals/utils/index', emberinternalsUtilsIndex); - -import * as emberinternalsViewsIndex from '@ember/-internals/views/index'; -d('@ember/-internals/views/index', emberinternalsViewsIndex); - -import * as emberinternalsViewsLibCompatAttrs from '@ember/-internals/views/lib/compat/attrs'; -d('@ember/-internals/views/lib/compat/attrs', emberinternalsViewsLibCompatAttrs); - -import * as emberinternalsViewsLibCompatFallbackViewRegistry from '@ember/-internals/views/lib/compat/fallback-view-registry'; -d( - '@ember/-internals/views/lib/compat/fallback-view-registry', - emberinternalsViewsLibCompatFallbackViewRegistry -); - -import * as emberinternalsViewsLibComponentLookup from '@ember/-internals/views/lib/component_lookup'; -d('@ember/-internals/views/lib/component_lookup', emberinternalsViewsLibComponentLookup); - -import * as emberinternalsViewsLibMixinsActionSupport from '@ember/-internals/views/lib/mixins/action_support'; -d('@ember/-internals/views/lib/mixins/action_support', emberinternalsViewsLibMixinsActionSupport); - -import * as emberinternalsViewsLibSystemEventDispatcher from '@ember/-internals/views/lib/system/event_dispatcher'; -d( - '@ember/-internals/views/lib/system/event_dispatcher', - emberinternalsViewsLibSystemEventDispatcher -); - -import * as emberinternalsViewsLibSystemUtils from '@ember/-internals/views/lib/system/utils'; -d('@ember/-internals/views/lib/system/utils', emberinternalsViewsLibSystemUtils); - -import * as emberinternalsViewsLibViewsCoreView from '@ember/-internals/views/lib/views/core_view'; -d('@ember/-internals/views/lib/views/core_view', emberinternalsViewsLibViewsCoreView); - -import * as emberinternalsViewsLibViewsStates from '@ember/-internals/views/lib/views/states'; -d('@ember/-internals/views/lib/views/states', emberinternalsViewsLibViewsStates); - -import * as emberApplicationIndex from '@ember/application/index'; -d('@ember/application/index', emberApplicationIndex); - -import * as emberApplicationInstance from '@ember/application/instance'; -d('@ember/application/instance', emberApplicationInstance); - -import * as emberApplicationLibLazyLoad from '@ember/application/lib/lazy_load'; -d('@ember/application/lib/lazy_load', emberApplicationLibLazyLoad); - -import * as emberApplicationNamespace from '@ember/application/namespace'; -d('@ember/application/namespace', emberApplicationNamespace); - -import * as emberArrayinternals from '@ember/array/-internals'; -d('@ember/array/-internals', emberArrayinternals); - -import * as emberArrayIndex from '@ember/array/index'; -d('@ember/array/index', emberArrayIndex); - -import * as emberArrayLibMakeArray from '@ember/array/lib/make-array'; -d('@ember/array/lib/make-array', emberArrayLibMakeArray); - -import * as emberArrayMutable from '@ember/array/mutable'; -d('@ember/array/mutable', emberArrayMutable); - -import * as emberArrayProxy from '@ember/array/proxy'; -d('@ember/array/proxy', emberArrayProxy); - -import * as emberCanaryFeaturesIndex from '@ember/canary-features/index'; -d('@ember/canary-features/index', emberCanaryFeaturesIndex); - -import * as emberComponentHelper from '@ember/component/helper'; -d('@ember/component/helper', emberComponentHelper); - -import * as emberComponentIndex from '@ember/component/index'; -d('@ember/component/index', emberComponentIndex); - -import * as emberComponentTemplateOnly from '@ember/component/template-only'; -d('@ember/component/template-only', emberComponentTemplateOnly); - -import * as emberControllerIndex from '@ember/controller/index'; -d('@ember/controller/index', emberControllerIndex); - -import * as emberDebugIndex from '@ember/debug/index'; -d('@ember/debug/index', emberDebugIndex); - -import * as emberDebugLibCaptureRenderTree from '@ember/debug/lib/capture-render-tree'; -d('@ember/debug/lib/capture-render-tree', emberDebugLibCaptureRenderTree); - -import * as emberDebugLibDeprecate from '@ember/debug/lib/deprecate'; -d('@ember/debug/lib/deprecate', emberDebugLibDeprecate); - -import * as emberDebugLibHandlers from '@ember/debug/lib/handlers'; -d('@ember/debug/lib/handlers', emberDebugLibHandlers); - -import * as emberDebugLibInspect from '@ember/debug/lib/inspect'; -d('@ember/debug/lib/inspect', emberDebugLibInspect); - -import * as emberDebugLibTesting from '@ember/debug/lib/testing'; -d('@ember/debug/lib/testing', emberDebugLibTesting); - -import * as emberDebugLibWarn from '@ember/debug/lib/warn'; -d('@ember/debug/lib/warn', emberDebugLibWarn); - -import * as emberDebugContainerDebugAdapter from '@ember/debug/container-debug-adapter'; -d('@ember/debug/container-debug-adapter', emberDebugContainerDebugAdapter); - -import * as emberDebugDataAdapter from '@ember/debug/data-adapter'; -d('@ember/debug/data-adapter', emberDebugDataAdapter); - -import * as emberDeprecatedFeaturesIndex from '@ember/deprecated-features/index'; -d('@ember/deprecated-features/index', emberDeprecatedFeaturesIndex); - -import * as emberDestroyableIndex from '@ember/destroyable/index'; -d('@ember/destroyable/index', emberDestroyableIndex); - -import * as emberEngineIndex from '@ember/engine/index'; -d('@ember/engine/index', emberEngineIndex); - -import * as emberEngineInstance from '@ember/engine/instance'; -d('@ember/engine/instance', emberEngineInstance); - -import * as emberEngineLibEngineParent from '@ember/engine/lib/engine-parent'; -d('@ember/engine/lib/engine-parent', emberEngineLibEngineParent); - -import * as emberEnumerableIndex from '@ember/enumerable/index'; -d('@ember/enumerable/index', emberEnumerableIndex); - -import * as emberEnumerableMutable from '@ember/enumerable/mutable'; -d('@ember/enumerable/mutable', emberEnumerableMutable); - -import * as emberHelperIndex from '@ember/helper/index'; -d('@ember/helper/index', emberHelperIndex); - -import * as emberInstrumentationIndex from '@ember/instrumentation/index'; -d('@ember/instrumentation/index', emberInstrumentationIndex); - -import * as emberModifierIndex from '@ember/modifier/index'; -d('@ember/modifier/index', emberModifierIndex); - -import * as emberObjectinternals from '@ember/object/-internals'; -d('@ember/object/-internals', emberObjectinternals); - -import * as emberObjectCompat from '@ember/object/compat'; -d('@ember/object/compat', emberObjectCompat); - -import * as emberObjectComputed from '@ember/object/computed'; -d('@ember/object/computed', emberObjectComputed); - -import * as emberObjectCore from '@ember/object/core'; -d('@ember/object/core', emberObjectCore); - -import * as emberObjectEvented from '@ember/object/evented'; -d('@ember/object/evented', emberObjectEvented); - -import * as emberObjectEvents from '@ember/object/events'; -d('@ember/object/events', emberObjectEvents); - -import * as emberObjectIndex from '@ember/object/index'; -d('@ember/object/index', emberObjectIndex); - -import * as emberObjectInternals from '@ember/object/internals'; -d('@ember/object/internals', emberObjectInternals); - -import * as emberObjectLibComputedComputedMacros from '@ember/object/lib/computed/computed_macros'; -d('@ember/object/lib/computed/computed_macros', emberObjectLibComputedComputedMacros); - -import * as emberObjectLibComputedReduceComputedMacros from '@ember/object/lib/computed/reduce_computed_macros'; -d('@ember/object/lib/computed/reduce_computed_macros', emberObjectLibComputedReduceComputedMacros); - -import * as emberObjectMixin from '@ember/object/mixin'; -d('@ember/object/mixin', emberObjectMixin); - -import * as emberObjectObservable from '@ember/object/observable'; -d('@ember/object/observable', emberObjectObservable); - -import * as emberObjectObservers from '@ember/object/observers'; -d('@ember/object/observers', emberObjectObservers); - -import * as emberObjectPromiseProxyMixin from '@ember/object/promise-proxy-mixin'; -d('@ember/object/promise-proxy-mixin', emberObjectPromiseProxyMixin); - -import * as emberObjectProxy from '@ember/object/proxy'; -d('@ember/object/proxy', emberObjectProxy); - -import * as emberOwnerIndex from '@ember/owner/index'; -d('@ember/owner/index', emberOwnerIndex); - -import * as emberReactiveIndex from '@ember/reactive/index'; -d('@ember/reactive/index', emberReactiveIndex); - -import * as emberReactiveCollections from '@ember/reactive/collections'; -d('@ember/reactive/collections', emberReactiveCollections); - -import * as emberRendererIndex from '@ember/renderer/index'; -d('@ember/renderer/index', emberRendererIndex); - -import * as emberRoutinginternals from '@ember/routing/-internals'; -d('@ember/routing/-internals', emberRoutinginternals); - -import * as emberRoutingHashLocation from '@ember/routing/hash-location'; -d('@ember/routing/hash-location', emberRoutingHashLocation); - -import * as emberRoutingHistoryLocation from '@ember/routing/history-location'; -d('@ember/routing/history-location', emberRoutingHistoryLocation); - -import * as emberRoutingIndex from '@ember/routing/index'; -d('@ember/routing/index', emberRoutingIndex); - -import * as emberRoutingLibCache from '@ember/routing/lib/cache'; -d('@ember/routing/lib/cache', emberRoutingLibCache); - -import * as emberRoutingLibControllerFor from '@ember/routing/lib/controller_for'; -d('@ember/routing/lib/controller_for', emberRoutingLibControllerFor); - -import * as emberRoutingLibDsl from '@ember/routing/lib/dsl'; -d('@ember/routing/lib/dsl', emberRoutingLibDsl); - -import * as emberRoutingLibEngines from '@ember/routing/lib/engines'; -d('@ember/routing/lib/engines', emberRoutingLibEngines); - -import * as emberRoutingLibGenerateController from '@ember/routing/lib/generate_controller'; -d('@ember/routing/lib/generate_controller', emberRoutingLibGenerateController); - -import * as emberRoutingLibLocationUtils from '@ember/routing/lib/location-utils'; -d('@ember/routing/lib/location-utils', emberRoutingLibLocationUtils); - -import * as emberRoutingLibQueryParams from '@ember/routing/lib/query_params'; -d('@ember/routing/lib/query_params', emberRoutingLibQueryParams); - -import * as emberRoutingLibRouteInfo from '@ember/routing/lib/route-info'; -d('@ember/routing/lib/route-info', emberRoutingLibRouteInfo); - -import * as emberRoutingLibRouterState from '@ember/routing/lib/router_state'; -d('@ember/routing/lib/router_state', emberRoutingLibRouterState); - -import * as emberRoutingLibRoutingService from '@ember/routing/lib/routing-service'; -d('@ember/routing/lib/routing-service', emberRoutingLibRoutingService); - -import * as emberRoutingLibUtils from '@ember/routing/lib/utils'; -d('@ember/routing/lib/utils', emberRoutingLibUtils); - -import * as emberRoutingLocation from '@ember/routing/location'; -d('@ember/routing/location', emberRoutingLocation); - -import * as emberRoutingNoneLocation from '@ember/routing/none-location'; -d('@ember/routing/none-location', emberRoutingNoneLocation); - -import * as emberRoutingRouteInfo from '@ember/routing/route-info'; -d('@ember/routing/route-info', emberRoutingRouteInfo); - -import * as emberRoutingRoute from '@ember/routing/route'; -d('@ember/routing/route', emberRoutingRoute); - -import * as emberRoutingRouterService from '@ember/routing/router-service'; -d('@ember/routing/router-service', emberRoutingRouterService); - -import * as emberRoutingRouter from '@ember/routing/router'; -d('@ember/routing/router', emberRoutingRouter); - -import * as emberRoutingTransition from '@ember/routing/transition'; -d('@ember/routing/transition', emberRoutingTransition); - -import * as emberRunloopprivateBackburner from '@ember/runloop/-private/backburner'; -d('@ember/runloop/-private/backburner', emberRunloopprivateBackburner); - -import * as emberRunloopIndex from '@ember/runloop/index'; -d('@ember/runloop/index', emberRunloopIndex); - -import * as emberServiceIndex from '@ember/service/index'; -d('@ember/service/index', emberServiceIndex); - -import * as emberTemplateCompilationIndex from '@ember/template-compilation/index'; -d('@ember/template-compilation/index', emberTemplateCompilationIndex); - -import * as emberTemplateFactoryIndex from '@ember/template-factory/index'; -d('@ember/template-factory/index', emberTemplateFactoryIndex); - -import * as emberTemplateIndex from '@ember/template/index'; -d('@ember/template/index', emberTemplateIndex); - -import * as emberTestAdapter from '@ember/test/adapter'; -d('@ember/test/adapter', emberTestAdapter); - -import * as emberTestIndex from '@ember/test/index'; -d('@ember/test/index', emberTestIndex); - -import * as emberUtilsIndex from '@ember/utils/index'; -d('@ember/utils/index', emberUtilsIndex); - -import * as emberUtilsLibCompare from '@ember/utils/lib/compare'; -d('@ember/utils/lib/compare', emberUtilsLibCompare); - -import * as emberUtilsLibIsEqual from '@ember/utils/lib/is-equal'; -d('@ember/utils/lib/is-equal', emberUtilsLibIsEqual); - -import * as emberUtilsLibIsBlank from '@ember/utils/lib/is_blank'; -d('@ember/utils/lib/is_blank', emberUtilsLibIsBlank); - -import * as emberUtilsLibIsEmpty from '@ember/utils/lib/is_empty'; -d('@ember/utils/lib/is_empty', emberUtilsLibIsEmpty); - -import * as emberUtilsLibIsNone from '@ember/utils/lib/is_none'; -d('@ember/utils/lib/is_none', emberUtilsLibIsNone); - -import * as emberUtilsLibIsPresent from '@ember/utils/lib/is_present'; -d('@ember/utils/lib/is_present', emberUtilsLibIsPresent); - -import * as emberUtilsLibTypeOf from '@ember/utils/lib/type-of'; -d('@ember/utils/lib/type-of', emberUtilsLibTypeOf); - -import * as emberVersionIndex from '@ember/version/index'; -d('@ember/version/index', emberVersionIndex); - -import * as glimmerDestroyable from '@glimmer/destroyable'; -d('@glimmer/destroyable', glimmerDestroyable); - -import * as glimmerEncoder from '@glimmer/encoder'; -d('@glimmer/encoder', glimmerEncoder); - -import * as glimmerEnv from '@glimmer/env'; -d('@glimmer/env', glimmerEnv); - -import * as glimmerGlobalContext from '@glimmer/global-context'; -d('@glimmer/global-context', glimmerGlobalContext); - -import * as glimmerManager from '@glimmer/manager'; -d('@glimmer/manager', glimmerManager); - -import * as glimmerNode from '@glimmer/node'; -d('@glimmer/node', glimmerNode); - -import * as glimmerOpcodeCompiler from '@glimmer/opcode-compiler'; -d('@glimmer/opcode-compiler', glimmerOpcodeCompiler); - -import * as glimmerOwner from '@glimmer/owner'; -d('@glimmer/owner', glimmerOwner); - -import * as glimmerProgram from '@glimmer/program'; -d('@glimmer/program', glimmerProgram); - -import * as glimmerReference from '@glimmer/reference'; -d('@glimmer/reference', glimmerReference); - -import * as glimmerRuntime from '@glimmer/runtime'; -d('@glimmer/runtime', glimmerRuntime); - -import * as glimmerTrackingIndex from '@glimmer/tracking/index'; -d('@glimmer/tracking/index', glimmerTrackingIndex); - -import * as glimmerTrackingPrimitivesCache from '@glimmer/tracking/primitives/cache'; -d('@glimmer/tracking/primitives/cache', glimmerTrackingPrimitivesCache); - -import * as glimmerUtil from '@glimmer/util'; -d('@glimmer/util', glimmerUtil); - -import * as glimmerValidator from '@glimmer/validator'; -d('@glimmer/validator', glimmerValidator); - -import * as glimmerVm from '@glimmer/vm'; -d('@glimmer/vm', glimmerVm); - -import * as glimmerWireFormat from '@glimmer/wire-format'; -d('@glimmer/wire-format', glimmerWireFormat); - -import * as simpleDomDocument from '@simple-dom/document'; -d('@simple-dom/document', simpleDomDocument); - -import * as backburnerjs from 'backburner.js'; -d('backburner.js', backburnerjs); - -import * as dagMap from 'dag-map'; -d('dag-map', dagMap); - -import * as emberIndex from 'ember/index'; -d('ember/index', emberIndex); - -import * as emberVersion from 'ember/version'; -d('ember/version', emberVersion); - -import * as routeRecognizer from 'route-recognizer'; -d('route-recognizer', routeRecognizer); - -import * as routerJs from 'router_js'; -d('router_js', routerJs); - -import * as rsvp from 'rsvp'; -d('rsvp', rsvp); - -if (typeof module === 'object' && typeof module.require === 'function') { - module.exports = emberIndex.default; -} - -emberDebugIndex.deprecate( - 'Your app loaded Ember via a legacy AMD bundle. Opt into loading it from the modern ES modules by setting the use-ember-modules optional feature.', - false, - emberinternalsDeprecationsIndex.DEPRECATIONS.DEPRECATE_AMD_BUNDLES.options -); diff --git a/broccoli/build-info.js b/broccoli/build-info.js index 1b4c5df4f45..2419e0ef5a2 100644 --- a/broccoli/build-info.js +++ b/broccoli/build-info.js @@ -75,8 +75,8 @@ function buildGitInfo(root) { function buildFromParts(packageVersion, gitInfo) { let { tag, branch, sha } = gitInfo; let shortSha = sha.slice(0, 8); - if (tag) { - let tagVersion = parseTagVersion(tag); + let tagVersion = tag ? parseTagVersion(tag) : null; + if (tag && tagVersion) { return { tag, branch: null, @@ -126,7 +126,8 @@ function readPackageVersion(root) { */ function parseTagVersion(tag) { if (tag) { - return semver.parse(tag.replace(/-ember-source$/, '')).version; + let parsed = semver.parse(tag.replace(/-ember-source$/, '')); + return parsed ? parsed.version : null; } } diff --git a/eslint.config.mjs b/eslint.config.mjs index 160c3340173..1716ec242fe 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -21,15 +21,15 @@ export default [ 'docs/', '**/.*', '**/dist/', + '**/dist-prod/', '**/tmp/', '**/smoke-tests/', '**/types/', '**/type-tests/', 'internal-docs/guides/**', 'packages/@glimmer-workspace/**', - 'packages/@handlebars/parser/lib/parser.js', - 'packages/@handlebars/parser/src/**', 'tracerbench-testing/', + 'bench.mjs', ], }, pluginJs.configs.recommended, @@ -170,33 +170,6 @@ export default [ 'ember-internal/no-const-outside-module-scope': 'error', }, }, - { - files: ['packages/@handlebars/**/*.js'], - - languageOptions: { - ecmaVersion: 2017, - sourceType: 'module', - }, - - rules: { - 'ember-internal/require-yuidoc-access': 'off', - 'ember-internal/no-const-outside-module-scope': 'off', - 'disable-features/disable-async-await': 'off', - 'disable-features/disable-generator-functions': 'off', - 'no-implicit-coercion': 'off', - 'no-unused-vars': 'off', - 'import/namespace': 'off', - }, - }, - { - files: ['packages/@handlebars/parser/spec/**/*.js'], - - languageOptions: { - globals: { - ...globals.mocha, - }, - }, - }, { files: [ 'packages/*/tests/**/*.[jt]s', @@ -426,6 +399,8 @@ export default [ '@typescript-eslint/no-confusing-void-expression': 'off', '@typescript-eslint/no-unnecessary-condition': 'off', '@typescript-eslint/naming-convention': 'off', + // TypeError: Cannot read properties of undefined (reading 'range') + '@typescript-eslint/no-unnecessary-type-arguments': 'off', }, }, { diff --git a/index.html b/index.html index 398c5be6da5..77ad682afac 100644 --- a/index.html +++ b/index.html @@ -15,15 +15,6 @@ // Test under octane defaults EmberENV._DEFAULT_ASYNC_OBSERVERS = true; - // Test for "hooks in EmberENV.EMBER_LOAD_HOOKS['hookName'] get executed" - EmberENV.EMBER_LOAD_HOOKS = EmberENV.EMBER_LOAD_HOOKS || {}; - EmberENV.EMBER_LOAD_HOOKS.__before_ember_test_hook__ = - EmberENV.EMBER_LOAD_HOOKS.__before_ember_test_hook__ || []; - EmberENV.__test_hook_count__ = 0; - EmberENV.EMBER_LOAD_HOOKS.__before_ember_test_hook__.push(function (object) { - EmberENV.__test_hook_count__ += object; - }); - // Handle testing feature flags if (QUnit.urlParams.ENABLE_OPTIONAL_FEATURES) { EmberENV.ENABLE_OPTIONAL_FEATURES = true; diff --git a/lib/index.js b/lib/index.js index dfb32e8a429..36c496c739d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,49 +1,10 @@ 'use strict'; -const MergeTrees = require('broccoli-merge-trees'); -const createFile = require('broccoli-file-creator'); -const Funnel = require('broccoli-funnel'); const path = require('path'); const Overrides = require('./overrides'); const SupportedBrowsers = require('./browsers'); -const fs = require('fs'); -const useEmberModules = (() => { - // this doesn't go through the documented API of the @ember/optional-features - // package because that is available way too late for this. - let pkg = require(path.join(process.cwd(), 'package.json')); - let configDir = pkg['ember-addon']?.['configPath'] ?? 'config'; - let optionalFeaturesPath = `./${configDir}/optional-features.json`; - if (fs.existsSync(optionalFeaturesPath)) { - return require(path.join(process.cwd(), optionalFeaturesPath))?.['use-ember-modules'] ?? false; - } else { - return false; - } -})(); - -const paths = {}; -const absolutePaths = {}; - -function add(paths, name, path) { - Object.defineProperty(paths, name, { - configurable: false, - get: function () { - return path; - }, - }); -} - -add(paths, 'prod', 'vendor/ember/ember.js'); -add(paths, 'debug', 'vendor/ember/ember.js'); -add(paths, 'testing', 'vendor/ember/ember-testing.js'); - -add( - absolutePaths, - 'templateCompiler', - useEmberModules - ? path.join(__dirname, '..', 'dist', 'packages', 'ember-template-compiler', 'index.js') - : path.join(__dirname, '..', 'dist', 'ember-template-compiler.js') -); +const isProduction = process.env.EMBER_ENV === 'production'; const { addonV1Shim } = require('@embroider/addon-shim'); @@ -52,195 +13,168 @@ const shim = addonV1Shim(path.join(__dirname, '..'), { customizeMeta(meta) { /* This whole hook is an ember-auto-import feature that only effects classic builds, not embroider builds. */ - if (useEmberModules) { - // this is our forward-compatible mode where all of ember-source is - // handled by ember-auto-import, like a normal v2 addon. - // - // In this case, we need to inject an implicit-modules config to force - // all the traditionally-included modules to be included whether or not - // we see an import for them, because ember-auto-import does not have - // global visiblity of all imports in all v1 addons. - // - // This means ember-source is not tree-shakable on classic builds, but - // that's the normal status quo for classic builds. It's all - // tree-shakable on the current default build (@embroider/vite). - return { - ...meta, - 'implicit-modules': [ - './dist/packages/@ember/-internals/browser-environment/index.js', - './dist/packages/@ember/-internals/container/index.js', - './dist/packages/@ember/-internals/deprecations/index.js', - './dist/packages/@ember/-internals/environment/index.js', - './dist/packages/@ember/-internals/error-handling/index.js', - './dist/packages/@ember/-internals/glimmer/index.js', - './dist/packages/@ember/-internals/meta/index.js', - './dist/packages/@ember/-internals/meta/lib/meta.js', - './dist/packages/@ember/-internals/metal/index.js', - './dist/packages/@ember/-internals/owner/index.js', - './dist/packages/@ember/-internals/routing/index.js', - './dist/packages/@ember/-internals/runtime/index.js', - './dist/packages/@ember/-internals/runtime/lib/ext/rsvp.js', - './dist/packages/@ember/-internals/runtime/lib/mixins/-proxy.js', - './dist/packages/@ember/-internals/runtime/lib/mixins/comparable.js', - './dist/packages/@ember/-internals/string/index.js', - './dist/packages/@ember/-internals/utility-types/index.js', - './dist/packages/@ember/-internals/utils/index.js', - './dist/packages/@ember/-internals/views/index.js', - './dist/packages/@ember/-internals/views/lib/compat/attrs.js', - './dist/packages/@ember/-internals/views/lib/component_lookup.js', - './dist/packages/@ember/-internals/views/lib/mixins/action_support.js', - './dist/packages/@ember/-internals/views/lib/system/utils.js', - './dist/packages/@ember/-internals/views/lib/views/core_view.js', - './dist/packages/@ember/-internals/views/lib/views/states.js', - './dist/packages/@ember/application/index.js', - './dist/packages/@ember/application/instance.js', - './dist/packages/@ember/application/lib/lazy_load.js', - './dist/packages/@ember/application/namespace.js', - './dist/packages/@ember/array/-internals.js', - './dist/packages/@ember/array/index.js', - './dist/packages/@ember/array/lib/make-array.js', - './dist/packages/@ember/array/mutable.js', - './dist/packages/@ember/array/proxy.js', - './dist/packages/@ember/canary-features/index.js', - './dist/packages/@ember/component/helper.js', - './dist/packages/@ember/component/index.js', - './dist/packages/@ember/component/template-only.js', - './dist/packages/@ember/controller/index.js', - './dist/packages/@ember/debug/index.js', - './dist/packages/@ember/debug/lib/capture-render-tree.js', - './dist/packages/@ember/debug/lib/deprecate.js', - './dist/packages/@ember/debug/lib/handlers.js', - './dist/packages/@ember/debug/lib/inspect.js', - './dist/packages/@ember/debug/lib/testing.js', - './dist/packages/@ember/debug/lib/warn.js', - './dist/packages/@ember/debug/container-debug-adapter.js', - './dist/packages/@ember/debug/data-adapter.js', - './dist/packages/@ember/deprecated-features/index.js', - './dist/packages/@ember/destroyable/index.js', - './dist/packages/@ember/engine/index.js', - './dist/packages/@ember/engine/instance.js', - './dist/packages/@ember/engine/lib/engine-parent.js', - './dist/packages/@ember/enumerable/index.js', - './dist/packages/@ember/enumerable/mutable.js', - './dist/packages/@ember/helper/index.js', - './dist/packages/@ember/instrumentation/index.js', - './dist/packages/@ember/modifier/index.js', - './dist/packages/@ember/object/-internals.js', - './dist/packages/@ember/object/compat.js', - './dist/packages/@ember/object/computed.js', - './dist/packages/@ember/object/core.js', - './dist/packages/@ember/object/evented.js', - './dist/packages/@ember/object/events.js', - './dist/packages/@ember/object/index.js', - './dist/packages/@ember/object/internals.js', - './dist/packages/@ember/object/lib/computed/computed_macros.js', - './dist/packages/@ember/object/lib/computed/reduce_computed_macros.js', - './dist/packages/@ember/object/mixin.js', - './dist/packages/@ember/object/observable.js', - './dist/packages/@ember/object/observers.js', - './dist/packages/@ember/object/promise-proxy-mixin.js', - './dist/packages/@ember/object/proxy.js', - './dist/packages/@ember/owner/index.js', - './dist/packages/@ember/renderer/index.js', - './dist/packages/@ember/routing/-internals.js', - './dist/packages/@ember/routing/hash-location.js', - './dist/packages/@ember/routing/history-location.js', - './dist/packages/@ember/routing/index.js', - './dist/packages/@ember/routing/lib/cache.js', - './dist/packages/@ember/routing/lib/controller_for.js', - './dist/packages/@ember/routing/lib/dsl.js', - './dist/packages/@ember/routing/lib/generate_controller.js', - './dist/packages/@ember/routing/lib/location-utils.js', - './dist/packages/@ember/routing/lib/query_params.js', - './dist/packages/@ember/routing/lib/router_state.js', - './dist/packages/@ember/routing/lib/routing-service.js', - './dist/packages/@ember/routing/lib/utils.js', - './dist/packages/@ember/routing/none-location.js', - './dist/packages/@ember/routing/route.js', - './dist/packages/@ember/routing/router-service.js', - './dist/packages/@ember/routing/router.js', - './dist/packages/@ember/runloop/index.js', - './dist/packages/@ember/service/index.js', - './dist/packages/@ember/template-compilation/index.js', - './dist/packages/@ember/template-factory/index.js', - './dist/packages/@ember/template/index.js', - './dist/packages/@ember/test/adapter.js', - './dist/packages/@ember/test/index.js', - './dist/packages/@ember/utils/index.js', - './dist/packages/@ember/utils/lib/compare.js', - './dist/packages/@ember/utils/lib/is-equal.js', - './dist/packages/@ember/utils/lib/is_blank.js', - './dist/packages/@ember/utils/lib/is_empty.js', - './dist/packages/@ember/utils/lib/is_none.js', - './dist/packages/@ember/utils/lib/is_present.js', - './dist/packages/@ember/utils/lib/type-of.js', - './dist/packages/@ember/version/index.js', - './dist/packages/@glimmer/destroyable.js', - './dist/packages/@glimmer/encoder.js', - './dist/packages/@glimmer/env.js', - './dist/packages/@glimmer/global-context.js', - './dist/packages/@glimmer/manager.js', - './dist/packages/@glimmer/node.js', - './dist/packages/@glimmer/opcode-compiler.js', - './dist/packages/@glimmer/owner.js', - './dist/packages/@glimmer/program.js', - './dist/packages/@glimmer/reference.js', - './dist/packages/@glimmer/runtime.js', - './dist/packages/@glimmer/tracking/index.js', - './dist/packages/@glimmer/tracking/primitives/cache.js', - './dist/packages/@glimmer/util.js', - './dist/packages/@glimmer/validator.js', - './dist/packages/@glimmer/vm.js', - './dist/packages/@glimmer/wire-format.js', - './dist/packages/@simple-dom/document.js', - './dist/packages/backburner.js/index.js', - './dist/packages/dag-map.js', - './dist/packages/ember/index.js', - './dist/packages/ember/version.js', - './dist/packages/route-recognizer.js', - './dist/packages/router_js.js', - './dist/packages/rsvp.js', - ], - 'implicit-test-modules': [ - './dist/packages/ember-testing/index.js', - './dist/packages/ember-testing/lib/adapters/adapter.js', - './dist/packages/ember-testing/lib/adapters/qunit.js', - './dist/packages/ember-testing/lib/ext/application.js', - './dist/packages/ember-testing/lib/ext/rsvp.js', - './dist/packages/ember-testing/lib/helpers.js', - './dist/packages/ember-testing/lib/helpers/and_then.js', - './dist/packages/ember-testing/lib/helpers/current_path.js', - './dist/packages/ember-testing/lib/helpers/current_route_name.js', - './dist/packages/ember-testing/lib/helpers/current_url.js', - './dist/packages/ember-testing/lib/helpers/pause_test.js', - './dist/packages/ember-testing/lib/helpers/visit.js', - './dist/packages/ember-testing/lib/helpers/wait.js', - './dist/packages/ember-testing/lib/initializers.js', - './dist/packages/ember-testing/lib/public-api.js', - './dist/packages/ember-testing/lib/setup_for_testing.js', - './dist/packages/ember-testing/lib/test.js', - './dist/packages/ember-testing/lib/test/adapter.js', - './dist/packages/ember-testing/lib/test/helpers.js', - './dist/packages/ember-testing/lib/test/on_inject_helpers.js', - './dist/packages/ember-testing/lib/test/pending_requests.js', - './dist/packages/ember-testing/lib/test/promise.js', - './dist/packages/ember-testing/lib/test/run.js', - './dist/packages/ember-testing/lib/test/waiters.js', - ], - }; - } else { - // this is our backward-compatible mode that actually keeps most of ember-source in vendor.js. - return { ...meta, 'renamed-modules': {} }; - } + // this is our forward-compatible mode where all of ember-source is + // handled by ember-auto-import, like a normal v2 addon. + // + // In this case, we need to inject an implicit-modules config to force + // all the traditionally-included modules to be included whether or not + // we see an import for them, because ember-auto-import does not have + // global visiblity of all imports in all v1 addons. + // + // This means ember-source is not tree-shakable on classic builds, but + // that's the normal status quo for classic builds. It's all + // tree-shakable on the current default build (@embroider/vite). + return { + ...meta, + 'implicit-modules': [ + './dist/dev/packages/@ember/-internals/browser-environment/index.js', + './dist/dev/packages/@ember/-internals/container/index.js', + './dist/dev/packages/@ember/-internals/deprecations/index.js', + './dist/dev/packages/@ember/-internals/environment/index.js', + './dist/dev/packages/@ember/-internals/error-handling/index.js', + './dist/dev/packages/@ember/-internals/glimmer/index.js', + './dist/dev/packages/@ember/-internals/meta/index.js', + './dist/dev/packages/@ember/-internals/meta/lib/meta.js', + './dist/dev/packages/@ember/-internals/metal/index.js', + './dist/dev/packages/@ember/-internals/owner/index.js', + './dist/dev/packages/@ember/-internals/routing/index.js', + './dist/dev/packages/@ember/-internals/runtime/index.js', + './dist/dev/packages/@ember/-internals/runtime/lib/ext/rsvp.js', + './dist/dev/packages/@ember/-internals/runtime/lib/mixins/-proxy.js', + './dist/dev/packages/@ember/-internals/runtime/lib/mixins/comparable.js', + './dist/dev/packages/@ember/-internals/string/index.js', + './dist/dev/packages/@ember/-internals/utility-types/index.js', + './dist/dev/packages/@ember/-internals/utils/index.js', + './dist/dev/packages/@ember/-internals/views/index.js', + './dist/dev/packages/@ember/-internals/views/lib/compat/attrs.js', + './dist/dev/packages/@ember/-internals/views/lib/component_lookup.js', + './dist/dev/packages/@ember/-internals/views/lib/mixins/action_support.js', + './dist/dev/packages/@ember/-internals/views/lib/system/utils.js', + './dist/dev/packages/@ember/-internals/views/lib/views/core_view.js', + './dist/dev/packages/@ember/-internals/views/lib/views/states.js', + './dist/dev/packages/@ember/application/index.js', + './dist/dev/packages/@ember/application/instance.js', + './dist/dev/packages/@ember/application/namespace.js', + './dist/dev/packages/@ember/array/-internals.js', + './dist/dev/packages/@ember/array/index.js', + './dist/dev/packages/@ember/array/lib/make-array.js', + './dist/dev/packages/@ember/array/mutable.js', + './dist/dev/packages/@ember/array/proxy.js', + './dist/dev/packages/@ember/canary-features/index.js', + './dist/dev/packages/@ember/component/helper.js', + './dist/dev/packages/@ember/component/index.js', + './dist/dev/packages/@ember/component/template-only.js', + './dist/dev/packages/@ember/controller/index.js', + './dist/dev/packages/@ember/debug/index.js', + './dist/dev/packages/@ember/debug/lib/capture-render-tree.js', + './dist/dev/packages/@ember/debug/lib/deprecate.js', + './dist/dev/packages/@ember/debug/lib/handlers.js', + './dist/dev/packages/@ember/debug/lib/inspect.js', + './dist/dev/packages/@ember/debug/lib/testing.js', + './dist/dev/packages/@ember/debug/lib/warn.js', + './dist/dev/packages/@ember/debug/container-debug-adapter.js', + './dist/dev/packages/@ember/debug/data-adapter.js', + './dist/dev/packages/@ember/deprecated-features/index.js', + './dist/dev/packages/@ember/destroyable/index.js', + './dist/dev/packages/@ember/engine/index.js', + './dist/dev/packages/@ember/engine/instance.js', + './dist/dev/packages/@ember/engine/lib/engine-parent.js', + './dist/dev/packages/@ember/enumerable/index.js', + './dist/dev/packages/@ember/enumerable/mutable.js', + './dist/dev/packages/@ember/helper/index.js', + './dist/dev/packages/@ember/instrumentation/index.js', + './dist/dev/packages/@ember/modifier/index.js', + './dist/dev/packages/@ember/object/-internals.js', + './dist/dev/packages/@ember/object/compat.js', + './dist/dev/packages/@ember/object/computed.js', + './dist/dev/packages/@ember/object/core.js', + './dist/dev/packages/@ember/object/evented.js', + './dist/dev/packages/@ember/object/events.js', + './dist/dev/packages/@ember/object/index.js', + './dist/dev/packages/@ember/object/internals.js', + './dist/dev/packages/@ember/object/lib/computed/computed_macros.js', + './dist/dev/packages/@ember/object/lib/computed/reduce_computed_macros.js', + './dist/dev/packages/@ember/object/mixin.js', + './dist/dev/packages/@ember/object/observable.js', + './dist/dev/packages/@ember/object/observers.js', + './dist/dev/packages/@ember/object/promise-proxy-mixin.js', + './dist/dev/packages/@ember/object/proxy.js', + './dist/dev/packages/@ember/owner/index.js', + './dist/dev/packages/@ember/renderer/index.js', + './dist/dev/packages/@ember/routing/-internals.js', + './dist/dev/packages/@ember/routing/hash-location.js', + './dist/dev/packages/@ember/routing/history-location.js', + './dist/dev/packages/@ember/routing/index.js', + './dist/dev/packages/@ember/routing/lib/cache.js', + './dist/dev/packages/@ember/routing/lib/controller_for.js', + './dist/dev/packages/@ember/routing/lib/dsl.js', + './dist/dev/packages/@ember/routing/lib/generate_controller.js', + './dist/dev/packages/@ember/routing/lib/location-utils.js', + './dist/dev/packages/@ember/routing/lib/query_params.js', + './dist/dev/packages/@ember/routing/lib/router_state.js', + './dist/dev/packages/@ember/routing/lib/routing-service.js', + './dist/dev/packages/@ember/routing/lib/utils.js', + './dist/dev/packages/@ember/routing/none-location.js', + './dist/dev/packages/@ember/routing/route.js', + './dist/dev/packages/@ember/routing/router-service.js', + './dist/dev/packages/@ember/routing/router.js', + './dist/dev/packages/@ember/runloop/index.js', + './dist/dev/packages/@ember/service/index.js', + './dist/dev/packages/@ember/template-compilation/index.js', + './dist/dev/packages/@ember/template-factory/index.js', + './dist/dev/packages/@ember/template/index.js', + './dist/dev/packages/@ember/test/adapter.js', + './dist/dev/packages/@ember/test/index.js', + './dist/dev/packages/@ember/utils/index.js', + './dist/dev/packages/@ember/utils/lib/compare.js', + './dist/dev/packages/@ember/utils/lib/is-equal.js', + './dist/dev/packages/@ember/utils/lib/is_blank.js', + './dist/dev/packages/@ember/utils/lib/is_empty.js', + './dist/dev/packages/@ember/utils/lib/is_none.js', + './dist/dev/packages/@ember/utils/lib/is_present.js', + './dist/dev/packages/@ember/utils/lib/type-of.js', + './dist/dev/packages/@ember/version/index.js', + './dist/dev/packages/@glimmer/destroyable/index.js', + './dist/dev/packages/@glimmer/encoder/index.js', + './dist/dev/packages/@glimmer/env/index.js', + './dist/dev/packages/@glimmer/global-context/index.js', + './dist/dev/packages/@glimmer/manager/index.js', + './dist/dev/packages/@glimmer/node/index.js', + './dist/dev/packages/@glimmer/opcode-compiler/index.js', + './dist/dev/packages/@glimmer/owner/index.js', + './dist/dev/packages/@glimmer/program/index.js', + './dist/dev/packages/@glimmer/reference/index.js', + './dist/dev/packages/@glimmer/runtime/index.js', + './dist/dev/packages/@glimmer/tracking/index.js', + './dist/dev/packages/@glimmer/tracking/primitives/cache/index.js', + './dist/dev/packages/@glimmer/util/index.js', + './dist/dev/packages/@glimmer/validator/index.js', + './dist/dev/packages/@glimmer/vm/index.js', + './dist/dev/packages/@glimmer/wire-format/index.js', + './dist/dev/packages/@simple-dom/document/index.js', + './dist/dev/packages/backburner.js/index.js', + './dist/dev/packages/dag-map/index.js', + './dist/dev/packages/ember/version.js', + './dist/dev/packages/route-recognizer/index.js', + './dist/dev/packages/router_js/index.js', + './dist/dev/packages/rsvp/index.js', + ].map((x) => (isProduction ? x.replace('/dist/dev/', '/dist/prod/') : x)), + 'implicit-test-modules': [ + './dist/dev/packages/ember-testing/index.js', + './dist/dev/packages/ember-testing/lib/adapters/adapter.js', + './dist/dev/packages/ember-testing/lib/public-api.js', + './dist/dev/packages/ember-testing/lib/test.js', + './dist/dev/packages/ember-testing/lib/test/adapter.js', + './dist/dev/packages/ember-testing/lib/test/pending_requests.js', + './dist/dev/packages/ember-testing/lib/test/waiters.js', + ].map((x) => (isProduction ? x.replace('/dist/dev/', '/dist/prod/') : x)), + }; }, }, }); module.exports = { ...shim, - paths, - absolutePaths, - init() { if (shim.init) { shim.init.apply(this, arguments); @@ -252,10 +186,6 @@ module.exports = { // considers `__dirname` here to be the root, but since our main entry // point is within a subfolder we need to correct that this.root = path.join(__dirname, '..'); - - // Updates the vendor tree to point to dist, so we get the correct tree in - // treeForVendor - this.treePaths.vendor = 'dist'; }, _overrideTree: undefined, @@ -281,56 +211,4 @@ module.exports = { this.ui.writeWarnLine('[DEPRECATION] ' + overrides.buildTimeWarning); } }, - - treeForVendor(tree) { - if (shim.treeForVendor) { - tree = shim.treeForVendor.call(this, tree); - } - const isProduction = process.env.EMBER_ENV === 'production'; - - let templateCompiler = new Funnel(tree, { - destDir: 'ember', - include: ['ember-template-compiler.js', 'ember-template-compiler.js.map'], - }); - - let emberAMDBundles; - - if (useEmberModules) { - // ember-cli always tries to append these to vendor.js, so even when we - // don't want to put anything in them they need to exist as empty files. - emberAMDBundles = new MergeTrees([ - createFile('ember/ember.js', ''), - createFile('ember/ember.js.map', ''), - createFile('ember/ember-testing.js', ''), - createFile('ember/ember-testing.js.map', ''), - ]); - } else { - let which = isProduction ? 'prod' : 'debug'; - - emberAMDBundles = new Funnel(tree, { - destDir: 'ember', - include: [ - `ember.${which}.js`, - `ember.${which}.js.map`, - 'ember-testing.js', - 'ember-testing.js.map', - ], - getDestinationPath(path) { - return path.replace(`ember.${which}.`, 'ember.'); - }, - }); - } - - let emberCliBabel = this.addons.find((a) => a.name === 'ember-cli-babel'); - - // this is primarily so we get preset-env with the app's targets. All our - // special stuff was already accounted for in the building of the bundles. - return emberCliBabel.transpileTree(new MergeTrees([emberAMDBundles, templateCompiler]), { - 'ember-cli-babel': { - compileModules: false, - disableDebugTooling: true, - disableEmberModulesAPIPolyfill: true, - }, - }); - }, }; diff --git a/package.json b/package.json index 2259f6a680c..42fd72a786b 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,19 @@ { "name": "ember-source", - "version": "6.12.0-alpha.1", + "version": "7.1.0-alpha.1", "description": "A JavaScript framework for creating ambitious web applications", "keywords": [ "ember-addon" ], "exports": { - "./*": "./dist/packages/*", + "./*": { + "development": "./dist/dev/packages/*", + "production": "./dist/prod/packages/*", + "default": "./dist/prod/packages/*" + }, "./types": { "types": "./types/stable/index.d.ts" }, - "./dist/ember-template-compiler.js": "./dist/ember-template-compiler.js", "./package.json": "./package.json" }, "homepage": "https://emberjs.com/", @@ -22,16 +25,7 @@ "files": [ "build-metadata.json", "blueprints", - "dist/packages", - "dist/dependencies", - "dist/ember-template-compiler.js", - "dist/ember-template-compiler.js.map", - "dist/ember.debug.js", - "dist/ember.debug.js.map", - "dist/ember.prod.js", - "dist/ember.prod.js.map", - "dist/ember-testing.js", - "dist/ember-testing.js.map", + "dist", "docs/data.json", "lib", "types/stable" @@ -61,9 +55,8 @@ "test:browserstack": "node bin/run-browserstack-tests.js", "test:wip": "vite build --mode development --minify false && testem ci", "type-check:internals": "tsc --noEmit", - "type-check:handlebars": "tsc --noEmit --project packages/@handlebars/parser/tsconfig.json", "type-check:types": "tsc --noEmit --project type-tests", - "type-check": "npm-run-all type-check:*" + "type-check": "npm-run-all type-check:internals type-check:types" }, "dependencies": { "@babel/core": "^7.24.4", @@ -71,10 +64,8 @@ "@simple-dom/interface": "^1.4.0", "backburner.js": "^2.8.0", "broccoli-file-creator": "^2.1.1", - "broccoli-funnel": "^3.0.8", - "broccoli-merge-trees": "^4.2.0", "chalk": "^4.0.0", - "ember-cli-babel": "^8.2.0", + "ember-cli-babel": "^8.3.1", "ember-cli-get-component-path-option": "^1.0.0", "ember-cli-normalize-entity-name": "^1.0.0", "ember-cli-path-utils": "^1.0.0", @@ -83,7 +74,6 @@ "ember-router-generator": "^2.0.0", "inflection": "^2.0.1", "route-recognizer": "^0.3.4", - "router_js": "^8.0.5", "semver": "^7.5.2", "silent-error": "^1.1.1", "simple-html-tokenizer": "^0.5.11" @@ -93,11 +83,12 @@ "@babel/plugin-transform-typescript": "^7.22.9", "@babel/preset-env": "^7.16.11", "@babel/types": "^7.22.5", - "@embroider/macros": "^1.19.7", - "@embroider/shared-internals": "^2.9.2", - "@embroider/vite": "^1.5.2", + "@embroider/macros": "^1.20.2", + "@embroider/shared-internals": "^3.0.2", + "@embroider/vite": "^1.7.2", "@eslint/js": "^9.21.0", "@glimmer/component": "workspace:*", + "@octokit/rest": "^20.1.2", "@rollup/plugin-babel": "^6.0.4", "@simple-dom/document": "^1.4.0", "@swc-node/register": "^1.6.8", @@ -108,10 +99,10 @@ "ast-types": "^0.14.2", "auto-dist-tag": "^2.1.1", "babel-plugin-debug-macros": "1.0.0", - "babel-plugin-ember-template-compilation": "3.0.0-alpha.4", + "babel-plugin-ember-template-compilation": "^4.0.0", "dag-map": "^2.0.2", "decorator-transforms": "2.0.0", - "ember-cli": "^6.3.0", + "ember-cli": "^6.11.1", "ember-cli-blueprint-test-helpers": "^0.19.2", "ember-cli-browserstack": "^2.0.1", "ember-cli-dependency-checker": "^3.3.1", @@ -123,21 +114,21 @@ "eslint-plugin-import": "^2.31.0", "eslint-plugin-n": "^17.16.2", "eslint-plugin-qunit": "^8.1.2", - "execa": "^5.1.1", + "execa": "^9.0.0", "expect-type": "^0.15.0", "fs-extra": "^11.1.1", "git-repo-info": "^2.1.1", - "github": "^0.2.3", "glob": "^8.0.3", "globals": "^16.0.0", "kill-port-process": "^3.2.1", - "mocha": "^10.2.0", - "npm-run-all2": "^6.0.6", + "mocha": "^11.0.0", + "npm-run-all2": "^8.0.0", "prettier": "^3.5.3", "qunit": "^2.19.4", "recast": "^0.22.0", "resolve.exports": "^2.0.3", "rollup": "^4.57.1", + "router_js": "workspace:*", "rsvp": "^4.8.5", "terser": "^5.42.0", "testem": "^3.10.1", @@ -145,7 +136,7 @@ "tracerbench": "^8.0.1", "typescript": "^5.7.3", "typescript-eslint": "^8.26.0", - "vite": "^5.4.12" + "vite": "^7.0.0" }, "resolutions": { "socket.io": "^4.7.0" @@ -153,7 +144,9 @@ "pnpm": { "overrides": { "rollup": "^4.2.0", - "ember-cli-htmlbars": "^7.0.0" + "ember-cli-htmlbars": "^7.0.0", + "babel-plugin-ember-template-compilation": "^4.0.0", + "ember-cli-babel": "^8.3.1" }, "onlyBuiltDependencies": [ "@swc/core", @@ -208,7 +201,6 @@ "@ember/-internals/views/lib/views/states.js": "ember-source/@ember/-internals/views/lib/views/states.js", "@ember/application/index.js": "ember-source/@ember/application/index.js", "@ember/application/instance.js": "ember-source/@ember/application/instance.js", - "@ember/application/lib/lazy_load.js": "ember-source/@ember/application/lib/lazy_load.js", "@ember/application/namespace.js": "ember-source/@ember/application/namespace.js", "@ember/array/-internals.js": "ember-source/@ember/array/-internals.js", "@ember/array/index.js": "ember-source/@ember/array/index.js", @@ -293,6 +285,7 @@ "@ember/template-compiler/lib/plugins/assert-against-named-outlets.js": "ember-source/@ember/template-compiler/lib/plugins/assert-against-named-outlets.js", "@ember/template-compiler/lib/plugins/assert-input-helper-without-block.js": "ember-source/@ember/template-compiler/lib/plugins/assert-input-helper-without-block.js", "@ember/template-compiler/lib/plugins/assert-reserved-named-arguments.js": "ember-source/@ember/template-compiler/lib/plugins/assert-reserved-named-arguments.js", + "@ember/template-compiler/lib/plugins/auto-import-builtins.js": "ember-source/@ember/template-compiler/lib/plugins/auto-import-builtins.js", "@ember/template-compiler/lib/plugins/index.js": "ember-source/@ember/template-compiler/lib/plugins/index.js", "@ember/template-compiler/lib/plugins/transform-action-syntax.js": "ember-source/@ember/template-compiler/lib/plugins/transform-action-syntax.js", "@ember/template-compiler/lib/plugins/transform-each-in-into-each.js": "ember-source/@ember/template-compiler/lib/plugins/transform-each-in-into-each.js", @@ -343,30 +336,11 @@ "ember-template-compiler/index.js": "ember-source/ember-template-compiler/index.js", "ember-testing/index.js": "ember-source/ember-testing/index.js", "ember-testing/lib/adapters/adapter.js": "ember-source/ember-testing/lib/adapters/adapter.js", - "ember-testing/lib/adapters/qunit.js": "ember-source/ember-testing/lib/adapters/qunit.js", - "ember-testing/lib/ext/application.js": "ember-source/ember-testing/lib/ext/application.js", - "ember-testing/lib/ext/rsvp.js": "ember-source/ember-testing/lib/ext/rsvp.js", - "ember-testing/lib/helpers.js": "ember-source/ember-testing/lib/helpers.js", - "ember-testing/lib/helpers/and_then.js": "ember-source/ember-testing/lib/helpers/and_then.js", - "ember-testing/lib/helpers/current_path.js": "ember-source/ember-testing/lib/helpers/current_path.js", - "ember-testing/lib/helpers/current_route_name.js": "ember-source/ember-testing/lib/helpers/current_route_name.js", - "ember-testing/lib/helpers/current_url.js": "ember-source/ember-testing/lib/helpers/current_url.js", - "ember-testing/lib/helpers/pause_test.js": "ember-source/ember-testing/lib/helpers/pause_test.js", - "ember-testing/lib/helpers/visit.js": "ember-source/ember-testing/lib/helpers/visit.js", - "ember-testing/lib/helpers/wait.js": "ember-source/ember-testing/lib/helpers/wait.js", - "ember-testing/lib/initializers.js": "ember-source/ember-testing/lib/initializers.js", "ember-testing/lib/public-api.js": "ember-source/ember-testing/lib/public-api.js", - "ember-testing/lib/setup_for_testing.js": "ember-source/ember-testing/lib/setup_for_testing.js", "ember-testing/lib/test.js": "ember-source/ember-testing/lib/test.js", "ember-testing/lib/test/adapter.js": "ember-source/ember-testing/lib/test/adapter.js", - "ember-testing/lib/test/helpers.js": "ember-source/ember-testing/lib/test/helpers.js", - "ember-testing/lib/test/on_inject_helpers.js": "ember-source/ember-testing/lib/test/on_inject_helpers.js", "ember-testing/lib/test/pending_requests.js": "ember-source/ember-testing/lib/test/pending_requests.js", - "ember-testing/lib/test/promise.js": "ember-source/ember-testing/lib/test/promise.js", - "ember-testing/lib/test/run.js": "ember-source/ember-testing/lib/test/run.js", "ember-testing/lib/test/waiters.js": "ember-source/ember-testing/lib/test/waiters.js", - "ember/barrel.js": "ember-source/ember/barrel.js", - "ember/index.js": "ember-source/ember/index.js", "ember/version.js": "ember-source/ember/version.js", "route-recognizer/index.js": "ember-source/route-recognizer/index.js", "router_js/index.js": "ember-source/router_js/index.js", @@ -384,4 +358,4 @@ } }, "packageManager": "pnpm@10.30.3" -} \ No newline at end of file +} diff --git a/packages/@ember/-internals/deprecations/index.ts b/packages/@ember/-internals/deprecations/index.ts index 89ad88ed625..b68b84b616e 100644 --- a/packages/@ember/-internals/deprecations/index.ts +++ b/packages/@ember/-internals/deprecations/index.ts @@ -112,16 +112,6 @@ export const DEPRECATIONS = { until: '7.0.0', url: 'https://deprecations.emberjs.com/id/importing-inject-from-ember-service', }), - DEPRECATE_AMD_BUNDLES: deprecation({ - for: 'ember-source', - id: 'using-amd-bundles', - since: { - available: '6.10.0', - enabled: '6.10.0', - }, - until: '7.0.0', - url: 'https://deprecations.emberjs.com/id/using-amd-bundles', - }), }; export function deprecateUntil(message: string, deprecation: DeprecationObject) { diff --git a/packages/@ember/-internals/environment/lib/env.ts b/packages/@ember/-internals/environment/lib/env.ts index 8bf539aef25..c0bde19655f 100644 --- a/packages/@ember/-internals/environment/lib/env.ts +++ b/packages/@ember/-internals/environment/lib/env.ts @@ -144,10 +144,6 @@ export const ENV = { */ _RERENDER_LOOP_LIMIT: 1000, - EMBER_LOAD_HOOKS: {} as { - [hook: string]: Function[]; - }, - FEATURES: {} as { [feature: string]: boolean; }, @@ -179,18 +175,6 @@ if (typeof EmberENV === 'object' && EmberENV !== null) { } } - // TODO this does not seem to be used by anything, - // can we remove it? do we need to deprecate it? - let { EMBER_LOAD_HOOKS } = EmberENV; - if (typeof EMBER_LOAD_HOOKS === 'object' && EMBER_LOAD_HOOKS !== null) { - for (let hookName in EMBER_LOAD_HOOKS) { - if (!Object.prototype.hasOwnProperty.call(EMBER_LOAD_HOOKS, hookName)) continue; - let hooks = EMBER_LOAD_HOOKS[hookName]; - if (Array.isArray(hooks)) { - ENV.EMBER_LOAD_HOOKS[hookName] = hooks.filter((hook) => typeof hook === 'function'); - } - } - } let { FEATURES } = EmberENV; if (typeof FEATURES === 'object' && FEATURES !== null) { for (let feature in FEATURES) { diff --git a/packages/@ember/-internals/glimmer/index.ts b/packages/@ember/-internals/glimmer/index.ts index 4cf8bd70367..1e47aa55bbd 100644 --- a/packages/@ember/-internals/glimmer/index.ts +++ b/packages/@ember/-internals/glimmer/index.ts @@ -497,4 +497,5 @@ export { setComponentManager, } from './lib/utils/managers'; export { isSerializationFirstNode } from './lib/utils/serialization-first-node-helpers'; +export { default as element } from './lib/helpers/element'; export { uniqueId } from './lib/helpers/unique-id'; diff --git a/packages/@ember/-internals/glimmer/lib/component-managers/mount.ts b/packages/@ember/-internals/glimmer/lib/component-managers/mount.ts index 1fa7a7c8e3c..77c8d793479 100644 --- a/packages/@ember/-internals/glimmer/lib/component-managers/mount.ts +++ b/packages/@ember/-internals/glimmer/lib/component-managers/mount.ts @@ -123,8 +123,7 @@ class MountManager getDebugCustomRenderTree( definition: EngineDefinitionState, state: EngineState, - args: CapturedArguments, - templateModuleName?: string + args: CapturedArguments ): CustomRenderNode[] { return [ { @@ -140,7 +139,6 @@ class MountManager type: 'route-template', name: 'application', args, - template: templateModuleName, }, ]; } diff --git a/packages/@ember/-internals/glimmer/lib/component-managers/outlet.ts b/packages/@ember/-internals/glimmer/lib/component-managers/outlet.ts index e39b60250a3..f140f5f34a5 100644 --- a/packages/@ember/-internals/glimmer/lib/component-managers/outlet.ts +++ b/packages/@ember/-internals/glimmer/lib/component-managers/outlet.ts @@ -131,7 +131,6 @@ class OutletComponentManager name: 'main', args: EMPTY_ARGS, instance: undefined, - template: undefined, }); if (state.engine) { @@ -141,7 +140,6 @@ class OutletComponentManager name: state.engine.mountPoint, args: EMPTY_ARGS, instance: state.engine.instance, - template: undefined, }); } diff --git a/packages/@ember/-internals/glimmer/lib/component-managers/route-template.ts b/packages/@ember/-internals/glimmer/lib/component-managers/route-template.ts index 10f291d7dfe..bfb6a4ba09b 100644 --- a/packages/@ember/-internals/glimmer/lib/component-managers/route-template.ts +++ b/packages/@ember/-internals/glimmer/lib/component-managers/route-template.ts @@ -28,7 +28,6 @@ interface RouteTemplateInstanceState { export interface RouteTemplateDefinitionState { name: string; - templateName: string; } const CAPABILITIES: InternalComponentCapabilities = { @@ -79,7 +78,7 @@ class RouteTemplateManager } getDebugCustomRenderTree( - { name, templateName }: RouteTemplateDefinitionState, + { name }: RouteTemplateDefinitionState, state: RouteTemplateInstanceState, args: CapturedArguments ): CustomRenderNode[] { @@ -90,7 +89,6 @@ class RouteTemplateManager name, args, instance: state.controller, - template: templateName, }, ]; } @@ -137,7 +135,7 @@ export class RouteTemplate implements ComponentDefinition< // outlet's name. Also, setting this overrides `getDebugName()` in that // message. Is that desirable? this.resolvedName = name; - this.state = { name, templateName: unwrapped.moduleName }; + this.state = { name }; this.compilable = unwrapped.asLayout(); } } diff --git a/packages/@ember/-internals/glimmer/lib/environment.ts b/packages/@ember/-internals/glimmer/lib/environment.ts index 5abd58c2bc6..2ebcbdea8e5 100644 --- a/packages/@ember/-internals/glimmer/lib/environment.ts +++ b/packages/@ember/-internals/glimmer/lib/environment.ts @@ -19,10 +19,6 @@ import toBool from './utils/to-bool'; // Setup global context setGlobalContext({ - FEATURES: { - DEFAULT_HELPER_MANAGER: true, - }, - scheduleRevalidate() { _backburner.ensureInstance(); }, diff --git a/packages/@ember/-internals/glimmer/lib/helpers/element.ts b/packages/@ember/-internals/glimmer/lib/helpers/element.ts new file mode 100644 index 00000000000..7c2aefec1a8 --- /dev/null +++ b/packages/@ember/-internals/glimmer/lib/helpers/element.ts @@ -0,0 +1,135 @@ +/** + @module @ember/helper +*/ + +import type { CapturedArguments, InternalComponentManager } from '@glimmer/interfaces'; +import { createComputeRef, valueForRef, NULL_REFERENCE } from '@glimmer/reference'; +import { setInternalComponentManager } from '@glimmer/manager'; +import { assert } from '@ember/debug'; +import { DEBUG } from '@glimmer/env'; +import { internalHelper } from './internal-helper'; + +// ============ Element Component (for string tag names) ============ +// Renders content wrapped in the specified HTML element, or just renders +// content without a wrapper for empty string. + +const ELEMENT_CAPABILITIES = { + createInstance: true, + wrapped: true, +}; + +class ElementComponentManager { + getCapabilities() { + return ELEMENT_CAPABILITIES; + } + + getDebugName(state: ElementComponentDefinition) { + return `(element "${state.tagName}")`; + } + + getSelf() { + return NULL_REFERENCE; + } + + getDestroyable() { + return null; + } + + didCreateElement() {} + + create(_owner: object, state: ElementComponentDefinition) { + // For empty string, return null so getTagName returns null (no wrapper element) + return state.tagName || null; + } + + getTagName(state: string | null) { + return state; + } + + didRenderLayout() {} + didUpdateLayout() {} + didCreate() {} + didUpdate() {} +} + +const ELEMENT_COMPONENT_MANAGER = new ElementComponentManager(); + +class ElementComponentDefinition { + constructor(public tagName: string) {} + + toString(): string { + return `(element "${this.tagName}")`; + } +} + +setInternalComponentManager( + ELEMENT_COMPONENT_MANAGER as unknown as InternalComponentManager, + ElementComponentDefinition.prototype +); + +// Cache component definitions per tag name to avoid creating duplicate definitions +const ELEMENT_DEFINITIONS = new Map(); + +function getElementDefinition(tagName: string): ElementComponentDefinition { + let definition = ELEMENT_DEFINITIONS.get(tagName); + if (definition === undefined) { + definition = new ElementComponentDefinition(tagName); + ELEMENT_DEFINITIONS.set(tagName, definition); + } + return definition; +} + +// ============ Element Helper ============ + +/** + The `element` helper lets you dynamically set the tag name of an element. + + ```handlebars + {{#let (element @tagName) as |Tag|}} + Hello + {{/let}} + ``` + + When `@tagName` is `"h1"`, this renders `

Hello

`. + + When `@tagName` is an empty string `""`, the block content is rendered without + a wrapping element. + + Passing `null`, `undefined`, or non-string values will throw an assertion error. + + Changing the tag name will tear down and recreate the element and its contents. + + @method element + @for Ember.Templates.helpers + @public +*/ +export default internalHelper(({ positional, named }: CapturedArguments) => { + return createComputeRef( + () => { + if (DEBUG) { + assert('The `element` helper takes a single positional argument', positional.length === 1); + assert( + 'The `element` helper does not take any named arguments', + Object.keys(named).length === 0 + ); + } + + let tagName = valueForRef(positional[0]!); + + if (DEBUG) { + assert( + `The argument passed to the \`element\` helper must be a string${ + tagName === null || tagName === undefined || typeof tagName === 'object' + ? '' + : ` (you passed \`${tagName}\`)` + }`, + typeof tagName === 'string' + ); + } + + return getElementDefinition(tagName as string); + }, + null, + 'element' + ); +}); diff --git a/packages/@ember/-internals/glimmer/tests/integration/application/debug-render-tree-test.ts b/packages/@ember/-internals/glimmer/tests/integration/application/debug-render-tree-test.ts index b255af4502c..ebec9f08f2d 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/application/debug-render-tree-test.ts +++ b/packages/@ember/-internals/glimmer/tests/integration/application/debug-render-tree-test.ts @@ -1,9 +1,4 @@ -import { - ApplicationTestCase, - ModuleBasedTestResolver, - moduleFor, - strip, -} from 'internal-test-helpers'; +import { ApplicationTestCase, ModuleBasedTestResolver, moduleFor } from 'internal-test-helpers'; import { ENV } from '@ember/-internals/environment'; import { Component, setComponentManager } from '@ember/-internals/glimmer'; @@ -18,8 +13,7 @@ import type { CapturedRenderNode } from '@glimmer/interfaces'; import { componentCapabilities, setComponentTemplate } from '@glimmer/manager'; import { templateOnlyComponent } from '@glimmer/runtime'; import type { SimpleElement, SimpleNode } from '@simple-dom/interface'; -import type { EmberPrecompileOptions } from 'ember-template-compiler'; -import { compile } from 'ember-template-compiler'; +import { precompileTemplate } from '@ember/template-compilation'; import { runTask } from 'internal-test-helpers/lib/run'; import templateOnly from '@ember/component/template-only'; @@ -31,10 +25,6 @@ interface CapturedBounds { function anyFunc() {} -function compileTemplate(templateSource: string, options: Partial) { - return compile(templateSource, options); -} - type Expected = T | ((actual: T) => boolean); function isExpectedFunc(expected: Expected): expected is (actual: T) => boolean { @@ -46,7 +36,6 @@ interface ExpectedRenderNode { name: CapturedRenderNode['name']; args: Expected; instance: Expected; - template: Expected; bounds: Expected; children: Expected | ExpectedRenderNode[]; } @@ -56,13 +45,34 @@ if (ENV._DEBUG_RENDER_TREE) { 'Application test: debug render tree', class extends ApplicationTestCase { async '@test routes'() { - this.addTemplate('index', 'Index'); - this.addTemplate('foo', 'Foo {{outlet}}'); - this.addTemplate('foo.index', 'index'); - this.addTemplate('foo.inner', '{{@model}}'); - this.addTemplate('bar', 'Bar {{outlet}}'); - this.addTemplate('bar.index', 'index'); - this.addTemplate('bar.inner', '{{@model}}'); + this.add( + 'template:index', + precompileTemplate('Index', { moduleName: 'my-app/templates/index.hbs' }) + ); + this.add( + 'template:foo', + precompileTemplate('Foo {{outlet}}', { moduleName: 'my-app/templates/foo.hbs' }) + ); + this.add( + 'template:foo.index', + precompileTemplate('index', { moduleName: 'my-app/templates/foo/index.hbs' }) + ); + this.add( + 'template:foo.inner', + precompileTemplate('{{@model}}', { moduleName: 'my-app/templates/foo/inner.hbs' }) + ); + this.add( + 'template:bar', + precompileTemplate('Bar {{outlet}}', { moduleName: 'my-app/templates/bar.hbs' }) + ); + this.add( + 'template:bar.index', + precompileTemplate('index', { moduleName: 'my-app/templates/bar/index.hbs' }) + ); + this.add( + 'template:bar.inner', + precompileTemplate('{{@model}}', { moduleName: 'my-app/templates/bar/inner.hbs' }) + ); this.router.map(function (this: any) { this.route('foo', function (this: any) { @@ -93,7 +103,6 @@ if (ENV._DEBUG_RENDER_TREE) { named: { controller: this.controllerFor('index'), model: undefined }, }, instance: this.controllerFor('index'), - template: 'my-app/templates/index.hbs', bounds: this.elementBounds(this.element!), children: [], }), @@ -110,7 +119,6 @@ if (ENV._DEBUG_RENDER_TREE) { named: { controller: this.controllerFor('foo'), model: undefined }, }, instance: this.controllerFor('foo'), - template: 'my-app/templates/foo.hbs', bounds: this.elementBounds(this.element!), children: [ this.outlet({ @@ -121,7 +129,6 @@ if (ENV._DEBUG_RENDER_TREE) { named: { controller: this.controllerFor('foo.index'), model: undefined }, }, instance: this.controllerFor('foo.index'), - template: 'my-app/templates/foo/index.hbs', bounds: this.nodeBounds(this.element!.lastChild), children: [], }), @@ -140,7 +147,6 @@ if (ENV._DEBUG_RENDER_TREE) { named: { controller: this.controllerFor('foo'), model: undefined }, }, instance: this.controllerFor('foo'), - template: 'my-app/templates/foo.hbs', bounds: this.elementBounds(this.element!), children: [ this.outlet({ @@ -151,7 +157,6 @@ if (ENV._DEBUG_RENDER_TREE) { named: { controller: this.controllerFor('foo.inner'), model: 'wow' }, }, instance: this.controllerFor('foo.inner'), - template: 'my-app/templates/foo/inner.hbs', bounds: this.nodeBounds(this.element!.lastChild), children: [], }), @@ -170,7 +175,6 @@ if (ENV._DEBUG_RENDER_TREE) { named: { controller: this.controllerFor('foo'), model: undefined }, }, instance: this.controllerFor('foo'), - template: 'my-app/templates/foo.hbs', bounds: this.elementBounds(this.element!), children: [ this.outlet({ @@ -181,7 +185,6 @@ if (ENV._DEBUG_RENDER_TREE) { named: { controller: this.controllerFor('foo.inner'), model: 'zomg' }, }, instance: this.controllerFor('foo.inner'), - template: 'my-app/templates/foo/inner.hbs', bounds: this.nodeBounds(this.element!.lastChild), children: [], }), @@ -191,16 +194,12 @@ if (ENV._DEBUG_RENDER_TREE) { } async '@test {{mount}}'() { - this.addTemplate( - 'application', - strip` -
{{mount "foo"}}
-
{{mount this.engineName}}
- {{#if this.showMore}} -
{{mount "foo" model=this.engineModel}}
-
{{mount this.engineName model=this.engineModel}}
- {{/if}} - ` + this.add( + 'template:application', + precompileTemplate( + '
{{mount "foo"}}
{{mount this.engineName}}
{{#if this.showMore}}
{{mount "foo" model=this.engineModel}}
{{mount this.engineName model=this.engineModel}}
{{/if}}', + { moduleName: 'my-app/templates/application.hbs' } + ) ); this.add( @@ -213,21 +212,14 @@ if (ENV._DEBUG_RENDER_TREE) { super.init(properties); this.register( 'template:application', - compileTemplate( - strip` - {{#if @model}} - - {{/if}} - `, - { - moduleName: 'foo/templates/application.hbs', - } - ) + precompileTemplate('{{#if @model}}{{/if}}', { + moduleName: 'foo/templates/application.hbs', + }) ); this.register( 'component:inspect-model', setComponentTemplate( - compileTemplate('{{@model}}', { + precompileTemplate('{{@model}}', { moduleName: 'foo/components/inspect-model.hbs', }), templateOnly() @@ -254,21 +246,14 @@ if (ENV._DEBUG_RENDER_TREE) { super.init(properties); this.register( 'template:application', - compileTemplate( - strip` - {{#if @model}} - - {{/if}} - `, - { - moduleName: 'bar/templates/application.hbs', - } - ) + precompileTemplate('{{#if @model}}{{/if}}', { + moduleName: 'bar/templates/application.hbs', + }) ); this.register( 'component:inspect-model', setComponentTemplate( - compileTemplate('{{@model}}', { + precompileTemplate('{{@model}}', { moduleName: 'bar/components/inspect-model.hbs', }), templateOnly() @@ -295,7 +280,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: {} }, instance: (instance: Record) => instance['isFooEngineInstance'] === true, - template: null, bounds: this.elementBounds(this.$('#static')[0]!), children: [ { @@ -304,7 +288,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: {} }, instance: (instance: object) => instance.toString() === '(generated application controller)', - template: 'foo/templates/application.hbs', bounds: this.elementBounds(this.$('#static')[0]!), children: [], }, @@ -323,7 +306,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: {} }, instance: (instance: Record) => instance['isFooEngineInstance'] === true, - template: null, bounds: this.elementBounds(this.$('#static')[0]!), children: [ { @@ -332,7 +314,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: {} }, instance: (instance: object) => instance.toString() === '(generated application controller)', - template: 'foo/templates/application.hbs', bounds: this.elementBounds(this.$('#static')[0]!), children: [], }, @@ -344,7 +325,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: {} }, instance: (instance: Record) => instance['isBarEngineInstance'] === true, - template: null, bounds: this.elementBounds(this.$('#dynamic')[0]!), children: [ { @@ -353,7 +333,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: {} }, instance: (instance: object) => instance.toString() === '(generated application controller)', - template: 'bar/templates/application.hbs', bounds: this.elementBounds(this.$('#dynamic')[0]!), children: [], }, @@ -372,7 +351,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: {} }, instance: (instance: Record) => instance['isFooEngineInstance'] === true, - template: null, bounds: this.elementBounds(this.$('#static')[0]!), children: [ { @@ -381,7 +359,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: {} }, instance: (instance: object) => instance.toString() === '(generated application controller)', - template: 'foo/templates/application.hbs', bounds: this.elementBounds(this.$('#static')[0]!), children: [], }, @@ -409,7 +386,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: {} }, instance: (instance: Record) => instance['isFooEngineInstance'] === true, - template: null, bounds: this.elementBounds(this.$('#static')[0]!), children: [ { @@ -418,7 +394,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: {} }, instance: (instance: object) => instance.toString() === '(generated application controller)', - template: 'foo/templates/application.hbs', bounds: this.elementBounds(this.$('#static')[0]!), children: [], }, @@ -430,7 +405,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: { model } }, instance: (instance: Record) => instance['isFooEngineInstance'] === true, - template: null, bounds: this.elementBounds(this.$('#static-with-model')[0]!), children: [ { @@ -439,7 +413,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: { model } }, instance: (instance: object) => instance.toString() === '(generated application controller)', - template: 'foo/templates/application.hbs', bounds: this.elementBounds(this.$('#static-with-model')[0]!), children: [ { @@ -447,7 +420,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'inspect-model', args: { positional: [], named: { model } }, instance: null, - template: 'foo/components/inspect-model.hbs', bounds: this.nodeBounds(this.$('#static-with-model')[0]!.lastChild), children: [], }, @@ -468,7 +440,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: {} }, instance: (instance: Record) => instance['isFooEngineInstance'] === true, - template: null, bounds: this.elementBounds(this.$('#static')[0]!), children: [ { @@ -477,7 +448,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: {} }, instance: (instance: object) => instance.toString() === '(generated application controller)', - template: 'foo/templates/application.hbs', bounds: this.elementBounds(this.$('#static')[0]!), children: [], }, @@ -489,7 +459,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: {} }, instance: (instance: Record) => instance['isBarEngineInstance'] === true, - template: null, bounds: this.elementBounds(this.$('#dynamic')[0]!), children: [ { @@ -498,7 +467,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: {} }, instance: (instance: object) => instance.toString() === '(generated application controller)', - template: 'bar/templates/application.hbs', bounds: this.elementBounds(this.$('#dynamic')[0]!), children: [], }, @@ -510,7 +478,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: { model } }, instance: (instance: Record) => instance['isFooEngineInstance'] === true, - template: null, bounds: this.elementBounds(this.$('#static-with-model')[0]!), children: [ { @@ -520,14 +487,12 @@ if (ENV._DEBUG_RENDER_TREE) { instance: (instance: object) => instance.toString() === '(generated application controller)', bounds: this.elementBounds(this.$('#static-with-model')[0]!), - template: 'foo/templates/application.hbs', children: [ { type: 'component', name: 'inspect-model', args: { positional: [], named: { model } }, instance: null, - template: 'foo/components/inspect-model.hbs', bounds: this.nodeBounds(this.$('#static-with-model')[0]!.lastChild), children: [], }, @@ -541,7 +506,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: { model } }, instance: (instance: Record) => instance['isBarEngineInstance'] === true, - template: null, bounds: this.elementBounds(this.$('#dynamic-with-model')[0]!), children: [ { @@ -550,7 +514,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: { model } }, instance: (instance: object) => instance.toString() === '(generated application controller)', - template: 'bar/templates/application.hbs', bounds: this.elementBounds(this.$('#dynamic-with-model')[0]!), children: [ { @@ -558,7 +521,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'inspect-model', args: { positional: [], named: { model } }, instance: null, - template: 'bar/components/inspect-model.hbs', bounds: this.nodeBounds(this.$('#dynamic-with-model')[0]!.lastChild), children: [], }, @@ -582,7 +544,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: {} }, instance: (instance: Record) => instance['isFooEngineInstance'] === true, - template: null, bounds: this.elementBounds(this.$('#static')[0]!), children: [ { @@ -591,7 +552,6 @@ if (ENV._DEBUG_RENDER_TREE) { args: { positional: [], named: {} }, instance: (instance: object) => instance.toString() === '(generated application controller)', - template: 'foo/templates/application.hbs', bounds: this.elementBounds(this.$('#static')[0]!), children: [], }, @@ -601,7 +561,10 @@ if (ENV._DEBUG_RENDER_TREE) { } async '@test routable engine'() { - this.addTemplate('index', 'Index'); + this.add( + 'template:index', + precompileTemplate('Index', { moduleName: 'my-app/templates/index.hbs' }) + ); let instance: EngineInstance; @@ -615,29 +578,19 @@ if (ENV._DEBUG_RENDER_TREE) { super.init(properties); this.register( 'template:application', - compileTemplate( - strip` - {{outlet}} - - {{#if this.message}} - - {{/if}} - `, - { - moduleName: 'foo/templates/application.hbs', - } + precompileTemplate( + '{{outlet}}{{#if this.message}}{{/if}}', + { moduleName: 'foo/templates/application.hbs' } ) ); this.register( 'template:index', - compileTemplate('Foo', { - moduleName: 'foo/templates/index.hbs', - }) + precompileTemplate('Foo', { moduleName: 'foo/templates/index.hbs' }) ); this.register( 'component:hello', setComponentTemplate( - compileTemplate('Hello {{@message}}', { + precompileTemplate('Hello {{@message}}', { moduleName: 'foo/components/hello.hbs', }), templateOnlyComponent() @@ -668,7 +621,6 @@ if (ENV._DEBUG_RENDER_TREE) { named: { controller: this.controllerFor('index'), model: undefined }, }, instance: this.controllerFor('index'), - template: 'my-app/templates/index.hbs', bounds: this.elementBounds(this.element!), children: [], }), @@ -682,7 +634,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'foo', args: { positional: [], named: {} }, instance: instance!, - template: null, bounds: this.elementBounds(this.element!), children: [ { @@ -696,7 +647,6 @@ if (ENV._DEBUG_RENDER_TREE) { }, }, instance: instance!.lookup('controller:application'), - template: 'foo/templates/application.hbs', bounds: this.elementBounds(this.element!), children: [ this.outlet({ @@ -707,7 +657,6 @@ if (ENV._DEBUG_RENDER_TREE) { named: { controller: instance!.lookup('controller:index'), model: undefined }, }, instance: instance!.lookup('controller:index'), - template: 'foo/templates/index.hbs', bounds: this.nodeBounds(this.element!.firstChild), children: [], }), @@ -729,7 +678,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'foo', args: { positional: [], named: {} }, instance: instance!, - template: null, bounds: this.elementBounds(this.element!), children: [ { @@ -743,7 +691,6 @@ if (ENV._DEBUG_RENDER_TREE) { }, }, instance: instance!.lookup('controller:application'), - template: 'foo/templates/application.hbs', bounds: this.elementBounds(this.element!), children: [ this.outlet({ @@ -754,7 +701,6 @@ if (ENV._DEBUG_RENDER_TREE) { named: { controller: instance!.lookup('controller:index'), model: undefined }, }, instance: instance!.lookup('controller:index'), - template: 'foo/templates/index.hbs', bounds: this.nodeBounds(this.element!.firstChild), children: [], }), @@ -763,7 +709,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello', args: { positional: [], named: { message: 'World' } }, instance: null, - template: 'foo/components/hello.hbs', bounds: this.nodeBounds(this.element!.lastChild), children: [], }, @@ -785,7 +730,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'foo', args: { positional: [], named: {} }, instance: instance!, - template: null, bounds: this.elementBounds(this.element!), children: [ { @@ -799,7 +743,6 @@ if (ENV._DEBUG_RENDER_TREE) { }, }, instance: instance!.lookup('controller:application'), - template: 'foo/templates/application.hbs', bounds: this.elementBounds(this.element!), children: [ this.outlet({ @@ -810,7 +753,6 @@ if (ENV._DEBUG_RENDER_TREE) { named: { controller: instance!.lookup('controller:index'), model: undefined }, }, instance: instance!.lookup('controller:index'), - template: 'foo/templates/index.hbs', bounds: this.nodeBounds(this.element!.firstChild), children: [], }), @@ -831,7 +773,6 @@ if (ENV._DEBUG_RENDER_TREE) { named: { controller: this.controllerFor('index'), model: undefined }, }, instance: this.controllerFor('index'), - template: 'my-app/templates/index.hbs', bounds: this.elementBounds(this.element!), children: [], }), @@ -839,21 +780,18 @@ if (ENV._DEBUG_RENDER_TREE) { } async [`@test template-only components`]() { - this.addTemplate( - 'application', - strip` - - - {{#if this.showSecond}} - - {{/if}} - ` + this.add( + 'template:application', + precompileTemplate( + '{{#if this.showSecond}}{{/if}}', + { moduleName: 'my-app/templates/application.hbs' } + ) ); - this.addComponent('hello-world', { - ComponentClass: null, - template: '{{@name}}', - }); + this.add( + 'component:hello-world', + setComponentTemplate(precompileTemplate('{{@name}}'), templateOnly()) + ); await this.visit('/'); @@ -863,7 +801,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'first' } }, instance: null, - template: '(unknown template module)', bounds: this.nodeBounds(this.element!.firstChild), children: [], }, @@ -879,7 +816,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'first' } }, instance: null, - template: '(unknown template module)', bounds: this.nodeBounds(this.element!.firstChild), children: [], }, @@ -888,7 +824,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'second' } }, instance: null, - template: '(unknown template module)', bounds: this.nodeBounds(this.element!.lastChild), children: [], }, @@ -904,7 +839,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'first' } }, instance: null, - template: '(unknown template module)', bounds: this.nodeBounds(this.element!.firstChild), children: [], }, @@ -912,21 +846,18 @@ if (ENV._DEBUG_RENDER_TREE) { } async '@feature(EMBER_GLIMMER_SET_COMPONENT_TEMPLATE) templateOnlyComponent()'() { - this.addTemplate( - 'application', - strip` - - - {{#if this.showSecond}} - - {{/if}} - ` + this.add( + 'template:application', + precompileTemplate( + '{{#if this.showSecond}}{{/if}}', + { moduleName: 'my-app/templates/application.hbs' } + ) ); - this.addComponent('hello-world', { - ComponentClass: templateOnlyComponent(), - template: '{{@name}}', - }); + this.add( + 'component:hello-world', + setComponentTemplate(precompileTemplate('{{@name}}'), templateOnlyComponent()) + ); await this.visit('/'); @@ -936,7 +867,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'first' } }, instance: null, - template: '(unknown template module)', bounds: this.nodeBounds(this.element!.firstChild), children: [], }, @@ -952,7 +882,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'first' } }, instance: null, - template: '(unknown template module)', bounds: this.nodeBounds(this.element!.firstChild), children: [], }, @@ -961,7 +890,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'second' } }, instance: null, - template: '(unknown template module)', bounds: this.nodeBounds(this.element!.lastChild), children: [], }, @@ -977,7 +905,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'first' } }, instance: null, - template: '(unknown template module)', bounds: this.nodeBounds(this.element!.firstChild), children: [], }, @@ -985,23 +912,21 @@ if (ENV._DEBUG_RENDER_TREE) { } async '@feature(EMBER_GLIMMER_SET_COMPONENT_TEMPLATE) templateOnlyComponent() + setComponentTemplate()'() { - this.addTemplate( - 'application', - strip` - - - {{#if this.showSecond}} - - {{/if}} - ` + this.add( + 'template:application', + precompileTemplate( + '{{#if this.showSecond}}{{/if}}', + { moduleName: 'my-app/templates/application.hbs' } + ) ); - this.addComponent('hello-world', { - ComponentClass: setComponentTemplate( - compileTemplate('{{@name}}', { moduleName: 'my-app/components/hello-world.hbs' }), + this.add( + 'component:hello-world', + setComponentTemplate( + precompileTemplate('{{@name}}', { moduleName: 'my-app/components/hello-world.hbs' }), templateOnlyComponent('my-app/components/hello-world', 'HelloWorld') - ), - }); + ) + ); await this.visit('/'); @@ -1011,7 +936,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'first' } }, instance: null, - template: 'my-app/components/hello-world.hbs', bounds: this.nodeBounds(this.element!.firstChild), children: [], }, @@ -1027,7 +951,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'first' } }, instance: null, - template: 'my-app/components/hello-world.hbs', bounds: this.nodeBounds(this.element!.firstChild), children: [], }, @@ -1036,7 +959,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'second' } }, instance: null, - template: 'my-app/components/hello-world.hbs', bounds: this.nodeBounds(this.element!.lastChild), children: [], }, @@ -1052,7 +974,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'first' } }, instance: null, - template: 'my-app/components/hello-world.hbs', bounds: this.nodeBounds(this.element!.firstChild), children: [], }, @@ -1060,21 +981,18 @@ if (ENV._DEBUG_RENDER_TREE) { } async '@test classic components'() { - this.addTemplate( - 'application', - strip` - - - {{#if this.showSecond}} - - {{/if}} - ` + this.add( + 'template:application', + precompileTemplate( + '{{#if this.showSecond}}{{/if}}', + { moduleName: 'my-app/templates/application.hbs' } + ) ); - this.addComponent('hello-world', { - ComponentClass: class extends Component {}, - template: 'Hello World', - }); + this.add( + 'component:hello-world', + setComponentTemplate(precompileTemplate('Hello World'), class extends Component {}) + ); await this.visit('/'); @@ -1084,7 +1002,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'first' } }, instance: (instance: Record) => instance['name'] === 'first', - template: '(unknown template module)', bounds: this.nodeBounds(this.element!.firstChild), children: [], }, @@ -1100,7 +1017,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'first' } }, instance: (instance: Record) => instance['name'] === 'first', - template: '(unknown template module)', bounds: this.nodeBounds(this.element!.firstChild), children: [], }, @@ -1109,7 +1025,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'second' } }, instance: (instance: Record) => instance['name'] === 'second', - template: '(unknown template module)', bounds: this.nodeBounds(this.element!.lastChild), children: [], }, @@ -1125,7 +1040,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'first' } }, instance: (instance: Record) => instance['name'] === 'first', - template: '(unknown template module)', bounds: this.nodeBounds(this.element!.firstChild), children: [], }, @@ -1133,33 +1047,33 @@ if (ENV._DEBUG_RENDER_TREE) { } async '@test custom components'() { - this.addTemplate( - 'application', - strip` - - - {{#if this.showSecond}} - - {{/if}} - ` + this.add( + 'template:application', + precompileTemplate( + '{{#if this.showSecond}}{{/if}}', + { moduleName: 'my-app/templates/application.hbs' } + ) ); - this.addComponent('hello-world', { - ComponentClass: setComponentManager((_owner) => { - return { - capabilities: componentCapabilities('3.13', {}), - - createComponent(_, { named: { name } }) { - return { name }; - }, + this.add( + 'component:hello-world', + setComponentTemplate( + precompileTemplate('Hello World'), + setComponentManager((_owner) => { + return { + capabilities: componentCapabilities('3.13', {}), + + createComponent(_, { named: { name } }) { + return { name }; + }, - getContext(instances) { - return instances; - }, - }; - }, {}), - template: 'Hello World', - }); + getContext(instances) { + return instances; + }, + }; + }, {}) + ) + ); await this.visit('/'); @@ -1169,7 +1083,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'first' } }, instance: (instance: Record) => instance['name'] === 'first', - template: '(unknown template module)', bounds: this.nodeBounds(this.element!.firstChild), children: [], }, @@ -1185,7 +1098,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'first' } }, instance: (instance: Record) => instance['name'] === 'first', - template: '(unknown template module)', bounds: this.nodeBounds(this.element!.firstChild), children: [], }, @@ -1194,7 +1106,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'second' } }, instance: (instance: Record) => instance['name'] === 'second', - template: '(unknown template module)', bounds: this.nodeBounds(this.element!.lastChild), children: [], }, @@ -1210,7 +1121,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'hello-world', args: { positional: [], named: { name: 'first' } }, instance: (instance: Record) => instance['name'] === 'first', - template: '(unknown template module)', bounds: this.nodeBounds(this.element!.firstChild), children: [], }, @@ -1218,15 +1128,12 @@ if (ENV._DEBUG_RENDER_TREE) { } async '@test components'() { - this.addTemplate( - 'application', - strip` - - - {{#if this.showSecond}} - - {{/if}} - ` + this.add( + 'template:application', + precompileTemplate( + '{{#if this.showSecond}}{{/if}}', + { moduleName: 'my-app/templates/application.hbs' } + ) ); await this.visit('/'); @@ -1241,7 +1148,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'on', instance: null, args: { named: {}, positional: ['change', anyFunc] }, - template: null, bounds: this.nodeBounds(this.element!.firstChild), children: [], }, @@ -1249,7 +1155,6 @@ if (ENV._DEBUG_RENDER_TREE) { type: 'modifier', name: 'on', instance: null, - template: null, args: { named: {}, positional: ['input', anyFunc] }, bounds: this.nodeBounds(this.element!.firstChild), children: [], @@ -1258,7 +1163,6 @@ if (ENV._DEBUG_RENDER_TREE) { type: 'modifier', name: 'on', instance: null, - template: null, args: { named: {}, positional: ['keyup', anyFunc] }, bounds: this.nodeBounds(this.element!.firstChild), children: [], @@ -1267,7 +1171,6 @@ if (ENV._DEBUG_RENDER_TREE) { type: 'modifier', name: 'on', instance: null, - template: null, args: { named: {}, positional: ['paste', anyFunc] }, bounds: this.nodeBounds(this.element!.firstChild), children: [], @@ -1276,7 +1179,6 @@ if (ENV._DEBUG_RENDER_TREE) { type: 'modifier', name: 'on', instance: null, - template: null, args: { named: {}, positional: ['cut', anyFunc] }, bounds: this.nodeBounds(this.element!.firstChild), children: [], @@ -1289,7 +1191,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'input', args: { positional: [], named: { type: 'text', value: 'first' } }, instance: (instance: object) => inputToString.test(instance.toString()), - template: 'packages/@ember/-internals/glimmer/lib/templates/input.hbs', bounds: this.nodeBounds(this.element!.firstChild), children: [...firstModifiers], }, @@ -1303,7 +1204,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'on', instance: null, args: { named: {}, positional: ['change', anyFunc] }, - template: null, bounds: this.nodeBounds(this.element!.lastChild), children: [], }, @@ -1311,7 +1211,6 @@ if (ENV._DEBUG_RENDER_TREE) { type: 'modifier', name: 'on', instance: null, - template: null, args: { named: {}, positional: ['input', anyFunc] }, bounds: this.nodeBounds(this.element!.lastChild), children: [], @@ -1320,7 +1219,6 @@ if (ENV._DEBUG_RENDER_TREE) { type: 'modifier', name: 'on', instance: null, - template: null, args: { named: {}, positional: ['keyup', anyFunc] }, bounds: this.nodeBounds(this.element!.lastChild), children: [], @@ -1329,7 +1227,6 @@ if (ENV._DEBUG_RENDER_TREE) { type: 'modifier', name: 'on', instance: null, - template: null, args: { named: {}, positional: ['paste', anyFunc] }, bounds: this.nodeBounds(this.element!.lastChild), children: [], @@ -1338,7 +1235,6 @@ if (ENV._DEBUG_RENDER_TREE) { type: 'modifier', name: 'on', instance: null, - template: null, args: { named: {}, positional: ['cut', anyFunc] }, bounds: this.nodeBounds(this.element!.lastChild), children: [], @@ -1351,7 +1247,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'input', args: { positional: [], named: { type: 'text', value: 'first' } }, instance: (instance: object) => inputToString.test(instance.toString()), - template: 'packages/@ember/-internals/glimmer/lib/templates/input.hbs', bounds: this.nodeBounds(this.element!.firstChild), children: [...firstModifiers], }, @@ -1360,7 +1255,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'input', args: { positional: [], named: { type: 'checkbox', checked: false } }, instance: (instance: object) => inputToString.test(instance.toString()), - template: 'packages/@ember/-internals/glimmer/lib/templates/input.hbs', bounds: this.nodeBounds(this.element!.lastChild), children: [...secondModifiers], }, @@ -1374,7 +1268,6 @@ if (ENV._DEBUG_RENDER_TREE) { name: 'input', args: { positional: [], named: { type: 'text', value: 'first' } }, instance: (instance: object) => inputToString.test(instance.toString()), - template: 'packages/@ember/-internals/glimmer/lib/templates/input.hbs', bounds: this.nodeBounds(this.element!.firstChild), children: [...firstModifiers], }, @@ -1382,15 +1275,12 @@ if (ENV._DEBUG_RENDER_TREE) { } async '@test