ember-repl 4.3.1 → 4.3.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/compile/formats/gjs/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGpD,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrC,OAAO,CAAC,aAAa,CAAC,CAkBxB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/compile/formats/gjs/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGpD,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrC,OAAO,CAAC,aAAa,CAAC,CAkBxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"hbs.d.ts","sourceRoot":"","sources":["../../../src/compile/formats/hbs.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAQjD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,sBAA2B,GAAG,aAAa,CAehG;AAED,UAAU,sBAAsB;IAC9B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC"}
1
+ {"version":3,"file":"hbs.d.ts","sourceRoot":"","sources":["../../../src/compile/formats/hbs.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,sBAA2B,GAAG,aAAa,CAehG;AAED,UAAU,sBAAsB;IAC9B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC"}
@@ -1,5 +1,5 @@
1
- import { importSync } from '@embroider/macros';
2
1
  import babelPluginEmberTemplateCompilation from 'babel-plugin-ember-template-compilation';
2
+ import * as compiler from 'ember-template-compiler';
3
3
  import { nameFor } from '../../utils.js';
4
4
  import { evalSnippet } from './eval.js';
5
5
 
@@ -56,7 +56,6 @@ async function transpile({
56
56
  } = result;
57
57
  return code;
58
58
  }
59
- const compiler = importSync('ember-source/dist/ember-template-compiler.js');
60
59
  let processor;
61
60
  let fetchingPromise;
62
61
  async function preprocess(input, name) {
@@ -69,10 +68,17 @@ async function preprocess(input, name) {
69
68
  } = await fetchingPromise;
70
69
  processor = new Preprocessor();
71
70
  }
72
- return processor.process(input, `${name}.js`);
71
+ return processor.process(input, {
72
+ filename: `${name}.js`,
73
+ inline_source_map: true
74
+ });
73
75
  }
