Skip to content

Commit

Permalink
need commonjs
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed Oct 14, 2024
1 parent cf22b71 commit edf6985
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 7 deletions.
3 changes: 3 additions & 0 deletions broccoli/amd-compat-entrypoints/ember.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down
55 changes: 55 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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'],
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -218,6 +224,7 @@ export function hiddenDependencies() {
findFromProject('decorator-transforms').root,
'dist/runtime.js'
),
'source-map-js': require.resolve('source-map-js'),
};
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit edf6985

Please sign in to comment.