@@ -12,7 +12,6 @@ const require = createRequire(import.meta.url);
1212const { PackageCache, packageName } = require ( '@embroider/shared-internals' ) ;
1313const projectRoot = dirname ( fileURLToPath ( import . meta. url ) ) ;
1414const packageCache = PackageCache . shared ( 'ember-source' , projectRoot ) ;
15- const { buildInfo } = require ( './broccoli/build-info' ) ;
1615const buildDebugMacroPlugin = require ( './broccoli/build-debug-macro-plugin' ) ;
1716const canaryFeatures = require ( './broccoli/canary-features' ) ;
1817
@@ -28,19 +27,6 @@ const testDependencies = [
2827let configs = [
2928 esmConfig ( ) ,
3029 esmProdConfig ( ) ,
31- legacyBundleConfig ( './broccoli/amd-compat-entrypoints/ember.debug.js' , 'ember.debug.js' , {
32- isDeveloping : true ,
33- } ) ,
34- legacyBundleConfig ( './broccoli/amd-compat-entrypoints/ember.debug.js' , 'ember.prod.js' , {
35- isDeveloping : false ,
36- } ) ,
37- legacyBundleConfig ( './broccoli/amd-compat-entrypoints/ember-testing.js' , 'ember-testing.js' , {
38- isDeveloping : true ,
39- isExternal ( source ) {
40- return ! source . startsWith ( 'ember-testing' ) ;
41- } ,
42- } ) ,
43- templateCompilerConfig ( ) ,
4430 glimmerComponent ( ) ,
4531 glimmerSyntaxESM ( ) ,
4632 glimmerSyntaxCJS ( ) ,
@@ -197,51 +183,6 @@ function renameEntrypoints(entrypoints, fn) {
197183 return Object . fromEntries ( Object . entries ( entrypoints ) . map ( ( [ k , v ] ) => [ fn ( k ) , v ] ) ) ;
198184}
199185
200- function legacyBundleConfig ( input , output , { isDeveloping, isExternal } ) {
201- let babelConfig = { ...sharedBabelConfig } ;
202-
203- babelConfig . plugins = [ ...babelConfig . plugins ] ;
204-
205- return {
206- input,
207- output : {
208- format : 'iife' ,
209- file : `dist/${ output } ` ,
210- generatedCode : 'es2015' ,
211- sourcemap : true ,
212-
213- // We are relying on unfrozen modules because we need to add the
214- // __esModule marker to them in our amd-compat-entrypoints. Rollup has an
215- // `esModule` option too, but it only puts the marker on entrypoints. We
216- // have a single entrypoint ("ember.debug.js") that imports a bunch of
217- // modules and hands them to our classic AMD loader. All of those modules
218- // need the __esModule marker too.
219- freeze : false ,
220-
221- globals : ( id ) => {
222- return `require('${ id } ')` ;
223- } ,
224-
225- interop : 'esModule' ,
226- } ,
227- onLog : handleRollupWarnings ,
228- plugins : [
229- amdDefineSupport ( ) ,
230- ...( isDeveloping ? [ concatenateAMDEntrypoints ( ) ] : [ ] ) ,
231- babel ( {
232- babelHelpers : 'bundled' ,
233- extensions : [ '.js' , '.ts' ] ,
234- configFile : false ,
235- ...babelConfig ,
236- } ) ,
237- resolveTS ( ) ,
238- version ( ) ,
239- resolvePackages ( { ...exposedDependencies ( ) , ...hiddenDependencies ( ) } , { isExternal } ) ,
240- licenseAndLoader ( ) ,
241- ] ,
242- } ;
243- }
244-
245186function packages ( ) {
246187 // Start by treating every module as an entrypoint
247188 let entryFiles = glob . sync ( '**/*.{ts,js}' , {
@@ -551,136 +492,6 @@ export function version() {
551492 } ;
552493}
553494
554- function amdDefineSupport ( ) {
555- return {
556- name : 'amd-define-support' ,
557-
558- resolveId ( source ) {
559- if ( source === 'amd-compat-entrypoint-definition' ) {
560- return '\0amd-compat-entrypoint-definition' ;
561- }
562- } ,
563-
564- load ( id ) {
565- if ( id === '\0amd-compat-entrypoint-definition' ) {
566- return {
567- code : `
568- export default function d(name, mod) {
569- Object.defineProperty(mod, '__esModule', { value: true });
570- define(name, [], () => mod);
571- };
572- ` ,
573- } ;
574- }
575- } ,
576- } ;
577- }
578-
579- function concatenateAMDEntrypoints ( ) {
580- const concatRules = {
581- // this says: when you load the ember.debug.js AMD compat entrypoint, also
582- // concatenate in the ember-testing.js AMD compat entrypoint.
583- 'ember.debug.js' : [ 'ember-testing.js' ] ,
584- } ;
585-
586- return {
587- name : 'concatenateAMDEntrypoints' ,
588- load ( id ) {
589- if ( id [ 0 ] === '\0' ) {
590- return ;
591- }
592- for ( let [ target , extras ] of Object . entries ( concatRules ) ) {
593- if ( id . endsWith ( `amd-compat-entrypoints/${ target } ` ) ) {
594- let contents = [ readFileSync ( id ) , ...extras . map ( ( e ) => `import "./${ e } ";` ) ] ;
595- return {
596- code : contents . join ( '\n' ) ,
597- } ;
598- }
599- }
600- } ,
601- } ;
602- }
603-
604- function license ( ) {
605- return `/*!
606- * @overview Ember - JavaScript Application Framework
607- * @copyright Copyright 2011 Tilde Inc. and contributors
608- * Portions Copyright 2006-2011 Strobe Inc.
609- * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
610- * @license Licensed under MIT license
611- * See https://raw.github.com/emberjs/ember.js/master/LICENSE
612- * @version ${ buildInfo ( ) . version }
613- */
614- ` ;
615- }
616-
617- function loader ( ) {
618- return readFileSync (
619- resolve ( dirname ( fileURLToPath ( import . meta. url ) ) , 'packages' , 'loader' , 'lib' , 'index.js' )
620- ) ;
621- }
622-
623- function licenseAndLoader ( ) {
624- return {
625- name : 'license-and-loader' ,
626- generateBundle ( options , bundles ) {
627- for ( let bundle of Object . values ( bundles ) ) {
628- bundle . code = license ( ) + loader ( ) + bundle . code ;
629- }
630- } ,
631- } ;
632- }
633-
634- function templateCompilerConfig ( ) {
635- // These are modules that, when used in the legacy template compiler bundle,
636- // need to be discovered from ember.debug.js instead when running in the
637- // browser, and stubbed to ember-template-compiler.js in node.
638- const externals = {
639- '@ember/template-compilation' : `{
640- __esModule: true,
641- __registerTemplateCompiler(){},
642- }` ,
643- ember : `{
644- __esModule: true,
645- default: {
646- get ENV() { return require('@ember/-internals/environment').ENV },
647- get FEATURES() { return require('@ember/canary-features').FEATURES },
648- get VERSION() { return require('ember/version').default },
649- },
650- }` ,
651- '@ember/-internals/glimmer' : `{
652- __esModule: true,
653- }` ,
654- '@ember/application' : `{
655- __esModule: true,
656- }` ,
657- } ;
658- let config = legacyBundleConfig (
659- './broccoli/amd-compat-entrypoints/ember-template-compiler.js' ,
660- 'ember-template-compiler.js' ,
661- { isDeveloping : true }
662- ) ;
663- config . plugins . unshift ( {
664- enforce : 'pre' ,
665- name : 'template-compiler-externals' ,
666- async resolveId ( source ) {
667- if ( externals [ source ] ) {
668- return { id : source , external : true } ;
669- }
670- } ,
671- } ) ;
672- config . output . globals = ( id ) => {
673- return `(() => {
674- try {
675- return require('${ id } ');
676- } catch (err) {
677- return ${ externals [ id ] }
678- }
679- })()` ;
680- } ;
681- return config ;
682- }
683-
684495function pruneEmptyBundles ( ) {
685496 return {
686497 name : 'prune-empty-bundles' ,
0 commit comments