@embroider/compat 4.0.0-alpha.9 → 4.0.1-unstable.049c331

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embroider/compat",
3
- "version": "4.0.0-alpha.9",
3
+ "version": "4.0.1-unstable.049c331",
4
4
  "private": false,
5
5
  "description": "Backward compatibility layer for the Embroider build system.",
6
6
  "repository": {
@@ -69,7 +69,7 @@
69
69
  "tree-sync": "^2.1.0",
70
70
  "typescript-memoize": "^1.0.1",
71
71
  "walk-sync": "^3.0.0",
72
- "@embroider/macros": "1.17.0-alpha.7"
72
+ "@embroider/macros": "1.17.1-unstable.049c331"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@glimmer/syntax": "^0.84.3",
@@ -92,12 +92,12 @@
92
92
  "ember-engines": "^0.8.19",
93
93
  "scenario-tester": "^4.0.0",
94
94
  "typescript": "^5.4.5",
95
- "@embroider/core": "^4.0.0-alpha.9",
96
95
  "@embroider/sample-transforms": "0.0.0",
97
- "@embroider/test-support": "0.36.0"
96
+ "@embroider/test-support": "0.36.0",
97
+ "@embroider/core": "^4.0.1-unstable.049c331"
98
98
  },
99
99
  "peerDependencies": {
100
- "@embroider/core": "^4.0.0-alpha.9"
100
+ "@embroider/core": "^4.0.1-unstable.049c331"
101
101
  },
102
102
  "engines": {
103
103
  "node": "12.* || 14.* || >= 16"
@@ -101,11 +101,17 @@ class default_1 extends v1_addon_1.default {
101
101
  // top-level `ember` package tries to import it until 4.10. A
102
102
  // spec-compliant ES modules implementation will treat this as a parse
103
103
  // error.
104
- trees.push(new FixStringLoc([packages]));
104
+ trees.push(new ReplaceRequire([new FixStringLoc([packages])]));
105
+ }
106
+ else if ((0, semver_1.satisfies)(this.packageJSON.version, '<5.7.0')) {
107
+ trees.push(new ReplaceRequire([packages]));
105
108
  }
106
109
  if ((0, semver_1.satisfies)(this.packageJSON.version, '<5.12.0')) {
107
110
  trees.push(new FixDeprecateFunction([packages]));
108
111
  }
112
+ if ((0, semver_1.satisfies)(this.packageJSON.version, '<5.11.1')) {
113
+ trees.push(new FixCycleImports([packages]));
114
+ }
109
115
  return (0, broccoli_merge_trees_1.default)(trees, { overwrite: true });
110
116
  }
111
117
  // We're zeroing out these files in vendor rather than deleting them, because
@@ -156,6 +162,105 @@ class FixStringLoc extends broccoli_plugin_1.default {
156
162
  (0, fs_extra_1.outputFileSync)((0, path_1.resolve)(this.outputPath, 'ember', 'index.js'), outSource, 'utf8');
157
163
  }
158
164
  }