74
76
  async function transform(intermediate, name, options = {}) {
75
- let babel = await import('@babel/standalone');
77
+ // @babel/standalone is a CJS module....
78
+ // so we have to use the default export (which is all the exports)
79
+ let maybeBabel = await import('@babel/standalone');
80
+ // Handle difference between vite and webpack in consuming projects...
81
+ let babel = 'default' in maybeBabel ? maybeBabel.default : maybeBabel;
76
82
  return babel.transform(intermediate, {
77
83
  filename: `${name}.js`,
78
84
  plugins: [
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/compile/formats/gjs/index.ts"],"sourcesContent":["import { importSync } from '@embroider/macros';\n\nimport babelPluginEmberTemplateCompilation from 'babel-plugin-ember-template-compilation';\n\nimport { nameFor } from '../../utils.ts';\nimport { evalSnippet } from './eval.ts';\n\nimport type { CompileResult } from '../../types.ts';\nimport type { ComponentLike } from '@glint/template';\n\nexport interface Info {\n code: string;\n name: string;\n}\n\n/**\n * @public\n * Transpiles GlimmerJS (*.gjs) formatted text into and evaluates as a JS Module.\n * The returned component can be invoked explicitly in the consuming project.\n *\n * SEE: README for example usage\n *\n * @param {string} code: the code to be compiled\n * @param {Object} extraModules: map of import paths to modules. This isn't needed\n * for classic ember projects, but for strict static ember projects, extraModules\n * will need to be pasesd if compileJS is intended to be used in a styleguide or\n * if there are additional modules that could be imported in the passed `code`.\n *\n * Later on, imports that are not present by default (ember/glimmer) or that\n * are not provided by extraModules will be searched on npm to see if a package\n * needs to be downloaded before running the `code` / invoking the component\n */\nexport async function compileJS(\n code: string,\n extraModules?: Record<string, unknown>\n): Promise<CompileResult> {\n let name = nameFor(code);\n let component: undefined | ComponentLike;\n let error: undefined | Error;\n\n try {\n let compiled = await transpile({ code: code, name });\n\n if (!compiled) {\n throw new Error(`Compiled output is missing`);\n }\n\n component = evalSnippet(compiled, extraModules).default as unknown as ComponentLike;\n } catch (e) {\n error = e as Error | undefined;\n }\n\n return { name, component, error };\n}\n\nasync function transpile({ code: input, name }: Info) {\n let preprocessed = await preprocess(input, name);\n let result = await transform(preprocessed, name);\n\n if (!result) {\n return;\n }\n\n let { code } = result;\n\n return code;\n}\n\nimport type { Babel } from './babel.ts';\n\nconst compiler = importSync('ember-source/dist/ember-template-compiler.js');\n\nlet processor: any;\nlet fetchingPromise: Promise<any>;\n\nasync function preprocess(input: string, name: string): Promise<string> {\n if (!fetchingPromise) {\n fetchingPromise = import('content-tag');\n }\n\n if (!processor) {\n let { Preprocessor } = await fetchingPromise;\n\n processor = new Preprocessor();\n }\n\n return processor.process(input, `${name}.js`);\n}\n\nasync function transform(\n intermediate: string,\n name: string,\n options: any = {}\n): Promise<ReturnType<Babel['transform']>> {\n let babel = (await import('@babel/standalone')) as Babel;\n\n return babel.transform(intermediate, {\n filename: `${name}.js`,\n plugins: [\n // [babelPluginIntermediateGJS],\n [\n babelPluginEmberTemplateCompilation,\n {\n compiler,\n },\n ],\n [babel.availablePlugins['proposal-decorators'], { legacy: true }],\n [babel.availablePlugins['proposal-class-properties']],\n ],\n presets: [\n [\n babel.availablePresets['env'],\n {\n // false -- keeps ES Modules\n modules: 'cjs',\n targets: { esmodules: true },\n forceAllTransforms: false,\n ...options,\n },\n ],\n ],\n });\n}\n"],"names":["compileJS","code","extraModules","name","nameFor","component","error","compiled","transpile","Error","evalSnippet","default","e","input","preprocessed","preprocess","result","transform","compiler","importSync","processor","fetchingPromise","Preprocessor","process","intermediate","options","babel","filename","plugins","babelPluginEmberTemplateCompilation","availablePlugins","legacy","presets","availablePresets","modules","targets","esmodules","forceAllTransforms"],"mappings":";;;;;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeA,SAASA,CAC7BC,IAAY,EACZC,YAAsC,EACd;AACxB,EAAA,IAAIC,IAAI,GAAGC,OAAO,CAACH,IAAI,CAAC,CAAA;AACxB,EAAA,IAAII,SAAoC,CAAA;AACxC,EAAA,IAAIC,KAAwB,CAAA;EAE5B,IAAI;AACF,IAAA,IAAIC,QAAQ,GAAG,MAAMC,SAAS,CAAC;AAAEP,MAAAA,IAAI,EAAEA,IAAI;AAAEE,MAAAA,IAAAA;AAAK,KAAC,CAAC,CAAA;IAEpD,IAAI,CAACI,QAAQ,EAAE;AACb,MAAA,MAAM,IAAIE,KAAK,CAAC,CAAA,0BAAA,CAA4B,CAAC,CAAA;AAC/C,KAAA;IAEAJ,SAAS,GAAGK,WAAW,CAACH,QAAQ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B;AACzC,EAAA,IAAIC,KAAK,GAAI,MAAM,OAAO,mBAAmB,CAAW,CAAA;AAExD,EAAA,OAAOA,KAAK,CAACT,SAAS,CAACO,YAAY,EAAE;IACnCG,QAAQ,EAAE,CAAGxB,EAAAA,IAAI,CAAK,GAAA,CAAA;AACtByB,IAAAA,OAAO,EAAE;AACP;AACA,IAAA,CACEC,mCAAmC,EACnC;AACEX,MAAAA,QAAAA;KACD,CACF,EACD,CAACQ,KAAK,CAACI,gBAAgB,CAAC,qBAAqB,CAAC,EAAE;AAAEC,MAAAA,MAAM,EAAE,IAAA;KAAM,CAAC,EACjE,CAACL,KAAK,CAACI,gBAAgB,CAAC,2BAA2B,CAAC,CAAC,CACtD;IACDE,OAAO,EAAE,CACP,CACEN,KAAK,CAACO,gBAAgB,CAAC,KAAK,CAAC,EAC7B;AACE;AACAC,MAAAA,OAAO,EAAE,KAAK;AACdC,MAAAA,OAAO,EAAE;AAAEC,QAAAA,SAAS,EAAE,IAAA;OAAM;AAC5BC,MAAAA,kBAAkB,EAAE,KAAK;MACzB,GAAGZ,OAAAA;AACL,KAAC,CACF,CAAA;AAEL,GAAC,CAAC,CAAA;AACJ;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/compile/formats/gjs/index.ts"],"sourcesContent":["import babelPluginEmberTemplateCompilation from 'babel-plugin-ember-template-compilation';\nimport * as compiler from 'ember-template-compiler';\n\nimport { nameFor } from '../../utils.ts';\nimport { evalSnippet } from './eval.ts';\n\nimport type { CompileResult } from '../../types.ts';\nimport type { ComponentLike } from '@glint/template';\n\nexport interface Info {\n code: string;\n name: string;\n}\n\n/**\n * @public\n * Transpiles GlimmerJS (*.gjs) formatted text into and evaluates as a JS Module.\n * The returned component can be invoked explicitly in the consuming project.\n *\n * SEE: README for example usage\n *\n * @param {string} code: the code to be compiled\n * @param {Object} extraModules: map of import paths to modules. This isn't needed\n * for classic ember projects, but for strict static ember projects, extraModules\n * will need to be pasesd if compileJS is intended to be used in a styleguide or\n * if there are additional modules that could be imported in the passed `code`.\n *\n * Later on, imports that are not present by default (ember/glimmer) or that\n * are not provided by extraModules will be searched on npm to see if a package\n * needs to be downloaded before running the `code` / invoking the component\n */\nexport async function compileJS(\n code: string,\n extraModules?: Record<string, unknown>\n): Promise<CompileResult> {\n let name = nameFor(code);\n let component: undefined | ComponentLike;\n let error: undefined | Error;\n\n try {\n let compiled = await transpile({ code: code, name });\n\n if (!compiled) {\n throw new Error(`Compiled output is missing`);\n }\n\n component = evalSnippet(compiled, extraModules).default as unknown as ComponentLike;\n } catch (e) {\n error = e as Error | undefined;\n }\n\n return { name, component, error };\n}\n\nasync function transpile({ code: input, name }: Info) {\n let preprocessed = await preprocess(input, name);\n let result = await transform(preprocessed, name);\n\n if (!result) {\n return;\n }\n\n let { code } = result;\n\n return code;\n}\n\nimport type { Babel } from './babel.ts';\n\nlet processor: any;\nlet fetchingPromise: Promise<any>;\n\nasync function preprocess(input: string, name: string): Promise<string> {\n if (!fetchingPromise) {\n fetchingPromise = import('content-tag');\n }\n\n if (!processor) {\n let { Preprocessor } = await fetchingPromise;\n\n processor = new Preprocessor();\n }\n\n return processor.process(input, { filename: `${name}.js`, inline_source_map: true });\n}\n\nasync function transform(\n intermediate: string,\n name: string,\n options: any = {}\n): Promise<ReturnType<Babel['transform']>> {\n // @babel/standalone is a CJS module....\n // so we have to use the default export (which is all the exports)\n let maybeBabel = (await import('@babel/standalone')) as any;\n // Handle difference between vite and webpack in consuming projects...\n let babel: Babel = 'default' in maybeBabel ? maybeBabel.default : maybeBabel;\n\n return babel.transform(intermediate, {\n filename: `${name}.js`,\n plugins: [\n // [babelPluginIntermediateGJS],\n [\n babelPluginEmberTemplateCompilation,\n {\n compiler,\n },\n ],\n [babel.availablePlugins['proposal-decorators'], { legacy: true }],\n [babel.availablePlugins['proposal-class-properties']],\n ],\n presets: [\n [\n babel.availablePresets['env'],\n {\n // false -- keeps ES Modules\n modules: 'cjs',\n targets: { esmodules: true },\n forceAllTransforms: false,\n ...options,\n },\n ],\n ],\n });\n}\n"],"names":["compileJS","code","extraModules","name","nameFor","component","error","compiled","transpile","Error","evalSnippet","default","e","input","preprocessed","preprocess","result","transform","processor","fetchingPromise","Preprocessor","process","filename","inline_source_map","intermediate","options","maybeBabel","babel","plugins","babelPluginEmberTemplateCompilation","compiler","availablePlugins","legacy","presets","availablePresets","modules","targets","esmodules","forceAllTransforms"],"mappings":";;;;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeA,SAASA,CAC7BC,IAAY,EACZC,YAAsC,EACd;AACxB,EAAA,IAAIC,IAAI,GAAGC,OAAO,CAACH,IAAI,CAAC,CAAA;AACxB,EAAA,IAAII,SAAoC,CAAA;AACxC,EAAA,IAAIC,KAAwB,CAAA;EAE5B,IAAI;AACF,IAAA,IAAIC,QAAQ,GAAG,MAAMC,SAAS,CAAC;AAAEP,MAAAA,IAAI,EAAEA,IAAI;AAAEE,MAAAA,IAAAA;AAAK,KAAC,CAAC,CAAA;IAEpD,IAAI,CAACI,QAAQ,EAAE;AACb,MAAA,MAAM,IAAIE,KAAK,CAAC,CAAA,0BAAA,CAA4B,CAAC,CAAA;AAC/C,KAAA;IAEAJ,SAAS,GAAGK,WAAW,CAACH,QAAQ,EAAEL,YAAY,CAAC,CAACS,OAAmC,CAAA;GACpF,CAAC,OAAOC,CAAC,EAAE;AACVN,IAAAA,KAAK,GAAGM,CAAsB,CAAA;AAChC,GAAA;EAEA,OAAO;IAAET,IAAI;IAAEE,SAAS;AAAEC,IAAAA,KAAAA;GAAO,CAAA;AACnC,CAAA;AAEA,eAAeE,SAASA,CAAC;AAAEP,EAAAA,IAAI,EAAEY,KAAK;AAAEV,EAAAA,IAAAA;AAAW,CAAC,EAAE;EACpD,IAAIW,YAAY,GAAG,MAAMC,UAAU,CAACF,KAAK,EAAEV,IAAI,CAAC,CAAA;EAChD,IAAIa,MAAM,GAAG,MAAMC,SA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,gBAAgB,CAAC,qBAAqB,CAAC,EAAE;AAAEC,MAAAA,MAAM,EAAE,IAAA;KAAM,CAAC,EACjE,CAACL,KAAK,CAACI,gBAAgB,CAAC,2BAA2B,CAAC,CAAC,CACtD;IACDE,OAAO,EAAE,CACP,CACEN,KAAK,CAACO,gBAAgB,CAAC,KAAK,CAAC,EAC7B;AACE;AACAC,MAAAA,OAAO,EAAE,KAAK;AACdC,MAAAA,OAAO,EAAE;AAAEC,QAAAA,SAAS,EAAE,IAAA;OAAM;AAC5BC,MAAAA,kBAAkB,EAAE,KAAK;MACzB,GAAGb,OAAAA;AACL,KAAC,CACF,CAAA;AAEL,GAAC,CAAC,CAAA;AACJ;;;;"}
@@ -1,9 +1,10 @@
1
+ import { precompileJSON } from '@glimmer/compiler';
2
+ import { getTemplateLocals } from '@glimmer/syntax';
1
3
  import { setComponentTemplate } from '@ember/component';
2
4
  import _TO from '@ember/component/template-only';
3
5
  import { array, concat, fn, get, hash } from '@ember/helper';
4
6
  import { on } from '@ember/modifier';
5
7
  import { createTemplateFactory } from '@ember/template-factory';
6
- import { importSync } from '@embroider/macros';
7
8
  import { nameFor } from '../utils.js';
8
9
 
9
10
  /* eslint-disable @typescript-eslint/no-explicit-any */
@@ -12,13 +13,6 @@ import { nameFor } from '../utils.js';
12
13
  // @ts-ignore
13
14
  // These things are pre-bundled in the old system.
14
15
  // ember-template-compiler defines them in AMD/requirejs
15
- const {
16
- precompileJSON
17
- } = importSync('@glimmer/compiler');
18
- const {
19
- getTemplateLocals
20
- } = importSync('@glimmer/syntax');
21
-
22
16
  /**
23
17
  * compile a template with an empty scope
24
18
  * to use components, helpers, etc, you will need to compile with JS
@@ -1 +1 @@
1
- {"version":3,"file":"hbs.js","sources":["../../../src/compile/formats/hbs.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n// import { precompileJSON } from '@glimmer/compiler';\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { setComponentTemplate } from '@ember/component';\nimport templateOnlyComponent from '@ember/component/template-only';\nimport { array, concat, fn, get, hash } from '@ember/helper';\nimport { on } from '@ember/modifier';\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { createTemplateFactory } from '@ember/template-factory';\nimport { importSync } from '@embroider/macros';\n\nimport { nameFor } from '../utils.ts';\n\nimport type { CompileResult } from '../types.ts';\nimport type { ComponentLike } from '@glint/template';\n\n// These things are pre-bundled in the old system.\n// ember-template-compiler defines them in AMD/requirejs\nconst { precompileJSON } = importSync('@glimmer/compiler') as any;\nconst { getTemplateLocals } = importSync('@glimmer/syntax') as any;\n\n/**\n * compile a template with an empty scope\n * to use components, helpers, etc, you will need to compile with JS\n *\n * (templates alone do not have a way to import / define complex structures)\n */\nexport function compileHBS(template: string, options: CompileTemplateOptions = {}): CompileResult {\n let name = nameFor(template);\n let component: undefined | ComponentLike;\n let error: undefined | Error;\n\n try {\n component = setComponentTemplate(\n compileTemplate(template, { moduleName: options.moduleName || name, ...options }),\n templateOnlyComponent(options.moduleName || name)\n ) as ComponentLike;\n } catch (e) {\n error = e as Error | undefined;\n }\n\n return { name, component, error };\n}\n\ninterface CompileTemplateOptions {\n /**\n * Used for debug viewing\n */\n moduleName?: string;\n scope?: Record<string, unknown>;\n}\n\n/**\n * The reason why we can't use precompile directly is because of this:\n * https://github.com/glimmerjs/glimmer-vm/blob/master/packages/%40glimmer/compiler/lib/compiler.ts#L132\n *\n * Support for dynamically compiling templates in strict mode doesn't seem to be fully their yet.\n * That JSON.stringify (and the lines after) prevent us from easily setting the scope function,\n * which means that *everything* is undefined.\n */\nfunction compileTemplate(source: string, { moduleName, scope = {} }: CompileTemplateOptions) {\n let localScope = { array, concat, fn, get, hash, on, ...scope } as any;\n let locals = getTemplateLocals(source);\n\n let options = {\n strictMode: true,\n moduleName,\n locals,\n isProduction: false,\n meta: { moduleName },\n };\n\n // Copied from @glimmer/compiler/lib/compiler#precompile\n let [block, usedLocals] = precompileJSON(source, options);\n\n let usedScope = usedLocals.map((key: string) => {\n let value = localScope[key];\n\n if (!value) {\n throw new Error(\n `Attempt to use ${key} in compiled hbs, but it was not available in scope. ` +\n `Available scope includes: ${Object.keys(localScope)}`\n );\n }\n\n return value;\n });\n\n let blockJSON = JSON.stringify(block);\n let templateJSONObject = {\n id: moduleName,\n block: blockJSON,\n moduleName: moduleName ?? '(dynamically compiled component)',\n scope: () => usedScope,\n isStrictMode: true,\n };\n\n let factory = createTemplateFactory(templateJSONObject);\n\n return factory;\n}\n"],"names":["precompileJSON","importSync","getTemplateLocals","compileHBS","template","options","name","nameFor","component","error","setComponentTemplate","compileTemplate","moduleName","templateOnlyComponent","e","source","scope","localScope","array","concat","fn","get","hash","on","locals","strictMode","isProduction","meta","block","usedLocals","usedScope","map","key","value","Error","Object","keys","blockJSON","JSON","stringify","templateJSONObject","id","isStrictMode","factory","createTemplateFactory"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AAeA;AACA;AACA,MAAM;AAAEA,EAAAA,cAAAA;AAAe,CAAC,GAAGC,UAAU,CAAC,mBAAmB,CAAQ,CAAA;AACjE,MAAM;AAAEC,EAAAA,iBAAAA;AAAkB,CAAC,GAAGD,UAAU,CAAC,iBAAiB,CAAQ,CAAA;;AAElE;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,UAAUA,CAACC,QAAgB,EAAEC,OAA+B,GAAG,EAAE,EAAiB;AAChG,EAAA,IAAIC,IAAI,GAAGC,OAAO,CAACH,QAAQ,CAAC,CAAA;AAC5B,EAAA,IAAII,SAAoC,CAAA;AACxC,EAAA,IAAIC,KAAwB,CAAA;EAE5B,IAAI;AACFD,IAAAA,SAAS,GAAGE,oBAAoB,CAC9BC,eAAe,CAACP,QAAQ,EAAE;AAAEQ,MAAAA,UAAU,EAAEP,OAAO,CAACO,UAAU,IAAIN,IAAI;MAAE,GAAGD,OAAAA;KAAS,CAAC,EACjFQ,GAAqB,CAACR,OAAO,CAACO,UAAU,IAAIN,IAAI,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AAA;AAEF,EAAA,IAAII,SAAS,GAAGC,IAAI,CAACC,SAAS,CAACX,KAAK,CAAC,CAAA;AACrC,EAAA,IAAIY,kBAAkB,GAAG;AACvBC,IAAAA,EAAE,EAAE7B,UAAU;AACdgB,IAAAA,KAAK,EAAES,SAAS;IAChBzB,UAAU,EAAEA,UAAU,IAAI,kCAAkC;IAC5DI,KAAK,EAAEA,MAAMc,SAAS;AACtBY,IAAAA,YAAY,EAAE,IAAA;GACf,CAAA;AAED,EAAA,IAAIC,OAAO,GAAGC,qBAAqB,CAACJ,kBAAkB,CAAC,CAAA;AAEvD,EAAA,OAAOG,OAAO,CAAA;AAChB;;;;"}
1
+ {"version":3,"file":"hbs.js","sources":["../../../src/compile/formats/hbs.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n// import { precompileJSON } from '@glimmer/compiler';\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\n// These things are pre-bundled in the old system.\n// ember-template-compiler defines them in AMD/requirejs\nimport { precompileJSON } from '@glimmer/compiler';\nimport { getTemplateLocals } from '@glimmer/syntax';\nimport { setComponentTemplate } from '@ember/component';\nimport templateOnlyComponent from '@ember/component/template-only';\nimport { array, concat, fn, get, hash } from '@ember/helper';\nimport { on } from '@ember/modifier';\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { createTemplateFactory } from '@ember/template-factory';\n\nimport { nameFor } from '../utils.ts';\n\nimport type { CompileResult } from '../types.ts';\nimport type { ComponentLike } from '@glint/template';\n\n/**\n * compile a template with an empty scope\n * to use components, helpers, etc, you will need to compile with JS\n *\n * (templates alone do not have a way to import / define complex structures)\n */\nexport function compileHBS(template: string, options: CompileTemplateOptions = {}): CompileResult {\n let name = nameFor(template);\n let component: undefined | ComponentLike;\n let error: undefined | Error;\n\n try {\n component = setComponentTemplate(\n compileTemplate(template, { moduleName: options.moduleName || name, ...options }),\n templateOnlyComponent(options.moduleName || name)\n ) as ComponentLike;\n } catch (e) {\n error = e as Error | undefined;\n }\n\n return { name, component, error };\n}\n\ninterface CompileTemplateOptions {\n /**\n * Used for debug viewing\n */\n moduleName?: string;\n scope?: Record<string, unknown>;\n}\n\n/**\n * The reason why we can't use precompile directly is because of this:\n * https://github.com/glimmerjs/glimmer-vm/blob/master/packages/%40glimmer/compiler/lib/compiler.ts#L132\n *\n * Support for dynamically compiling templates in strict mode doesn't seem to be fully their yet.\n * That JSON.stringify (and the lines after) prevent us from easily setting the scope function,\n * which means that *everything* is undefined.\n */\nfunction compileTemplate(source: string, { moduleName, scope = {} }: CompileTemplateOptions) {\n let localScope = { array, concat, fn, get, hash, on, ...scope } as any;\n let locals = getTemplateLocals(source);\n\n let options = {\n strictMode: true,\n moduleName,\n locals,\n isProduction: false,\n meta: { moduleName },\n };\n\n // Copied from @glimmer/compiler/lib/compiler#precompile\n let [block, usedLocals] = precompileJSON(source, options);\n\n let usedScope = usedLocals.map((key: string) => {\n let value = localScope[key];\n\n if (!value) {\n throw new Error(\n `Attempt to use ${key} in compiled hbs, but it was not available in scope. ` +\n `Available scope includes: ${Object.keys(localScope)}`\n );\n }\n\n return value;\n });\n\n let blockJSON = JSON.stringify(block);\n let templateJSONObject = {\n id: moduleName,\n block: blockJSON,\n moduleName: moduleName ?? '(dynamically compiled component)',\n scope: () => usedScope,\n isStrictMode: true,\n };\n\n let factory = createTemplateFactory(templateJSONObject);\n\n return factory;\n}\n"],"names":["compileHBS","template","options","name","nameFor","component","error","setComponentTemplate","compileTemplate","moduleName","templateOnlyComponent","e","source","scope","localScope","array","concat","fn","get","hash","on","locals","getTemplateLocals","strictMode","isProduction","meta","block","usedLocals","precompileJSON","usedScope","map","key","value","Error","Object","keys","blockJSON","JSON","stringify","templateJSONObject","id","isStrictMode","factory","createTemplateFactory"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAUA,CAACC,QAAgB,EAAEC,OAA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B,SAAS,GAAGF,UAAU,CAACG,GAAG,CAAEC,GAAW,IAAK;AAC9C,IAAA,IAAIC,KAAK,GAAGlB,UAAU,CAACiB,GAAG,CAAC,CAAA;IAE3B,IAAI,CAACC,KAAK,EAAE;AACV,MAAA,MAAM,IAAIC,KAAK,CACb,CAAA,eAAA,EAAkBF,GAAG,CAAuD,qDAAA,CAAA,GAC1E,CAA6BG,0BAAAA,EAAAA,MAAM,CAACC,IAAI,CAACrB,UAAU,CAAC,EACxD,CAAC,CAAA;AACH,KAAA;AAEA,IAAA,OAAOkB,KAAK,CAAA;AACd,GAAC,CAAC,CAAA;AAEF,EAAA,IAAII,SAAS,GAAGC,IAAI,CAACC,SAAS,CAACZ,KAAK,CAAC,CAAA;AACrC,EAAA,IAAIa,kBAAkB,GAAG;AACvBC,IAAAA,EAAE,EAAE/B,UAAU;AACdiB,IAAAA,KAAK,EAAEU,SAAS;IAChB3B,UAAU,EAAEA,UAAU,IAAI,kCAAkC;IAC5DI,KAAK,EAAEA,MAAMgB,SAAS;AACtBY,IAAAA,YAAY,EAAE,IAAA;GACf,CAAA;AAED,EAAA,IAAIC,OAAO,GAAGC,qBAAqB,CAACJ,kBAAkB,CAAC,CAAA;AAEvD,EAAA,OAAOG,OAAO,CAAA;AAChB;;;;"}
@@ -140,7 +140,7 @@ function liveCodeExtraction(options = {}) {
140
140
  });
141
141
  };
142
142
  }
143
- function sanitizeForGlimmer( /* options */
143
+ function sanitizeForGlimmer(/* options */
144
144
  ) {
145
145
  return tree => {
146
146
  visit(tree, 'element', node => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-repl",
3
- "version": "4.3.1",
3
+ "version": "4.3.3",
4
4
  "description": "Addon for enabling REPL and Playground creation with Ember/Glimmer",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -60,17 +60,17 @@
60
60
  "addon-main.cjs"
61
61
  ],
62
62
  "dependencies": {
63
- "@babel/helper-plugin-utils": "^7.24.5",
64
- "@babel/standalone": "^7.24.5",
63
+ "@babel/helper-plugin-utils": "^7.25.7",
64
+ "@babel/standalone": "^7.25.7",
65
65
  "@embroider/addon-shim": "1.8.9",
66
- "@embroider/macros": "1.16.5",
66
+ "@embroider/macros": "1.16.9",
67
67
  "babel-import-util": "^3.0.0",
68
- "babel-plugin-ember-template-compilation": "^2.2.5",
68
+ "babel-plugin-ember-template-compilation": "^2.3.0",
69
69
  "broccoli-file-creator": "^2.1.1",
70
70
  "change-case": "^5.4.4",
71
71
  "common-tags": "^1.8.2",
72
- "content-tag": "^1.2.1",
73
- "decorator-transforms": "^2.0.0",
72
+ "content-tag": "^2.0.2",
73
+ "decorator-transforms": "^2.2.2",
74
74
  "ember-resources": "^7.0.1",
75
75
  "line-column": "^1.0.2",
76
76
  "magic-string": "^0.30.6",
@@ -87,27 +87,27 @@
87
87
  "vfile": "^6.0.1"
88
88
  },
89
89
  "devDependencies": {
90
- "@babel/core": "^7.24.5",
91
- "@babel/plugin-transform-typescript": "^7.24.5",
92
- "@babel/preset-typescript": "^7.23.3",
93
- "@babel/types": "^7.24.5",
94
- "@ember/test-helpers": "^3.2.1",
90
+ "@babel/core": "^7.25.7",
91
+ "@babel/plugin-transform-typescript": "^7.25.7",
92
+ "@babel/preset-typescript": "^7.25.7",
93
+ "@babel/types": "^7.25.7",
94
+ "@ember/test-helpers": "^4.0.4",
95
95
  "@ember/test-waiters": "^3.1.0",
96
- "@embroider/addon-dev": "4.3.1",
96
+ "@embroider/addon-dev": "^5.0.0",
97
97
  "@glimmer/compiler": "^0.92.0",
98
- "@glimmer/component": "^1.1.2",
98
+ "@glimmer/component": "^2.0.0",
99
99
  "@glimmer/interfaces": "^0.92.0",
100
100
  "@glimmer/reference": "^0.92.0",
101
101
  "@glimmer/syntax": "^0.92.0",
102
102
  "@glimmer/tracking": "^1.1.2",
103
103
  "@glimmer/util": "^0.92.0",
104
- "@glint/core": "1.4.0",
105
- "@glint/environment-ember-loose": "1.4.0",
106
- "@glint/environment-ember-template-imports": "1.4.0",
107
- "@glint/template": "1.4.0",
104
+ "@glint/core": "1.4.1-unstable.ff9ea6c",
105
+ "@glint/environment-ember-loose": "1.4.1-unstable.ff9ea6c",
106
+ "@glint/environment-ember-template-imports": "1.4.1-unstable.ff9ea6c",
107
+ "@glint/template": "1.4.1-unstable.ff9ea6c",
108
108
  "@nullvoxpopuli/eslint-configs": "^4.0.0",
109
109
  "@rollup/plugin-babel": "^6.0.4",
110
- "@rollup/plugin-commonjs": "^25.0.7",
110
+ "@rollup/plugin-commonjs": "^28.0.0",
111
111
  "@tsconfig/ember": "^3.0.7",
112
112
  "@types/babel__core": "^7.20.5",
113
113
  "@types/babel__standalone": "^7.1.7",
@@ -115,26 +115,26 @@
115
115
  "@types/hast": "^3.0.3",
116
116
  "@types/mdast": "^4.0.4",
117
117
  "@types/unist": "^3.0.2",
118
- "@types/uuid": "^9.0.8",
119
- "@typescript-eslint/eslint-plugin": "^7.9.0",
120
- "@typescript-eslint/parser": "^7.9.0",
121
- "concurrently": "^8.2.2",
118
+ "@types/uuid": "^10.0.0",
119
+ "@typescript-eslint/eslint-plugin": "^8.8.0",
120
+ "@typescript-eslint/parser": "^8.8.0",
121
+ "concurrently": "^9.0.1",
122
122
  "ember-resources": "^7.0.0",
123
- "ember-source": ">= 5.9.0",
124
- "ember-template-imports": "^4.1.1",
123
+ "ember-source": ">= 5.10.2",
124
+ "ember-template-imports": "^4.1.2",
125
125
  "ember-template-lint": "^6.0.0",
126
126
  "eslint": "^8.55.0",
127
- "eslint-plugin-ember": "^12.1.0",
128
- "eslint-plugin-n": "^17.7.0",
129
- "eslint-plugin-prettier": "^5.1.3",
127
+ "eslint-plugin-ember": "^12.2.1",
128
+ "eslint-plugin-n": "^17.10.3",
129
+ "eslint-plugin-prettier": "^5.2.1",
130
130
  "execa": "^8.0.1",
131
- "prettier": "^3.2.5",
131
+ "prettier": "^3.3.3",
132
132
  "prettier-plugin-ember-template-tag": "2.0.2",
133
133
  "publint": "^0.2.6",
134
- "rollup": "~4.18.0",
134
+ "rollup": "~4.24.0",
135
135
  "rollup-plugin-copy": "^3.5.0",
136
136
  "typescript": "^5.4.5",
137
- "webpack": "5.92.0",
137
+ "webpack": ">= 5.92.0",
138
138
  "@nullvoxpopuli/limber-untyped": "0.0.1"
139
139
  },
140
140
  "volta": {
@@ -147,13 +147,16 @@
147
147
  "version": 2,
148
148
  "type": "addon",
149
149
  "main": "addon-main.cjs",
150
+ "externals": [
151
+ "ember-template-compiler"
152
+ ],
150
153
  "app-js": {}
151
154
  },
152
155
  "peerDependencies": {
153
156
  "@glimmer/compiler": ">= 0.86.0",
154
157
  "@glimmer/syntax": ">= 0.86.0",
155
- "@glint/template": ">= 1.3.0",
156
- "webpack": "5.92.0"
158
+ "@glint/template": "1.4.1-unstable.ff9ea6c",
159
+ "webpack": ">= 5.92.0"
157
160
  },
158
161
  "peerDependenciesMeta": {
159
162
  "@glint/template": {
@@ -1,6 +1,5 @@
1
- import { importSync } from '@embroider/macros';
2
-
3
1
  import babelPluginEmberTemplateCompilation from 'babel-plugin-ember-template-compilation';
2
+ import * as compiler from 'ember-template-compiler';
4
3
 
5
4
  import { nameFor } from '../../utils.ts';
6
5
  import { evalSnippet } from './eval.ts';
@@ -68,8 +67,6 @@ async function transpile({ code: input, name }: Info) {
68
67
 
69
68
  import type { Babel } from './babel.ts';
70
69
 
71
- const compiler = importSync('ember-source/dist/ember-template-compiler.js');
72
-
73
70
  let processor: any;
74
71
  let fetchingPromise: Promise<any>;
75
72
 
@@ -84,7 +81,7 @@ async function preprocess(input: string, name: string): Promise<string> {
84
81
  processor = new Preprocessor();
85
82
  }
86
83
 
87
- return processor.process(input, `${name}.js`);
84
+ return processor.process(input, { filename: `${name}.js`, inline_source_map: true });
88
85
  }
89
86
 
90
87
  async function transform(
@@ -92,7 +89,11 @@ async function transform(
92
89
  name: string,
93
90
  options: any = {}
94
91
  ): Promise<ReturnType<Babel['transform']>> {
95
- let babel = (await import('@babel/standalone')) as Babel;
92
+ // @babel/standalone is a CJS module....
93
+ // so we have to use the default export (which is all the exports)
94
+ let maybeBabel = (await import('@babel/standalone')) as any;
95
+ // Handle difference between vite and webpack in consuming projects...
96
+ let babel: Babel = 'default' in maybeBabel ? maybeBabel.default : maybeBabel;
96
97
 
97
98
  return babel.transform(intermediate, {
98
99
  filename: `${name}.js`,
@@ -2,6 +2,10 @@
2
2
  // import { precompileJSON } from '@glimmer/compiler';
3
3
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
4
  // @ts-ignore
5
+ // These things are pre-bundled in the old system.
6
+ // ember-template-compiler defines them in AMD/requirejs
7
+ import { precompileJSON } from '@glimmer/compiler';
8
+ import { getTemplateLocals } from '@glimmer/syntax';
5
9
  import { setComponentTemplate } from '@ember/component';
6
10
  import templateOnlyComponent from '@ember/component/template-only';
7
11
  import { array, concat, fn, get, hash } from '@ember/helper';
@@ -9,18 +13,12 @@ import { on } from '@ember/modifier';
9
13
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10
14
  // @ts-ignore
11
15
  import { createTemplateFactory } from '@ember/template-factory';
12
- import { importSync } from '@embroider/macros';
13
16
 
14
17
  import { nameFor } from '../utils.ts';
15
18
 
16
19
  import type { CompileResult } from '../types.ts';
17
20
  import type { ComponentLike } from '@glint/template';
18
21
 
19
- // These things are pre-bundled in the old system.
20
- // ember-template-compiler defines them in AMD/requirejs
21
- const { precompileJSON } = importSync('@glimmer/compiler') as any;
22
- const { getTemplateLocals } = importSync('@glimmer/syntax') as any;
23
-
24
22
  /**
25
23
  * compile a template with an empty scope
26
24
  * to use components, helpers, etc, you will need to compile with JS