diff --git a/.gitignore b/.gitignore index f4c9abe3..51477622 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ bower_components/ node_modules/ # misc +.prototools .env* .pnp* .sass-cache diff --git a/addon/addon/build-waiter.ts b/addon/addon/build-waiter.ts index f7cbedab..19170cff 100644 --- a/addon/addon/build-waiter.ts +++ b/addon/addon/build-waiter.ts @@ -1,12 +1,12 @@ import { Primitive, TestWaiter, TestWaiterDebugInfo, WaiterName } from './'; -import { DEBUG } from '@glimmer/env'; +import { macroCondition, isDevelopingApp } from '@embroider/macros'; import { warn } from '@ember/debug'; import Token from './token'; import { register } from './waiter-manager'; const WAITER_NAME_PATTERN = /^[^:]*:?.*/; -let WAITER_NAMES = DEBUG ? new Set() : undefined; +let WAITER_NAMES = macroCondition(isDevelopingApp()) ? new Set() : undefined; export function _resetWaiterNames() { WAITER_NAMES = new Set(); @@ -128,7 +128,7 @@ class NoopTestWaiter implements TestWaiter { /** * Builds and returns a test waiter. The type of the * returned waiter is dependent on whether the app or - * addon is in `DEBUG` mode or not. + * addon is in `isDevopingApp()` mode or not. * * @public * @@ -140,7 +140,7 @@ class NoopTestWaiter implements TestWaiter { * import Component from '@ember/component'; * import { buildWaiter } from '@ember/test-waiters'; * - * if (DEBUG) { + * if (macroCondition(isDevelopingApp())) { * let waiter = buildWaiter('friend-waiter'); * } * @@ -155,14 +155,14 @@ class NoopTestWaiter implements TestWaiter { * } */ export default function buildWaiter(name: string): TestWaiter { - if (DEBUG) { + if (macroCondition(isDevelopingApp())) { warn(`The waiter name '${name}' is already in use`, !WAITER_NAMES!.has(name), { id: '@ember/test-waiters.duplicate-waiter-name', }); WAITER_NAMES!.add(name); } - if (!DEBUG) { + if (macroCondition(!isDevelopingApp())) { return new NoopTestWaiter(name); } else { warn( diff --git a/addon/addon/wait-for-promise.ts b/addon/addon/wait-for-promise.ts index 1e3ecc1e..f8f21673 100644 --- a/addon/addon/wait-for-promise.ts +++ b/addon/addon/wait-for-promise.ts @@ -1,4 +1,4 @@ -import { DEBUG } from '@glimmer/env'; +import { macroCondition, isDevelopingApp } from '@embroider/macros'; import buildWaiter from './build-waiter'; import { PromiseType, Thenable } from './types'; @@ -32,7 +32,7 @@ export default function waitForPromise>( ): KindOfPromise { let result = promise; - if (DEBUG) { + if (macroCondition(isDevelopingApp())) { PROMISE_WAITER.beginAsync(promise, label); result = (promise as unknown as Thenable).then( diff --git a/addon/addon/wait-for.ts b/addon/addon/wait-for.ts index e6372c18..967b58a4 100644 --- a/addon/addon/wait-for.ts +++ b/addon/addon/wait-for.ts @@ -1,4 +1,4 @@ -import { DEBUG } from '@glimmer/env'; +import { macroCondition, isDevelopingApp } from '@embroider/macros'; import waitForPromise from './wait-for-promise'; import buildWaiter from './build-waiter'; import { PromiseType } from './types'; @@ -75,7 +75,7 @@ export default function waitFor( } else { const [, , descriptor, label] = args as DecoratorArguments; - if (!DEBUG) { + if (macroCondition(!isDevelopingApp())) { return descriptor; } @@ -88,7 +88,7 @@ export default function waitFor( } function wrapFunction(fn: Function, label?: string) { - if (!DEBUG) { + if (macroCondition(!isDevelopingApp())) { return fn; } diff --git a/addon/package.json b/addon/package.json index 14a35a67..c62d9713 100644 --- a/addon/package.json +++ b/addon/package.json @@ -31,7 +31,7 @@ }, "dependencies": { "@babel/core": "^7.26.0", - "@glimmer/env": "^0.1.7", + "@embroider/macros": "^1.16.9", "ember-auto-import": "^2.10.0", "ember-cli-babel": "^8.2.0", "ember-cli-typescript": "^5.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ef611365..8917e75a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,9 +26,9 @@ importers: '@babel/core': specifier: ^7.26.0 version: 7.26.0(supports-color@8.1.1) - '@glimmer/env': - specifier: ^0.1.7 - version: 0.1.7 + '@embroider/macros': + specifier: ^1.16.9 + version: 1.16.9(@glint/template@1.5.0) ember-auto-import: specifier: ^2.10.0 version: 2.10.0(@glint/template@1.5.0)(webpack@5.96.1) @@ -178,6 +178,9 @@ importers: '@embroider/core': specifier: ^3.4.19 version: 3.4.19(@glint/template@1.5.0) + '@embroider/macros': + specifier: ^1.16.9 + version: 1.16.9(@glint/template@1.5.0) '@embroider/webpack': specifier: ^4.0.8 version: 4.0.8(@embroider/core@3.4.19(@glint/template@1.5.0))(webpack@5.96.1) @@ -187,9 +190,6 @@ importers: '@glimmer/component': specifier: ^1.1.2 version: 1.1.2(@babel/core@7.26.0) - '@glimmer/env': - specifier: ^0.1.7 - version: 0.1.7 '@glimmer/tracking': specifier: ^1.1.2 version: 1.1.2 @@ -1801,24 +1801,6 @@ packages: '@embroider/core': ^3.4.0 webpack: ^5 - '@embroider/macros@1.13.2': - resolution: {integrity: sha512-AUgJ71xG8kjuTx8XB1AQNBiebJuXRfhcHr318dCwnQz9VRXdYSnEEqf38XRvGYIoCvIyn/3c72LrSwzaJqknOA==} - engines: {node: 12.* || 14.* || >= 16} - peerDependencies: - '@glint/template': ^1.0.0 - peerDependenciesMeta: - '@glint/template': - optional: true - - '@embroider/macros@1.13.3': - resolution: {integrity: sha512-JUC1aHRLIN2LNy1l+gz7gWkw9JmnsE20GL3LduCzNvCAnEQpMTJhW5BUbEWqdCnAWBPte/M2ofckqBXyTZioTQ==} - engines: {node: 12.* || 14.* || >= 16} - peerDependencies: - '@glint/template': ^1.0.0 - peerDependenciesMeta: - '@glint/template': - optional: true - '@embroider/macros@1.16.9': resolution: {integrity: sha512-AUrmHQdixczIU3ouv/+HzWxwYVsw/NwssZxAQnXfBDJ3d3/CRtAvGRu3JhY6OT3AAPFwfa2WT66tB5jeAa7r5g==} engines: {node: 12.* || 14.* || >= 16} @@ -2838,10 +2820,6 @@ packages: resolution: {integrity: sha512-CtWYYHU/MgK88rxMrLfkD356dApswtR/kWZ/c6JifG1m10e7tBBrs/366dFzWMAoqYmG5/JSh+94tUSpIwh+ag==} engines: {node: '>= 12.*'} - babel-import-util@2.0.1: - resolution: {integrity: sha512-N1ZfNprtf/37x0R05J0QCW/9pCAcuI+bjZIK9tlu0JEkwEST7ssdD++gxHRbD58AiG5QE5OuNYhRoEFsc1wESw==} - engines: {node: '>= 12.*'} - babel-import-util@2.1.1: resolution: {integrity: sha512-3qBQWRjzP9NreSH/YrOEU1Lj5F60+pWSLP0kIdCWxjFHH7pX2YPHIxQ67el4gnMNfYoDxSDGcT0zpVlZ+gVtQA==} engines: {node: '>= 12.*'} @@ -6990,10 +6968,6 @@ packages: resolution: {integrity: sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==} hasBin: true - resolve@1.22.6: - resolution: {integrity: sha512-njhxM7mV12JfufShqGy3Rz8j11RPdLy4xi15UurGJeoHLfJpVXKdh3ueuOqbYUcDZnffr6X739JBo5LzyahEsw==} - hasBin: true - resolve@1.22.8: resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true @@ -8334,7 +8308,7 @@ snapshots: '@babel/traverse': 7.23.5 debug: 4.3.7(supports-color@8.1.1) lodash.debounce: 4.0.8 - resolve: 1.22.6 + resolve: 1.22.8 semver: 6.3.1 transitivePeerDependencies: - supports-color @@ -9780,7 +9754,7 @@ snapshots: '@ember/test-helpers@3.2.0(@glint/template@1.5.0)(ember-source@5.3.0(@babel/core@7.26.0)(@glimmer/component@1.1.2(@babel/core@7.26.0))(@glint/template@1.5.0)(rsvp@4.8.5)(webpack@5.96.1))(webpack@5.96.1)': dependencies: '@ember/test-waiters': 3.1.0 - '@embroider/macros': 1.13.2(@glint/template@1.5.0) + '@embroider/macros': 1.16.9(@glint/template@1.5.0) '@simple-dom/interface': 1.4.0 broccoli-debug: 0.6.5 broccoli-funnel: 3.0.8 @@ -9919,36 +9893,6 @@ snapshots: '@embroider/core': 3.4.19(@glint/template@1.5.0) webpack: 5.96.1 - '@embroider/macros@1.13.2(@glint/template@1.5.0)': - dependencies: - '@embroider/shared-internals': 2.5.0 - assert-never: 1.3.0 - babel-import-util: 2.1.1 - ember-cli-babel: 7.26.11 - find-up: 5.0.0 - lodash: 4.17.21 - resolve: 1.22.8 - semver: 7.6.3 - optionalDependencies: - '@glint/template': 1.5.0 - transitivePeerDependencies: - - supports-color - - '@embroider/macros@1.13.3(@glint/template@1.5.0)': - dependencies: - '@embroider/shared-internals': 2.5.1 - assert-never: 1.2.1 - babel-import-util: 2.0.1 - ember-cli-babel: 7.26.11 - find-up: 5.0.0 - lodash: 4.17.21 - resolve: 1.22.8 - semver: 7.6.0 - optionalDependencies: - '@glint/template': 1.5.0 - transitivePeerDependencies: - - supports-color - '@embroider/macros@1.16.9(@glint/template@1.5.0)': dependencies: '@embroider/shared-internals': 2.8.1(supports-color@8.1.1) @@ -9966,28 +9910,28 @@ snapshots: '@embroider/shared-internals@2.5.0': dependencies: - babel-import-util: 2.0.1 + babel-import-util: 2.1.1 debug: 4.3.7(supports-color@8.1.1) ember-rfc176-data: 0.3.17 fs-extra: 9.1.0 js-string-escape: 1.0.1 lodash: 4.17.21 resolve-package-path: 4.0.3 - semver: 7.6.0 + semver: 7.6.3 typescript-memoize: 1.1.0 transitivePeerDependencies: - supports-color '@embroider/shared-internals@2.5.1': dependencies: - babel-import-util: 2.0.1 + babel-import-util: 2.1.1 debug: 4.3.7(supports-color@8.1.1) ember-rfc176-data: 0.3.18 fs-extra: 9.1.0 js-string-escape: 1.0.1 lodash: 4.17.21 resolve-package-path: 4.0.3 - semver: 7.6.0 + semver: 7.6.3 typescript-memoize: 1.1.1 transitivePeerDependencies: - supports-color @@ -10502,7 +10446,7 @@ snapshots: '@npmcli/fs@1.1.1': dependencies: '@gar/promisify': 1.1.3 - semver: 7.6.0 + semver: 7.6.3 '@npmcli/git@5.0.4': dependencies: @@ -11340,8 +11284,6 @@ snapshots: babel-import-util@0.2.0: {} - babel-import-util@2.0.1: {} - babel-import-util@2.1.1: {} babel-import-util@3.0.0: {} @@ -12393,7 +12335,7 @@ snapshots: builtins@5.0.1: dependencies: - semver: 7.6.0 + semver: 7.6.3 bytes@1.0.0: {} @@ -13154,7 +13096,7 @@ snapshots: hash-for-dep: 1.5.1 heimdalljs-logger: 0.1.10 json-stable-stringify: 1.0.1 - semver: 7.6.0 + semver: 7.6.3 silent-error: 1.1.1 strip-bom: 4.0.0 walk-sync: 2.2.0 @@ -13566,7 +13508,7 @@ snapshots: dependencies: '@ember/test-helpers': 3.2.0(@glint/template@1.5.0)(ember-source@5.3.0(@babel/core@7.26.0)(@glimmer/component@1.1.2(@babel/core@7.26.0))(@glint/template@1.5.0)(rsvp@4.8.5)(webpack@5.96.1))(webpack@5.96.1) '@embroider/addon-shim': 1.8.6 - '@embroider/macros': 1.13.2(@glint/template@1.5.0) + '@embroider/macros': 1.16.9(@glint/template@1.5.0) ember-cli-test-loader: 3.1.0 ember-source: 5.3.0(@babel/core@7.26.0)(@glimmer/component@1.1.2(@babel/core@7.26.0))(@glint/template@1.5.0)(rsvp@4.8.5)(webpack@5.96.1) qunit: 2.20.0 @@ -13578,7 +13520,7 @@ snapshots: dependencies: '@ember/test-helpers': 3.2.0(@glint/template@1.5.0)(ember-source@5.3.0(@babel/core@7.26.0)(@glimmer/component@1.1.2(@babel/core@7.26.0))(@glint/template@1.5.0)(rsvp@4.8.5)(webpack@5.96.1))(webpack@5.96.1) '@embroider/addon-shim': 1.8.7 - '@embroider/macros': 1.13.3(@glint/template@1.5.0) + '@embroider/macros': 1.16.9(@glint/template@1.5.0) ember-cli-test-loader: 3.1.0 ember-source: 5.3.0(@babel/core@7.26.0)(@glimmer/component@1.1.2(@babel/core@7.26.0))(@glint/template@1.5.0)(rsvp@4.8.5)(webpack@5.96.1) qunit: 2.20.0 @@ -16026,7 +15968,7 @@ snapshots: npm-install-checks@6.3.0: dependencies: - semver: 7.6.0 + semver: 7.6.3 npm-normalize-package-bin@3.0.1: {} @@ -16041,7 +15983,7 @@ snapshots: dependencies: hosted-git-info: 7.0.1 proc-log: 3.0.0 - semver: 7.6.0 + semver: 7.6.3 validate-npm-package-name: 5.0.0 npm-pick-manifest@9.0.0: @@ -16049,7 +15991,7 @@ snapshots: npm-install-checks: 6.3.0 npm-normalize-package-bin: 3.0.1 npm-package-arg: 11.0.1 - semver: 7.6.0 + semver: 7.6.3 npm-run-all@4.1.5: dependencies: @@ -16764,12 +16706,6 @@ snapshots: path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 - resolve@1.22.6: - dependencies: - is-core-module: 2.13.0 - path-parse: 1.0.7 - supports-preserve-symlinks-flag: 1.0.0 - resolve@1.22.8: dependencies: is-core-module: 2.13.0 diff --git a/test-apps/base-tests/package.json b/test-apps/base-tests/package.json index bafcf505..5ec77512 100644 --- a/test-apps/base-tests/package.json +++ b/test-apps/base-tests/package.json @@ -38,10 +38,10 @@ "@ember/test-helpers": "^3.2.0", "@embroider/compat": "^3.7.0", "@embroider/core": "^3.4.19", + "@embroider/macros": "^1.16.9", "@embroider/webpack": "^4.0.8", "@eslint/js": "^9.15.0", "@glimmer/component": "^1.1.2", - "@glimmer/env": "^0.1.7", "@glimmer/tracking": "^1.1.2", "@glint/environment-ember-loose": "^1.1.0", "@glint/template": "^1.5.0", diff --git a/test-apps/base-tests/tests/unit/wait-for-promise-test.ts b/test-apps/base-tests/tests/unit/wait-for-promise-test.ts index e3d654ae..7d7bf179 100644 --- a/test-apps/base-tests/tests/unit/wait-for-promise-test.ts +++ b/test-apps/base-tests/tests/unit/wait-for-promise-test.ts @@ -9,10 +9,10 @@ import { } from '@ember/test-waiters'; import { module, test } from 'qunit'; -import { DEBUG } from '@glimmer/env'; +import { macroCondition, isDevelopingApp } from '@embroider/macros'; import RSVP from 'rsvp'; -if (DEBUG) { +if (macroCondition(isDevelopingApp())) { module('wait-for-promise', function (hooks) { hooks.afterEach(function () { _reset(); diff --git a/test-apps/base-tests/tests/unit/wait-for-test.ts b/test-apps/base-tests/tests/unit/wait-for-test.ts index 7be93a0c..6659d347 100644 --- a/test-apps/base-tests/tests/unit/wait-for-test.ts +++ b/test-apps/base-tests/tests/unit/wait-for-test.ts @@ -9,7 +9,7 @@ import { _reset, getPendingWaiterState, waitFor } from '@ember/test-waiters'; import { module, test } from 'qunit'; import EmberObject from '@ember/object'; -import { DEBUG } from '@glimmer/env'; +import { macroCondition, isDevelopingApp } from '@embroider/macros'; import RSVP from 'rsvp'; // @ember/test-waiters is still a v1 addon and is too weird @@ -32,7 +32,7 @@ interface ModeDef { createThrowingPromise: Function; } -if (DEBUG) { +if (macroCondition(isDevelopingApp())) { module('wait-for', function (hooks) { hooks.afterEach(function () { _reset(); diff --git a/test-apps/base-tests/tests/unit/waiter-manager-noop-test.ts b/test-apps/base-tests/tests/unit/waiter-manager-noop-test.ts index 6b96658d..a3cd40b7 100644 --- a/test-apps/base-tests/tests/unit/waiter-manager-noop-test.ts +++ b/test-apps/base-tests/tests/unit/waiter-manager-noop-test.ts @@ -1,15 +1,15 @@ import { _reset, buildWaiter, getWaiters, register } from '@ember/test-waiters'; import { module, test } from 'qunit'; -import { DEBUG } from '@glimmer/env'; +import { macroCondition, isDevelopingApp } from '@embroider/macros'; -if (!DEBUG) { - module('waiter-manager-noop | DEBUG: false', function (hooks) { +if (macroCondition(!isDevelopingApp())) { + module('waiter-manager-noop | isDevelopingApp(): false', function (hooks) { hooks.afterEach(function () { _reset(); }); - test('buildWaiter returns NoopTestWaiter DEBUG: false', function (assert) { + test('buildWaiter returns NoopTestWaiter isDevelopingApp(): false', function (assert) { const waiter = buildWaiter('first'); assert.equal( diff --git a/test-apps/base-tests/tests/unit/waiter-manager-test.ts b/test-apps/base-tests/tests/unit/waiter-manager-test.ts index 38fce275..843e3c57 100644 --- a/test-apps/base-tests/tests/unit/waiter-manager-test.ts +++ b/test-apps/base-tests/tests/unit/waiter-manager-test.ts @@ -20,11 +20,11 @@ import { } from '@ember/test-waiters'; import { module, test } from 'qunit'; -import { DEBUG } from '@glimmer/env'; +import { macroCondition, isDevelopingApp } from '@embroider/macros'; import { registerWarnHandler } from '@ember/debug'; -if (DEBUG) { - module('waiter-manager | DEBUG: true', function (hooks) { +if (macroCondition(isDevelopingApp())) { + module('waiter-manager | isDevelopingApp(): true', function (hooks) { hooks.afterEach(function () { _reset(); _resetWaiterNames();