diff --git a/broccoli/amd-compat-entrypoints/ember.debug.js b/broccoli/amd-compat-entrypoints/ember.debug.js index 9674971a6a7..cf6b79c6422 100644 --- a/broccoli/amd-compat-entrypoints/ember.debug.js +++ b/broccoli/amd-compat-entrypoints/ember.debug.js @@ -197,6 +197,9 @@ d('@ember/controller/index', emberControllerIndex); import * as emberDebugIndex from '@ember/debug/index'; d('@ember/debug/index', emberDebugIndex); +import * as emberDebugInspectorSupportIndex from '@ember/debug/ember-inspector-support/index'; +d('@ember/debug/ember-inspector-support/index', emberDebugInspectorSupportIndex); + import * as emberDebugLibCaptureRenderTree from '@ember/debug/lib/capture-render-tree'; d('@ember/debug/lib/capture-render-tree', emberDebugLibCaptureRenderTree); diff --git a/package.json b/package.json index 693ab69d733..14fa7f528f4 100644 --- a/package.json +++ b/package.json @@ -114,6 +114,7 @@ "@embroider/shared-internals": "^2.5.0", "@glimmer/component": "^1.1.2", "@rollup/plugin-babel": "^6.0.4", + "@rollup/plugin-commonjs": "^28.0.0", "@simple-dom/document": "^1.4.0", "@swc-node/register": "^1.6.8", "@swc/core": "^1.3.100", @@ -396,8 +397,7 @@ "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", - "rsvp/index.js": "ember-source/rsvp/index.js", - "source-map-js/index.js": "ember-source/source-map-js/index.js" + "rsvp/index.js": "ember-source/rsvp/index.js" } }, "typesVersions": { diff --git a/packages/@ember/debug/ember-inspector-support/libs/source-map.ts b/packages/@ember/debug/ember-inspector-support/libs/source-map.ts index 89bf323ac12..f5e92ec7e10 100644 --- a/packages/@ember/debug/ember-inspector-support/libs/source-map.ts +++ b/packages/@ember/debug/ember-inspector-support/libs/source-map.ts @@ -1,5 +1,5 @@ import BaseObject from '@ember/debug/ember-inspector-support/utils/base-object'; -import * as SourceMap from 'source-map-js'; +import { SourceMapConsumer } from 'source-map-js'; const notFoundError = new Error('Source map url not found'); export default class SourceMapSupport extends BaseObject { @@ -56,7 +56,7 @@ export default class SourceMapSupport extends BaseObject { (response) => { if (response) { const map = JSON.parse(response.map); - const sm = new SourceMap.SourceMapConsumer(map); + const sm = new SourceMapConsumer(map); sourceMaps[url] = sm; return sm; } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 08abb3ca710..3efa2ebde53 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -160,6 +160,9 @@ importers: '@rollup/plugin-babel': specifier: ^6.0.4 version: 6.0.4(@babel/core@7.24.4)(rollup@4.16.4) + '@rollup/plugin-commonjs': + specifier: ^28.0.0 + version: 28.0.0(rollup@4.16.4) '@simple-dom/document': specifier: ^1.4.0 version: 1.4.0 @@ -3157,6 +3160,9 @@ packages: '@jridgewell/sourcemap-codec@1.4.15': resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + '@jridgewell/sourcemap-codec@1.5.0': + resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} + '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} @@ -3541,6 +3547,15 @@ packages: rollup: optional: true + '@rollup/plugin-commonjs@28.0.0': + resolution: {integrity: sha512-BJcu+a+Mpq476DMXG+hevgPSl56bkUoi88dKT8t3RyUp8kGuOh+2bU8Gs7zXDlu+fyZggnJ+iOBGrb/O1SorYg==} + engines: {node: '>=16.0.0 || 14 >= 14.17'} + peerDependencies: + rollup: ^4.2.0 + peerDependenciesMeta: + rollup: + optional: true + '@rollup/pluginutils@5.1.0': resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} engines: {node: '>=14.0.0'} @@ -6442,6 +6457,14 @@ packages: fd-slicer@1.1.0: resolution: {integrity: sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==} + fdir@6.4.0: + resolution: {integrity: sha512-3oB133prH1o4j/L5lLW7uOCF1PlD+/It2L0eL/iAqWMB91RBbqTewABqxhj0ibBd90EEmWZq7ntIWzVaWcXTGQ==} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + figures@2.0.0: resolution: {integrity: sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA==} engines: {node: '>=4'} @@ -7264,6 +7287,9 @@ packages: is-potential-custom-element-name@1.0.1: resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} + is-reference@1.2.1: + resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==} + is-regex@1.1.4: resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} engines: {node: '>= 0.4'} @@ -7687,6 +7713,9 @@ packages: magic-string@0.25.9: resolution: {integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==} + magic-string@0.30.12: + resolution: {integrity: sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==} + make-dir@3.1.0: resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} engines: {node: '>=8'} @@ -12543,6 +12572,8 @@ snapshots: '@jridgewell/sourcemap-codec@1.4.15': {} + '@jridgewell/sourcemap-codec@1.5.0': {} + '@jridgewell/trace-mapping@0.3.25': dependencies: '@jridgewell/resolve-uri': 3.1.2 @@ -13137,6 +13168,18 @@ snapshots: optionalDependencies: rollup: 4.16.4 + '@rollup/plugin-commonjs@28.0.0(rollup@4.16.4)': + dependencies: + '@rollup/pluginutils': 5.1.0(rollup@4.16.4) + commondir: 1.0.1 + estree-walker: 2.0.2 + fdir: 6.4.0(picomatch@2.3.1) + is-reference: 1.2.1 + magic-string: 0.30.12 + picomatch: 2.3.1 + optionalDependencies: + rollup: 4.16.4 + '@rollup/pluginutils@5.1.0(rollup@4.16.4)': dependencies: '@types/estree': 1.0.5 @@ -17334,6 +17377,10 @@ snapshots: dependencies: pend: 1.2.0 + fdir@6.4.0(picomatch@2.3.1): + optionalDependencies: + picomatch: 2.3.1 + figures@2.0.0: dependencies: escape-string-regexp: 1.0.5 @@ -18386,6 +18433,10 @@ snapshots: is-potential-custom-element-name@1.0.1: {} + is-reference@1.2.1: + dependencies: + '@types/estree': 1.0.5 + is-regex@1.1.4: dependencies: call-bind: 1.0.7 @@ -18846,6 +18897,10 @@ snapshots: dependencies: sourcemap-codec: 1.4.8 + magic-string@0.30.12: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.0 + make-dir@3.1.0: dependencies: semver: 6.3.1 diff --git a/rollup.config.mjs b/rollup.config.mjs index 1e981d2ce63..3fa292233c4 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -4,6 +4,7 @@ import { createRequire } from 'node:module'; import { fileURLToPath } from 'node:url'; import glob from 'glob'; import { babel } from '@rollup/plugin-babel'; +import commonjs from '@rollup/plugin-commonjs'; import sharedBabelConfig from './babel.config.mjs'; const require = createRequire(import.meta.url); @@ -61,6 +62,9 @@ function esmConfig() { chunkFileNames: 'packages/shared-chunks/[name]-[hash].js', }, plugins: [ + commonjs({ + include: [resolve(require.resolve('source-map-js'), '..', '**')], + }), babel({ babelHelpers: 'bundled', extensions: ['.js', '.ts'], @@ -109,6 +113,9 @@ function legacyBundleConfig(input, output, { isDeveloping, isExternal }) { }, onLog: handleRollupWarnings, plugins: [ + commonjs({ + include: [resolve(require.resolve('source-map-js'), '..', '**')], + }), amdDefineSupport(), ...(isDeveloping ? [concatenateAMDEntrypoints()] : []), babel({ @@ -183,7 +190,6 @@ function rolledUpPackages() { export function exposedDependencies() { return { 'backburner.js': require.resolve('backburner.js/dist/es6/backburner.js'), - 'source-map-js': require.resolve('source-map-js'), rsvp: require.resolve('rsvp/lib/rsvp.js'), 'dag-map': require.resolve('dag-map/dag-map.js'), router_js: require.resolve('router_js/dist/modules/index.js'), @@ -218,6 +224,7 @@ export function hiddenDependencies() { findFromProject('decorator-transforms').root, 'dist/runtime.js' ), + 'source-map-js': require.resolve('source-map-js'), }; } @@ -277,8 +284,8 @@ function entrypoint(pkg, which) { function resolveTS() { return { name: 'resolve-ts', - async resolveId(source, importer) { - let result = await this.resolve(source, importer); + async resolveId(source, importer, options) { + let result = await this.resolve(source, importer, options); if (result === null) { // the rest of rollup couldn't find it let stem = resolve(dirname(importer), source); @@ -328,6 +335,7 @@ export function resolvePackages(deps, isExternal) { } if (testDependencies.includes(pkgName)) { + // these are allowed to fall through and get resolved noramlly by vite // these are allowed to fall through and get resolved noramlly by vite // within our test suite. return;