165
+ class ReplaceRequire extends broccoli_plugin_1.default {
166
+ build() {
167
+ updateFileWithTransform(this, 'ember/index.js', function (babel) {
168
+ const { types: t } = babel;
169
+ function createLoader() {
170
+ return t.objectExpression([
171
+ t.objectMethod('get', t.identifier('require'), [], t.blockStatement([
172
+ t.returnStatement(t.memberExpression(t.identifier('globalThis'), t.identifier('require'))),
173
+ ])),
174
+ t.objectMethod('get', t.identifier('define'), [], t.blockStatement([
175
+ t.returnStatement(t.memberExpression(t.identifier('globalThis'), t.identifier('define'))),
176
+ ])),
177
+ t.objectMethod('get', t.identifier('registry'), [], t.blockStatement([
178
+ t.returnStatement(t.logicalExpression('??', t.optionalMemberExpression(t.memberExpression(t.identifier('globalThis'), t.identifier('requirejs')), t.identifier('entries'), false, true), t.optionalMemberExpression(t.memberExpression(t.identifier('globalThis'), t.identifier('require')), t.identifier('entries'), false, true))),
179
+ ])),
180
+ ]);
181
+ }
182
+ return {
183
+ visitor: {
184
+ CallExpression(path) {
185
+ if (path.node.callee.type === 'Identifier' &&
186
+ (path.node.callee.name === 'has' || path.node.callee.name === 'require') &&
187
+ path.node.arguments[0].type === 'StringLiteral' &&
188
+ path.node.arguments[0].value === 'ember-testing') {
189
+ path.replaceWith(t.identifier('EmberTestingImpl'));
190
+ }
191
+ },
192
+ ImportDeclaration(path) {
193
+ if (path.node.source.value === 'require') {
194
+ path.replaceWith(t.importDeclaration([t.importSpecifier(t.identifier('EmberTestingImpl'), t.identifier('_impl'))], t.stringLiteral('@ember/test')));
195
+ }
196
+ },
197
+ VariableDeclaration(path) {
198
+ if (path.node.declarations[0].id.type === 'Identifier' &&
199
+ path.node.declarations[0].id.name === 'PartialEmber' &&
200
+ path.node.declarations[0].init.type === 'ObjectExpression') {
201
+ const declaration = path.node.declarations[0];
202
+ const loader = declaration.init.properties.find(p => (p.type === 'ObjectProperty' && p.key.type === 'Identifier' && p.key.name) === '__loader');
203
+ loader.value = createLoader();
204
+ }
205
+ },
206
+ AssignmentExpression(path) {
207
+ if (path.node.left.type === 'MemberExpression' &&
208
+ path.node.left.object.type === 'Identifier' &&
209
+ path.node.left.object.name === 'Ember' &&
210
+ path.node.left.property.type === 'Identifier' &&
211
+ path.node.left.property.name === '__loader') {
212
+ path.node.right = createLoader();
213
+ }
214
+ },
215
+ },
216
+ };
217
+ });
218
+ replaceFile(this, '@ember/test/adapter.js', `import { Adapter } from 'ember-testing';
219
+ export default Adapter;`);
220
+ replaceFile(this, '@ember/test/index.js', `export let registerAsyncHelper;
221
+ export let registerHelper;
222
+ export let registerWaiter;
223
+ export let unregisterHelper;
224
+ export let unregisterWaiter;
225
+ export let _impl;
226
+
227
+ let testingNotAvailableMessage = () => {
228
+ throw new Error('Attempted to use test utilities, but \`ember-testing\` was not included');
229
+ };
230
+
231
+ registerAsyncHelper = testingNotAvailableMessage;
232
+ registerHelper = testingNotAvailableMessage;
233
+ registerWaiter = testingNotAvailableMessage;
234
+ unregisterHelper = testingNotAvailableMessage;
235
+ unregisterWaiter = testingNotAvailableMessage;
236
+
237
+ export function registerTestImplementaiton(impl) {
238
+ let { Test } = impl;
239
+ registerAsyncHelper = Test.registerAsyncHelper;
240
+ registerHelper = Test.registerHelper;
241
+ registerWaiter = Test.registerWaiter;
242
+ unregisterHelper = Test.unregisterHelper;
243
+ unregisterWaiter = Test.unregisterWaiter;
244
+ _impl = impl;
245
+ }`);
246
+ replaceFile(this, 'ember-testing/index.js', `export * from './lib/public-api';
247
+ import * as EmberTesting from './lib/public-api';
248
+ import { registerTestImplementaiton } from '@ember/test';
249
+
250
+
251
+ registerTestImplementaiton(EmberTesting);`);
252
+ replaceFile(this, 'ember-testing/lib/public-api.js', `
253
+ export { default as Test } from './test';
254
+ export { default as Adapter } from './adapters/adapter';
255
+ export { default as setupForTesting } from './setup_for_testing';
256
+ export { default as QUnitAdapter } from './adapters/qunit';
257
+
258
+ import './ext/application';
259
+ import './ext/rsvp'; // setup RSVP + run loop integration
260
+ import './helpers'; // adds helpers to helpers object in Test
261
+ import './initializers'; // to setup initializer`);
262
+ }
263
+ }
159
264
  class FixDeprecateFunction extends broccoli_plugin_1.default {
160
265
  build() {
161
266
  let inSource = (0, fs_extra_1.readFileSync)((0, path_1.resolve)(this.inputPaths[0], '@ember', 'debug', 'index.js'), 'utf8');
@@ -211,6 +316,124 @@ function fixDeprecate(babel) {
211
316
  },
212
317
  };
213
318
  }
319
+ function updateFileWithTransform(context, file, transformFunction) {
320
+ // only update the file if it exists - this helps the codemods to work across many different versions
321
+ if (!(0, fs_1.existsSync)((0, path_1.resolve)(context.inputPaths[0], file))) {
322
+ return;
323
+ }
324
+ let inSource = (0, fs_extra_1.readFileSync)((0, path_1.resolve)(context.inputPaths[0], file), 'utf8');
325
+ let plugins = Array.isArray(transformFunction) ? transformFunction : [transformFunction];
326
+ let outSource = (0, core_1.transform)(inSource, {
327
+ plugins,
328
+ configFile: false,
329
+ }).code;
330
+ (0, fs_extra_1.outputFileSync)((0, path_1.resolve)(context.outputPath, file), outSource, 'utf8');
331
+ }
332
+ function replaceFile(context, file, content) {
333
+ (0, fs_extra_1.outputFileSync)((0, path_1.resolve)(context.outputPath, file), content, 'utf8');
334
+ }
335
+ class FixCycleImports extends broccoli_plugin_1.default {
336
+ build() {
337
+ for (let file of ['@ember/object/observable.js', '@ember/utils/lib/is_empty.js']) {
338
+ updateFileWithTransform(this, file, moveObjectSpecifiersToMetal);
339
+ }
340
+ updateFileWithTransform(this, '@ember/array/index.js', [
341
+ moveObjectSpecifiersToMetal,
342
+ function (babel) {
343
+ const { types: t } = babel;
344
+ return {
345
+ visitor: {
346
+ ExportNamedDeclaration(path) {
347
+ var _a;
348
+ if (((_a = path.node.source) === null || _a === void 0 ? void 0 : _a.value) === './lib/make-array') {
349
+ path.node.source = t.stringLiteral('./make');
350
+ }
351
+ },
352
+ },
353
+ };
354
+ },
355
+ ]);
356
+ updateFileWithTransform(this, '@ember/runloop/index.js', function (babel) {
357
+ const { types: t } = babel;
358
+ return {
359
+ visitor: {
360
+ CallExpression(path) {
361
+ if (path.node.callee.type === 'Identifier' && path.node.callee.name === 'flushAsyncObservers') {
362
+ path.node.arguments = [t.identifier('schedule')];
363
+ }
364
+ },
365
+ },
366
+ };
367
+ });
368
+ updateFileWithTransform(this, '@ember/object/core.js', function (babel) {
369
+ const { types: t } = babel;
370
+ return {
371
+ visitor: {
372
+ ImportDeclaration(path) {
373
+ if (path.node.source.value === '@ember/array') {
374
+ path.node.source = t.stringLiteral('@ember/array/make');
375
+ path.node.specifiers = [t.importDefaultSpecifier(t.identifier('makeArray'))];
376
+ }
377
+ if (path.node.source.value === '@ember/-internals/runtime') {
378
+ path.replaceWith(t.importDeclaration([t.importSpecifier(t.identifier('ActionHandler'), t.identifier('default'))], t.stringLiteral('@ember/-internals/runtime/lib/mixins/action_handler')));
379
+ }
380
+ },
381
+ },
382
+ };
383
+ });
384
+ (0, fs_extra_1.outputFileSync)((0, path_1.resolve)(this.outputPath, '@ember/array/make.js'), `export { default } from './lib/make-array';`, 'utf8');
385
+ updateFileWithTransform(this, '@ember/-internals/metal/index.js', function (babel) {
386
+ const { types: t } = babel;
387
+ return {
388
+ visitor: {
389
+ FunctionDeclaration(path) {
390
+ var _a;
391
+ if (((_a = path.node.id) === null || _a === void 0 ? void 0 : _a.name) === 'flushAsyncObservers') {
392
+ path.node.params = [t.identifier('_schedule')];
393
+ }
394
+ },
395
+ IfStatement(path) {
396
+ if (path.node.test.type === 'Identifier' && path.node.test.name === 'shouldSchedule') {
397
+ path.node.test.name = '_schedule';
398
+ }
399
+ },
400
+ CallExpression(path) {
401
+ if (path.node.callee.type === 'Identifier' && path.node.callee.name === 'schedule') {
402
+ path.node.callee.name = '_schedule';
403
+ }
404
+ },
405
+ ImportDeclaration(path) {
406
+ if (path.node.source.value === '@ember/runloop') {
407
+ path.remove();
408
+ }
409
+ },
410
+ },
411
+ };
412
+ });
413
+ }
414
+ }
415
+ function moveObjectSpecifiersToMetal() {
416
+ let done = false;
417
+ return {
418
+ visitor: {
419
+ ImportDeclaration(path) {
420
+ if (path.node.source.value === '@ember/-internals/metal') {
421
+ if (done) {
422
+ return;
423
+ }
424
+ /**
425
+ * I need to use getAllPRevSiblings and getAllNextSiblings here because I need the siblings
426
+ * to be paths and path.container only holds nodes (for some strange reason).
427
+ */
428
+ const objectimport = [...path.getAllPrevSiblings(), ...path.getAllNextSiblings()].find(p => p.node.type === 'ImportDeclaration' && p.node.source.value === '@ember/object');
429
+ path.node.specifiers.push(...objectimport.node.specifiers);
430
+ objectimport.remove();
431
+ done = true;
432
+ }
433
+ },
434
+ },
435
+ };
436
+ }
214
437
  function fixStringLoc(babel) {
215
438
  let t = babel.types;
216
439
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"ember-source.js","sourceRoot":"","sources":["ember-source.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAAkC;AAClC,sEAA0C;AAC1C,gFAA8C;AAC9C,iEAAuC;AACvC,uCAAiF;AACjF,+BAAqC;AACrC,2DAA6C;AAC7C,mCAAmC;AACnC,sCAAwC;AAGxC,sEAAqC;AAErC,2BAAgC;AAEhC,eAAqB,SAAQ,kBAAO;IAClC,IAAI,MAAM;QACR,OAAO,IAAA,8BAAU,EAAC,CAAC,KAAK,CAAC,MAAM,EAAE,IAAA,yBAAW,EAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,iCAAiC,CAAC,EAAE,CAAC,CAAC,CA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AAC","sourcesContent":["import V1Addon from '../v1-addon';\nimport buildFunnel from 'broccoli-funnel';\nimport mergeTrees from 'broccoli-merge-trees';\nimport AddToTree from '../add-to-tree';\nimport { outputFileSync, readFileSync, readdirSync, unlinkSync } from 'fs-extra';\nimport { join, resolve } from 'path';\nimport { Memoize } from 'typescript-memoize';\nimport { satisfies } from 'semver';\nimport { transform } from '@babel/core';\nimport type * as Babel from '@babel/core';\nimport type { NodePath } from '@babel/traverse';\nimport Plugin from 'broccoli-plugin';\nimport type { Node } from 'broccoli-node-api';\nimport { existsSync } from 'fs';\n\nexport default class extends V1Addon {\n get v2Tree() {\n return mergeTrees([super.v2Tree, buildFunnel(this.rootTree, { include: ['dist/ember-template-compiler.js'] })]);\n }\n\n // versions of ember-source prior to\n // https://github.com/emberjs/ember.js/pull/20675 ship dist/packages and\n // dist/dependencies separately and the imports between them are package-name\n // imports. Since many of the dependencies are also true package.json\n // dependencies (in order to get typescript types), and our module-resolver\n // prioritizes true dependencies, it's necessary to detect and remove the\n // package.json dependencies.\n //\n // After the above linked change, ember-source ships only dist/packages and\n // the inter-package imports are all relative. Some of the things in\n // dist/packages are still the rolled-in dependencies, but now that the\n // imports are all relative we need no special handling for them (beyond the\n // normal v2 addon renamed-modules support.\n @Memoize()\n private get includedDependencies() {\n let result: string[] = [];\n let depsDir = resolve(this.root, 'dist', 'dependencies');\n if (!existsSync(depsDir)) {\n return result;\n }\n for (let name of readdirSync(depsDir)) {\n if (name[0] === '@') {\n for (let innerName of readdirSync(resolve(this.root, 'dist', 'dependencies', name))) {\n if (innerName.endsWith('.js')) {\n result.push(name + '/' + innerName.slice(0, -3));\n }\n }\n } else {\n if (name.endsWith('.js')) {\n result.push(name.slice(0, -3));\n }\n }\n }\n return result;\n }\n\n get newPackageJSON() {\n let json = super.newPackageJSON;\n\n for (let name of this.includedDependencies) {\n // weirdly, many of the inlined dependency are still listed as real\n // dependencies too. If we don't delete them here, they will take\n // precedence over the inlined ones, because the embroider module-resolver\n // tries to prioritize real deps.\n delete json.dependencies?.[name];\n }\n\n return json;\n }\n\n customizes(treeName: string) {\n // we are adding custom implementations of these\n return treeName === 'treeForAddon' || treeName === 'treeForVendor' || super.customizes(treeName);\n }\n\n invokeOriginalTreeFor(name: string) {\n if (name === 'addon') {\n return this.customAddonTree();\n }\n if (name === 'vendor') {\n return this.customVendorTree();\n }\n }\n\n // Our addon tree is all of the \"packages\" we share. @embroider/compat already\n // supports that pattern of emitting modules into other package's namespaces.\n private customAddonTree() {\n let packages = buildFunnel(this.rootTree, {\n srcDir: 'dist/packages',\n });\n\n let trees: Node[] = [\n packages,\n buildFunnel(this.rootTree, {\n srcDir: 'dist/dependencies',\n allowEmpty: true,\n }),\n ];\n\n if (satisfies(this.packageJSON.version, '>= 4.0.0-alpha.0 <4.10.0-alpha.0', { includePrerelease: true })) {\n // import { loc } from '@ember/string' was removed in 4.0. but the\n // top-level `ember` package tries to import it until 4.10. A\n // spec-compliant ES modules implementation will treat this as a parse\n // error.\n trees.push(new FixStringLoc([packages]));\n }\n\n if (satisfies(this.packageJSON.version, '<5.12.0')) {\n trees.push(new FixDeprecateFunction([packages]));\n }\n\n return mergeTrees(trees, { overwrite: true });\n }\n\n // We're zeroing out these files in vendor rather than deleting them, because\n // we can't easily intercept the `app.import` that presumably exists for them,\n // so rather than error they will just be empty.\n //\n // The reason we're zeroing these out is that we're going to consume all our\n // modules directly out of treeForAddon instead, as real modules that webpack\n // can see.\n private customVendorTree() {\n return new AddToTree(this.addonInstance._treeFor('vendor'), outputPath => {\n unlinkSync(join(outputPath, 'ember', 'ember.js'));\n outputFileSync(join(outputPath, 'ember', 'ember.js'), '');\n unlinkSync(join(outputPath, 'ember', 'ember-testing.js'));\n outputFileSync(join(outputPath, 'ember', 'ember-testing.js'), '');\n });\n }\n\n get packageMeta() {\n let meta = super.packageMeta;\n\n if (!meta['implicit-modules']) {\n meta['implicit-modules'] = [];\n }\n meta['implicit-modules'].push('./ember/index.js');\n // before 5.6, Ember uses the AMD loader to decide if it's test-only parts\n // are present, so we must ensure they're registered. After that it's\n // enough to evaluate ember-testing, which @embroider/core is hard-coded\n // to do in the backward-compatible tests bundle.\n if (!satisfies(this.packageJSON.version, '>= 5.6.0-alpha.0', { includePrerelease: true })) {\n if (!meta['implicit-test-modules']) {\n meta['implicit-test-modules'] = [];\n }\n meta['implicit-test-modules'].push('./ember-testing/index.js');\n }\n\n return meta;\n }\n}\n\nclass FixStringLoc extends Plugin {\n build() {\n let inSource = readFileSync(resolve(this.inputPaths[0], 'ember', 'index.js'), 'utf8');\n let outSource = transform(inSource, {\n plugins: [fixStringLoc],\n configFile: false,\n })!.code!;\n outputFileSync(resolve(this.outputPath, 'ember', 'index.js'), outSource, 'utf8');\n }\n}\n\nclass FixDeprecateFunction extends Plugin {\n build() {\n let inSource = readFileSync(resolve(this.inputPaths[0], '@ember', 'debug', 'index.js'), 'utf8');\n let outSource = transform(inSource, {\n plugins: [fixDeprecate],\n configFile: false,\n })!.code!;\n outputFileSync(resolve(this.outputPath, '@ember', 'debug', 'index.js'), outSource, 'utf8');\n }\n}\n\nfunction fixDeprecate(babel: typeof Babel) {\n const { types: t } = babel;\n\n return {\n name: 'ast-transform', // not required\n visitor: {\n Program(path: NodePath<Babel.types.Program>) {\n path.node.body.unshift(\n t.functionDeclaration(\n t.identifier('newDeprecate'),\n [t.restElement(t.identifier('rest'))],\n t.blockStatement([\n t.returnStatement(\n t.callExpression(\n t.logicalExpression('??', t.identifier('currentDeprecate'), t.identifier('_deprecate')),\n [t.spreadElement(t.identifier('rest'))]\n )\n ),\n ])\n )\n );\n },\n AssignmentExpression(path: NodePath<Babel.types.AssignmentExpression>) {\n if (path.node.left.type === 'Identifier' && path.node.left.name === 'deprecate') {\n path.node.left.name = 'currentDeprecate';\n }\n },\n\n ReturnStatement(path: NodePath<Babel.types.ReturnStatement>) {\n if (path.node.argument?.type === 'Identifier' && path.node.argument.name === 'deprecate') {\n path.node.argument.name = 'newDeprecate';\n }\n },\n\n CallExpression(path: NodePath<Babel.types.CallExpression>) {\n if (path.node.callee.type === 'Identifier' && path.node.callee.name === 'deprecate') {\n path.node.callee.name = 'newDeprecate';\n }\n if (\n path.node.callee.type === 'Identifier' &&\n path.node.callee.name === 'setDebugFunction' &&\n path.node.arguments[0].type === 'StringLiteral' &&\n path.node.arguments[0].value === 'deprecate'\n ) {\n path.remove();\n }\n },\n ExportSpecifier(path: NodePath<Babel.types.ExportSpecifier>) {\n if (path.node.local.name === 'deprecate') {\n path.node.local = t.identifier('newDeprecate');\n }\n },\n VariableDeclarator(path: NodePath<Babel.types.VariableDeclarator>) {\n if (path.node.id.type === 'Identifier' && path.node.id.name === 'deprecate') {\n path.node.id.name = 'currentDeprecate';\n }\n },\n },\n };\n}\n\nfunction fixStringLoc(babel: typeof Babel) {\n let t = babel.types;\n return {\n visitor: {\n Program(path: NodePath<Babel.types.Program>) {\n path.node.body.unshift(\n t.variableDeclaration('const', [t.variableDeclarator(t.identifier('loc'), t.identifier('undefined'))])\n );\n },\n ImportDeclaration: {\n enter(path: NodePath<Babel.types.ImportDeclaration>, state: { inEmberString: boolean }) {\n if (path.node.source.value === '@ember/string') {\n state.inEmberString = true;\n }\n },\n exit(_path: NodePath<Babel.types.ImportDeclaration>, state: { inEmberString: boolean }) {\n state.inEmberString = false;\n },\n },\n ImportSpecifier(path: NodePath<Babel.types.ImportSpecifier>, state: { inEmberString: boolean }) {\n let name = 'value' in path.node.imported ? path.node.imported.value : path.node.imported.name;\n if (state.inEmberString && name === 'loc') {\n path.remove();\n }\n },\n },\n };\n}\n"]}
1
+ {"version":3,"file":"ember-source.js","sourceRoot":"","sources":["ember-source.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAAkC;AAClC,sEAA0C;AAC1C,gFAA8C;AAC9C,iEAAuC;AACvC,uCAAiF;AACjF,+BAAqC;AACrC,2DAA6C;AAC7C,mCAAmC;AACnC,sCAAwC;AAGxC,sEAAqC;AAErC,2BAAgC;AAEhC,eAAqB,SAAQ,kB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AC,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CACvG,CAAC;YACJ,CAAC;YACD,iBAAiB,EAAE;gBACjB,KAAK,CAAC,IAA6C,EAAE,KAAiC;oBACpF,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,eAAe,EAAE,CAAC;wBAC/C,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC;oBAC7B,CAAC;gBACH,CAAC;gBACD,IAAI,CAAC,KAA8C,EAAE,KAAiC;oBACpF,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC;gBAC9B,CAAC;aACF;YACD,eAAe,CAAC,IAA2C,EAAE,KAAiC;gBAC5F,IAAI,IAAI,GAAG,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAC9F,IAAI,KAAK,CAAC,aAAa,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;oBAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,CAAC;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import V1Addon from '../v1-addon';\nimport buildFunnel from 'broccoli-funnel';\nimport mergeTrees from 'broccoli-merge-trees';\nimport AddToTree from '../add-to-tree';\nimport { outputFileSync, readFileSync, readdirSync, unlinkSync } from 'fs-extra';\nimport { join, resolve } from 'path';\nimport { Memoize } from 'typescript-memoize';\nimport { satisfies } from 'semver';\nimport { transform } from '@babel/core';\nimport type * as Babel from '@babel/core';\nimport type { NodePath } from '@babel/traverse';\nimport Plugin from 'broccoli-plugin';\nimport type { Node } from 'broccoli-node-api';\nimport { existsSync } from 'fs';\n\nexport default class extends V1Addon {\n get v2Tree() {\n return mergeTrees([super.v2Tree, buildFunnel(this.rootTree, { include: ['dist/ember-template-compiler.js'] })]);\n }\n\n // versions of ember-source prior to\n // https://github.com/emberjs/ember.js/pull/20675 ship dist/packages and\n // dist/dependencies separately and the imports between them are package-name\n // imports. Since many of the dependencies are also true package.json\n // dependencies (in order to get typescript types), and our module-resolver\n // prioritizes true dependencies, it's necessary to detect and remove the\n // package.json dependencies.\n //\n // After the above linked change, ember-source ships only dist/packages and\n // the inter-package imports are all relative. Some of the things in\n // dist/packages are still the rolled-in dependencies, but now that the\n // imports are all relative we need no special handling for them (beyond the\n // normal v2 addon renamed-modules support.\n @Memoize()\n private get includedDependencies() {\n let result: string[] = [];\n let depsDir = resolve(this.root, 'dist', 'dependencies');\n if (!existsSync(depsDir)) {\n return result;\n }\n for (let name of readdirSync(depsDir)) {\n if (name[0] === '@') {\n for (let innerName of readdirSync(resolve(this.root, 'dist', 'dependencies', name))) {\n if (innerName.endsWith('.js')) {\n result.push(name + '/' + innerName.slice(0, -3));\n }\n }\n } else {\n if (name.endsWith('.js')) {\n result.push(name.slice(0, -3));\n }\n }\n }\n return result;\n }\n\n get newPackageJSON() {\n let json = super.newPackageJSON;\n\n for (let name of this.includedDependencies) {\n // weirdly, many of the inlined dependency are still listed as real\n // dependencies too. If we don't delete them here, they will take\n // precedence over the inlined ones, because the embroider module-resolver\n // tries to prioritize real deps.\n delete json.dependencies?.[name];\n }\n\n return json;\n }\n\n customizes(treeName: string) {\n // we are adding custom implementations of these\n return treeName === 'treeForAddon' || treeName === 'treeForVendor' || super.customizes(treeName);\n }\n\n invokeOriginalTreeFor(name: string) {\n if (name === 'addon') {\n return this.customAddonTree();\n }\n if (name === 'vendor') {\n return this.customVendorTree();\n }\n }\n\n // Our addon tree is all of the \"packages\" we share. @embroider/compat already\n // supports that pattern of emitting modules into other package's namespaces.\n private customAddonTree() {\n let packages = buildFunnel(this.rootTree, {\n srcDir: 'dist/packages',\n });\n\n let trees: Node[] = [\n packages,\n buildFunnel(this.rootTree, {\n srcDir: 'dist/dependencies',\n allowEmpty: true,\n }),\n ];\n\n if (satisfies(this.packageJSON.version, '>= 4.0.0-alpha.0 <4.10.0-alpha.0', { includePrerelease: true })) {\n // import { loc } from '@ember/string' was removed in 4.0. but the\n // top-level `ember` package tries to import it until 4.10. A\n // spec-compliant ES modules implementation will treat this as a parse\n // error.\n trees.push(new ReplaceRequire([new FixStringLoc([packages])]));\n } else if (satisfies(this.packageJSON.version, '<5.7.0')) {\n trees.push(new ReplaceRequire([packages]));\n }\n\n if (satisfies(this.packageJSON.version, '<5.12.0')) {\n trees.push(new FixDeprecateFunction([packages]));\n }\n\n if (satisfies(this.packageJSON.version, '<5.11.1')) {\n trees.push(new FixCycleImports([packages]));\n }\n\n return mergeTrees(trees, { overwrite: true });\n }\n\n // We're zeroing out these files in vendor rather than deleting them, because\n // we can't easily intercept the `app.import` that presumably exists for them,\n // so rather than error they will just be empty.\n //\n // The reason we're zeroing these out is that we're going to consume all our\n // modules directly out of treeForAddon instead, as real modules that webpack\n // can see.\n private customVendorTree() {\n return new AddToTree(this.addonInstance._treeFor('vendor'), outputPath => {\n unlinkSync(join(outputPath, 'ember', 'ember.js'));\n outputFileSync(join(outputPath, 'ember', 'ember.js'), '');\n unlinkSync(join(outputPath, 'ember', 'ember-testing.js'));\n outputFileSync(join(outputPath, 'ember', 'ember-testing.js'), '');\n });\n }\n\n get packageMeta() {\n let meta = super.packageMeta;\n\n if (!meta['implicit-modules']) {\n meta['implicit-modules'] = [];\n }\n meta['implicit-modules'].push('./ember/index.js');\n // before 5.6, Ember uses the AMD loader to decide if it's test-only parts\n // are present, so we must ensure they're registered. After that it's\n // enough to evaluate ember-testing, which @embroider/core is hard-coded\n // to do in the backward-compatible tests bundle.\n if (!satisfies(this.packageJSON.version, '>= 5.6.0-alpha.0', { includePrerelease: true })) {\n if (!meta['implicit-test-modules']) {\n meta['implicit-test-modules'] = [];\n }\n meta['implicit-test-modules'].push('./ember-testing/index.js');\n }\n\n return meta;\n }\n}\n\nclass FixStringLoc extends Plugin {\n build() {\n let inSource = readFileSync(resolve(this.inputPaths[0], 'ember', 'index.js'), 'utf8');\n let outSource = transform(inSource, {\n plugins: [fixStringLoc],\n configFile: false,\n })!.code!;\n outputFileSync(resolve(this.outputPath, 'ember', 'index.js'), outSource, 'utf8');\n }\n}\n\nclass ReplaceRequire extends Plugin {\n build() {\n updateFileWithTransform(this, 'ember/index.js', function (babel: typeof Babel) {\n const { types: t } = babel;\n\n function createLoader() {\n return t.objectExpression([\n t.objectMethod(\n 'get',\n t.identifier('require'),\n [],\n t.blockStatement([\n t.returnStatement(t.memberExpression(t.identifier('globalThis'), t.identifier('require'))),\n ])\n ),\n t.objectMethod(\n 'get',\n t.identifier('define'),\n [],\n t.blockStatement([\n t.returnStatement(t.memberExpression(t.identifier('globalThis'), t.identifier('define'))),\n ])\n ),\n t.objectMethod(\n 'get',\n t.identifier('registry'),\n [],\n\n t.blockStatement([\n t.returnStatement(\n t.logicalExpression(\n '??',\n t.optionalMemberExpression(\n t.memberExpression(t.identifier('globalThis'), t.identifier('requirejs')),\n t.identifier('entries'),\n false,\n true\n ),\n t.optionalMemberExpression(\n t.memberExpression(t.identifier('globalThis'), t.identifier('require')),\n t.identifier('entries'),\n false,\n true\n )\n )\n ),\n ])\n ),\n ]);\n }\n\n return {\n visitor: {\n CallExpression(path: NodePath<Babel.types.CallExpression>) {\n if (\n path.node.callee.type === 'Identifier' &&\n (path.node.callee.name === 'has' || path.node.callee.name === 'require') &&\n path.node.arguments[0].type === 'StringLiteral' &&\n path.node.arguments[0].value === 'ember-testing'\n ) {\n path.replaceWith(t.identifier('EmberTestingImpl'));\n }\n },\n ImportDeclaration(path: NodePath<Babel.types.ImportDeclaration>) {\n if (path.node.source.value === 'require') {\n path.replaceWith(\n t.importDeclaration(\n [t.importSpecifier(t.identifier('EmberTestingImpl'), t.identifier('_impl'))],\n t.stringLiteral('@ember/test')\n )\n );\n }\n },\n VariableDeclaration(path: NodePath<Babel.types.VariableDeclaration>) {\n if (\n path.node.declarations[0].id.type === 'Identifier' &&\n path.node.declarations[0].id.name === 'PartialEmber' &&\n path.node.declarations[0].init!.type === 'ObjectExpression'\n ) {\n const declaration = path.node.declarations[0];\n const loader = (declaration.init! as Babel.types.ObjectExpression).properties.find(\n p => (p.type === 'ObjectProperty' && p.key.type === 'Identifier' && p.key.name) === '__loader'\n );\n (loader as Babel.types.ObjectProperty).value = createLoader();\n }\n },\n AssignmentExpression(path: NodePath<Babel.types.AssignmentExpression>) {\n if (\n path.node.left.type === 'MemberExpression' &&\n path.node.left.object.type === 'Identifier' &&\n path.node.left.object.name === 'Ember' &&\n path.node.left.property.type === 'Identifier' &&\n path.node.left.property.name === '__loader'\n ) {\n path.node.right = createLoader();\n }\n },\n },\n };\n });\n\n replaceFile(\n this,\n '@ember/test/adapter.js',\n `import { Adapter } from 'ember-testing';\n export default Adapter;`\n );\n\n replaceFile(\n this,\n '@ember/test/index.js',\n `export let registerAsyncHelper;\nexport let registerHelper;\nexport let registerWaiter;\nexport let unregisterHelper;\nexport let unregisterWaiter;\nexport let _impl;\n\nlet testingNotAvailableMessage = () => {\n throw new Error('Attempted to use test utilities, but \\`ember-testing\\` was not included');\n};\n\nregisterAsyncHelper = testingNotAvailableMessage;\nregisterHelper = testingNotAvailableMessage;\nregisterWaiter = testingNotAvailableMessage;\nunregisterHelper = testingNotAvailableMessage;\nunregisterWaiter = testingNotAvailableMessage;\n\nexport function registerTestImplementaiton(impl) {\n let { Test } = impl;\n registerAsyncHelper = Test.registerAsyncHelper;\n registerHelper = Test.registerHelper;\n registerWaiter = Test.registerWaiter;\n unregisterHelper = Test.unregisterHelper;\n unregisterWaiter = Test.unregisterWaiter;\n _impl = impl;\n}`\n );\n\n replaceFile(\n this,\n 'ember-testing/index.js',\n `export * from './lib/public-api';\nimport * as EmberTesting from './lib/public-api';\nimport { registerTestImplementaiton } from '@ember/test';\n\n\nregisterTestImplementaiton(EmberTesting);`\n );\n\n replaceFile(\n this,\n 'ember-testing/lib/public-api.js',\n `\nexport { default as Test } from './test';\nexport { default as Adapter } from './adapters/adapter';\nexport { default as setupForTesting } from './setup_for_testing';\nexport { default as QUnitAdapter } from './adapters/qunit';\n\nimport './ext/application';\nimport './ext/rsvp'; // setup RSVP + run loop integration\nimport './helpers'; // adds helpers to helpers object in Test\nimport './initializers'; // to setup initializer`\n );\n }\n}\n\nclass FixDeprecateFunction extends Plugin {\n build() {\n let inSource = readFileSync(resolve(this.inputPaths[0], '@ember', 'debug', 'index.js'), 'utf8');\n let outSource = transform(inSource, {\n plugins: [fixDeprecate],\n configFile: false,\n })!.code!;\n outputFileSync(resolve(this.outputPath, '@ember', 'debug', 'index.js'), outSource, 'utf8');\n }\n}\n\nfunction fixDeprecate(babel: typeof Babel) {\n const { types: t } = babel;\n\n return {\n name: 'ast-transform', // not required\n visitor: {\n Program(path: NodePath<Babel.types.Program>) {\n path.node.body.unshift(\n t.functionDeclaration(\n t.identifier('newDeprecate'),\n [t.restElement(t.identifier('rest'))],\n t.blockStatement([\n t.returnStatement(\n t.callExpression(\n t.logicalExpression('??', t.identifier('currentDeprecate'), t.identifier('_deprecate')),\n [t.spreadElement(t.identifier('rest'))]\n )\n ),\n ])\n )\n );\n },\n AssignmentExpression(path: NodePath<Babel.types.AssignmentExpression>) {\n if (path.node.left.type === 'Identifier' && path.node.left.name === 'deprecate') {\n path.node.left.name = 'currentDeprecate';\n }\n },\n\n ReturnStatement(path: NodePath<Babel.types.ReturnStatement>) {\n if (path.node.argument?.type === 'Identifier' && path.node.argument.name === 'deprecate') {\n path.node.argument.name = 'newDeprecate';\n }\n },\n\n CallExpression(path: NodePath<Babel.types.CallExpression>) {\n if (path.node.callee.type === 'Identifier' && path.node.callee.name === 'deprecate') {\n path.node.callee.name = 'newDeprecate';\n }\n if (\n path.node.callee.type === 'Identifier' &&\n path.node.callee.name === 'setDebugFunction' &&\n path.node.arguments[0].type === 'StringLiteral' &&\n path.node.arguments[0].value === 'deprecate'\n ) {\n path.remove();\n }\n },\n ExportSpecifier(path: NodePath<Babel.types.ExportSpecifier>) {\n if (path.node.local.name === 'deprecate') {\n path.node.local = t.identifier('newDeprecate');\n }\n },\n VariableDeclarator(path: NodePath<Babel.types.VariableDeclarator>) {\n if (path.node.id.type === 'Identifier' && path.node.id.name === 'deprecate') {\n path.node.id.name = 'currentDeprecate';\n }\n },\n },\n };\n}\n\nfunction updateFileWithTransform(\n context: Plugin,\n file: string,\n transformFunction: Babel.PluginItem | Babel.PluginItem[]\n) {\n // only update the file if it exists - this helps the codemods to work across many different versions\n if (!existsSync(resolve(context.inputPaths[0], file))) {\n return;\n }\n let inSource = readFileSync(resolve(context.inputPaths[0], file), 'utf8');\n\n let plugins = Array.isArray(transformFunction) ? transformFunction : [transformFunction];\n let outSource = transform(inSource, {\n plugins,\n configFile: false,\n })!.code!;\n outputFileSync(resolve(context.outputPath, file), outSource, 'utf8');\n}\n\nfunction replaceFile(context: Plugin, file: string, content: string) {\n outputFileSync(resolve(context.outputPath, file), content, 'utf8');\n}\n\nclass FixCycleImports extends Plugin {\n build() {\n for (let file of ['@ember/object/observable.js', '@ember/utils/lib/is_empty.js']) {\n updateFileWithTransform(this, file, moveObjectSpecifiersToMetal);\n }\n\n updateFileWithTransform(this, '@ember/array/index.js', [\n moveObjectSpecifiersToMetal,\n function (babel: typeof Babel) {\n const { types: t } = babel;\n return {\n visitor: {\n ExportNamedDeclaration(path: NodePath<Babel.types.ExportNamedDeclaration>) {\n if (path.node.source?.value === './lib/make-array') {\n path.node.source = t.stringLiteral('./make');\n }\n },\n },\n };\n },\n ]);\n\n updateFileWithTransform(this, '@ember/runloop/index.js', function (babel: typeof Babel) {\n const { types: t } = babel;\n\n return {\n visitor: {\n CallExpression(path: NodePath<Babel.types.CallExpression>) {\n if (path.node.callee.type === 'Identifier' && path.node.callee.name === 'flushAsyncObservers') {\n path.node.arguments = [t.identifier('schedule')];\n }\n },\n },\n };\n });\n\n updateFileWithTransform(this, '@ember/object/core.js', function (babel: typeof Babel) {\n const { types: t } = babel;\n\n return {\n visitor: {\n ImportDeclaration(path: NodePath<Babel.types.ImportDeclaration>) {\n if (path.node.source.value === '@ember/array') {\n path.node.source = t.stringLiteral('@ember/array/make');\n path.node.specifiers = [t.importDefaultSpecifier(t.identifier('makeArray'))];\n }\n\n if (path.node.source.value === '@ember/-internals/runtime') {\n path.replaceWith(\n t.importDeclaration(\n [t.importSpecifier(t.identifier('ActionHandler'), t.identifier('default'))],\n t.stringLiteral('@ember/-internals/runtime/lib/mixins/action_handler')\n )\n );\n }\n },\n },\n };\n });\n\n outputFileSync(\n resolve(this.outputPath, '@ember/array/make.js'),\n `export { default } from './lib/make-array';`,\n 'utf8'\n );\n\n updateFileWithTransform(this, '@ember/-internals/metal/index.js', function (babel: typeof Babel) {\n const { types: t } = babel;\n\n return {\n visitor: {\n FunctionDeclaration(path: NodePath<Babel.types.FunctionDeclaration>) {\n if (path.node.id?.name === 'flushAsyncObservers') {\n path.node.params = [t.identifier('_schedule')];\n }\n },\n IfStatement(path: NodePath<Babel.types.IfStatement>) {\n if (path.node.test.type === 'Identifier' && path.node.test.name === 'shouldSchedule') {\n path.node.test.name = '_schedule';\n }\n },\n CallExpression(path: NodePath<Babel.types.CallExpression>) {\n if (path.node.callee.type === 'Identifier' && path.node.callee.name === 'schedule') {\n path.node.callee.name = '_schedule';\n }\n },\n ImportDeclaration(path: NodePath<Babel.types.ImportDeclaration>) {\n if (path.node.source.value === '@ember/runloop') {\n path.remove();\n }\n },\n },\n };\n });\n }\n}\n\nfunction moveObjectSpecifiersToMetal() {\n let done = false;\n\n return {\n visitor: {\n ImportDeclaration(path: NodePath<Babel.types.ImportDeclaration>) {\n if (path.node.source.value === '@ember/-internals/metal') {\n if (done) {\n return;\n }\n\n /**\n * I need to use getAllPRevSiblings and getAllNextSiblings here because I need the siblings\n * to be paths and path.container only holds nodes (for some strange reason).\n */\n const objectimport = [...path.getAllPrevSiblings(), ...path.getAllNextSiblings()].find(\n p => p.node.type === 'ImportDeclaration' && p.node.source.value === '@ember/object'\n ) as NodePath<Babel.types.ImportDeclaration>;\n\n path.node.specifiers.push(...objectimport!.node.specifiers);\n objectimport.remove();\n\n done = true;\n }\n },\n },\n };\n}\n\nfunction fixStringLoc(babel: typeof Babel) {\n let t = babel.types;\n return {\n visitor: {\n Program(path: NodePath<Babel.types.Program>) {\n path.node.body.unshift(\n t.variableDeclaration('const', [t.variableDeclarator(t.identifier('loc'), t.identifier('undefined'))])\n );\n },\n ImportDeclaration: {\n enter(path: NodePath<Babel.types.ImportDeclaration>, state: { inEmberString: boolean }) {\n if (path.node.source.value === '@ember/string') {\n state.inEmberString = true;\n }\n },\n exit(_path: NodePath<Babel.types.ImportDeclaration>, state: { inEmberString: boolean }) {\n state.inEmberString = false;\n },\n },\n ImportSpecifier(path: NodePath<Babel.types.ImportSpecifier>, state: { inEmberString: boolean }) {\n let name = 'value' in path.node.imported ? path.node.imported.value : path.node.imported.name;\n if (state.inEmberString && name === 'loc') {\n path.remove();\n }\n },\n },\n };\n}\n"]}