ember-repl 3.0.0-beta.6 → 3.0.0-beta.7

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.
Files changed (47) hide show
  1. package/declarations/browser/gjs.d.ts +1 -1
  2. package/declarations/browser/gjs.d.ts.map +1 -1
  3. package/declarations/browser/known-modules.d.ts +4 -0
  4. package/declarations/browser/known-modules.d.ts.map +1 -1
  5. package/dist/browser/cjs/index.js +1 -1
  6. package/dist/browser/cjs/index.js.map +1 -1
  7. package/dist/browser/esm/index.js +1 -1
  8. package/dist/browser/esm/index.js.map +1 -1
  9. package/dist/browser/gjs.js +12 -13
  10. package/dist/browser/gjs.js.map +1 -1
  11. package/dist/browser/known-modules.js +4 -4
  12. package/dist/browser/known-modules.js.map +1 -1
  13. package/package.json +52 -51
  14. package/src/browser/cjs/index.ts +1 -1
  15. package/src/browser/esm/index.ts +1 -1
  16. package/src/browser/gjs.ts +13 -15
  17. package/src/browser/known-modules.ts +4 -2
  18. package/declarations/browser/eti/babel-plugin.d.ts +0 -54
  19. package/declarations/browser/eti/babel-plugin.d.ts.map +0 -1
  20. package/declarations/browser/eti/debug.d.ts +0 -2
  21. package/declarations/browser/eti/debug.d.ts.map +0 -1
  22. package/declarations/browser/eti/parse-templates.d.ts +0 -56
  23. package/declarations/browser/eti/parse-templates.d.ts.map +0 -1
  24. package/declarations/browser/eti/preprocess.d.ts +0 -58
  25. package/declarations/browser/eti/preprocess.d.ts.map +0 -1
  26. package/declarations/browser/eti/template-tag-transform.d.ts +0 -15
  27. package/declarations/browser/eti/template-tag-transform.d.ts.map +0 -1
  28. package/declarations/browser/eti/util.d.ts +0 -14
  29. package/declarations/browser/eti/util.d.ts.map +0 -1
  30. package/dist/browser/eti/babel-plugin.js +0 -95
  31. package/dist/browser/eti/babel-plugin.js.map +0 -1
  32. package/dist/browser/eti/debug.js +0 -9
  33. package/dist/browser/eti/debug.js.map +0 -1
  34. package/dist/browser/eti/parse-templates.js +0 -181
  35. package/dist/browser/eti/parse-templates.js.map +0 -1
  36. package/dist/browser/eti/preprocess.js +0 -106
  37. package/dist/browser/eti/preprocess.js.map +0 -1
  38. package/dist/browser/eti/template-tag-transform.js +0 -46
  39. package/dist/browser/eti/template-tag-transform.js.map +0 -1
  40. package/dist/browser/eti/util.js +0 -39
  41. package/dist/browser/eti/util.js.map +0 -1
  42. package/src/browser/eti/babel-plugin.ts +0 -105
  43. package/src/browser/eti/debug.ts +0 -7
  44. package/src/browser/eti/parse-templates.ts +0 -284
  45. package/src/browser/eti/preprocess.ts +0 -187
  46. package/src/browser/eti/template-tag-transform.ts +0 -100
  47. package/src/browser/eti/util.ts +0 -72
@@ -1,4 +1,4 @@
1
1
  import type { Babel } from './types.ts';
2
- export declare function preprocess(input: string, name: string): string;
2
+ export declare function preprocess(input: string, name: string): Promise<string>;
3
3
  export declare function transform(intermediate: string, name: string, options?: any): Promise<ReturnType<Babel['transform']>>;
4
4
  //# sourceMappingURL=gjs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gjs.d.ts","sourceRoot":"","sources":["../../src/browser/gjs.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAIxC,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAUrD;AAED,wBAAsB,SAAS,CAC7B,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,GAAQ,GAChB,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CA6BzC"}
1
+ {"version":3,"file":"gjs.d.ts","sourceRoot":"","sources":["../../src/browser/gjs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AASxC,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ7E;AAED,wBAAsB,SAAS,CAC7B,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,GAAQ,GAChB,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CA6BzC"}
@@ -13,8 +13,10 @@ import * as _destroyable from '@ember/destroyable';
13
13
  import * as _helpers from '@ember/helper';
14
14
  import * as _modifier from '@ember/modifier';
15
15
  import * as _object from '@ember/object';
16
+ import * as _owner from '@ember/owner';
16
17
  import * as _runloop from '@ember/runloop';
17
18
  import * as _service from '@ember/service';
19
+ import * as _template from '@ember/template';
18
20
  import { createTemplateFactory } from '@ember/template-factory';
19
21
  import * as _utils from '@ember/utils';
20
22
  export declare const modules: {
@@ -33,6 +35,8 @@ export declare const modules: {
33
35
  createTemplateFactory: typeof createTemplateFactory;
34
36
  };
35
37
  '@ember/utils': typeof _utils;
38
+ '@ember/template': typeof _template;
39
+ '@ember/owner': typeof _owner;
36
40
  '@glimmer/component': typeof _GlimmerComponent;
37
41
  '@glimmer/tracking': typeof _tracking;
38
42
  };
@@ -1 +1 @@
1
- {"version":3,"file":"known-modules.d.ts","sourceRoot":"","sources":["../../src/browser/known-modules.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,eAAe,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAG3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AAGvC,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;CAkBnB,CAAC"}
1
+ {"version":3,"file":"known-modules.d.ts","sourceRoot":"","sources":["../../src/browser/known-modules.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,eAAe,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AAEvC,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;CAmBnB,CAAC"}
@@ -28,7 +28,7 @@ async function compileGJS({
28
28
  code: input,
29
29
  name
30
30
  }) {
31
- let preprocessed = preprocess(input, name);
31
+ let preprocessed = await preprocess(input, name);
32
32
  let result = await transform(preprocessed, name);
33
33
  if (!result) {
34
34
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/browser/cjs/index.ts"],"sourcesContent":["import { preprocess, transform } from '../gjs.ts';\nimport { nameFor } from '../utils.ts';\nimport { evalSnippet } from './eval.ts';\n\nimport type { CompileResult, ExtraModules } from '../types.ts';\nimport type { ComponentLike } from '@glint/template';\n\nexport interface Info {\n code: string;\n name: string;\n}\n\nexport async function compileJS(code: string, extraModules?: ExtraModules): Promise<CompileResult> {\n let name = nameFor(code);\n let component: undefined | ComponentLike;\n let error: undefined | Error;\n\n try {\n let compiled = await compileGJS({ 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 compileGJS({ code: input, name }: Info) {\n let preprocessed = 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"],"names":["compileJS","code","extraModules","name","nameFor","component","error","compiled","compileGJS","Error","evalSnippet","default","e","input","preprocessed","preprocess","result","transform"],"mappings":";;;;AAYO,eAAeA,SAASA,CAACC,IAAY,EAAEC,YAA2B,EAA0B;AACjG,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,UAAU,CAAC;AAAEP,MAAAA,IAAI,EAAEA,IAAI;AAAEE,MAAAA,IAAAA;AAAK,KAAC,CAAC,CAAA;IAErD,IAAI,CAACI,QAAQ,EAAE;AACb,MAAA,MAAM,IAAIE,KAAK,CAAE,CAAA,0BAAA,CAA2B,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,UAAUA,CAAC;AAAEP,EAAAA,IAAI,EAAEY,KAAK;AAAEV,EAAAA,IAAAA;AAAW,CAAC,EAAE;AACrD,EAAA,IAAIW,YAAY,GAAGC,UAAU,CAACF,KAAK,EAAEV,IAAI,CAAC,CAAA;EAC1C,IAAIa,MAAM,GAAG,MAAMC,SAAS,CAACH,YAAY,EAAEX,IAAI,CAAC,CAAA;EAEhD,IAAI,CAACa,MAAM,EAAE;AACX,IAAA,OAAA;AACF,GAAA;EAEA,IAAI;AAAEf,IAAAA,IAAAA;AAAK,GAAC,GAAGe,MAAM,CAAA;AAErB,EAAA,OAAOf,IAAI,CAAA;AACb;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/browser/cjs/index.ts"],"sourcesContent":["import { preprocess, transform } from '../gjs.ts';\nimport { nameFor } from '../utils.ts';\nimport { evalSnippet } from './eval.ts';\n\nimport type { CompileResult, ExtraModules } from '../types.ts';\nimport type { ComponentLike } from '@glint/template';\n\nexport interface Info {\n code: string;\n name: string;\n}\n\nexport async function compileJS(code: string, extraModules?: ExtraModules): Promise<CompileResult> {\n let name = nameFor(code);\n let component: undefined | ComponentLike;\n let error: undefined | Error;\n\n try {\n let compiled = await compileGJS({ 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 compileGJS({ 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"],"names":["compileJS","code","extraModules","name","nameFor","component","error","compiled","compileGJS","Error","evalSnippet","default","e","input","preprocessed","preprocess","result","transform"],"mappings":";;;;AAYO,eAAeA,SAASA,CAACC,IAAY,EAAEC,YAA2B,EAA0B;AACjG,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,UAAU,CAAC;AAAEP,MAAAA,IAAI,EAAEA,IAAI;AAAEE,MAAAA,IAAAA;AAAK,KAAC,CAAC,CAAA;IAErD,IAAI,CAACI,QAAQ,EAAE;AACb,MAAA,MAAM,IAAIE,KAAK,CAAE,CAAA,0BAAA,CAA2B,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,UAAUA,CAAC;AAAEP,EAAAA,IAAI,EAAEY,KAAK;AAAEV,EAAAA,IAAAA;AAAW,CAAC,EAAE;EACrD,IAAIW,YAAY,GAAG,MAAMC,UAAU,CAACF,KAAK,EAAEV,IAAI,CAAC,CAAA;EAChD,IAAIa,MAAM,GAAG,MAAMC,SAAS,CAACH,YAAY,EAAEX,IAAI,CAAC,CAAA;EAEhD,IAAI,CAACa,MAAM,EAAE;AACX,IAAA,OAAA;AACF,GAAA;EAEA,IAAI;AAAEf,IAAAA,IAAAA;AAAK,GAAC,GAAGe,MAAM,CAAA;AAErB,EAAA,OAAOf,IAAI,CAAA;AACb;;;;"}
@@ -50,7 +50,7 @@ async function compileGJS({
50
50
  code: input,
51
51
  name
52
52
  }) {
53
- let preprocessed = preprocess(input, name);
53
+ let preprocessed = await preprocess(input, name);
54
54
  let result = await transform(preprocessed, name, {
55
55
  modules: false
56
56
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/browser/esm/index.ts"],"sourcesContent":["import { preprocess, transform } from '../gjs.ts';\nimport { modules } from '../known-modules.ts';\nimport { nameFor } from '../utils.ts';\n\nimport type { CompileResult, ExtraModules } from '../types.ts';\nimport type Component from '@glimmer/component';\nimport type { ComponentLike } from '@glint/template';\n\nexport interface Info {\n code: string;\n name: string;\n}\n\nexport async function compileJS(code: string, extraModules?: ExtraModules): Promise<CompileResult> {\n let name = nameFor(code);\n let component: undefined | ComponentLike;\n let error: undefined | Error;\n\n try {\n let compiled = await compileGJS({ code: code, name });\n\n if (!compiled) {\n throw new Error(`Compiled output is missing`);\n }\n\n // NOTE: we cannot `eval` ESM\n compiled = proxyToSkypack(compiled, extraModules);\n component = (await evalSnippet(compiled)) as unknown as ComponentLike;\n } catch (e) {\n error = e as Error | undefined;\n }\n\n return { name, component, error };\n}\n\nexport function proxyToSkypack(code: string, extraModules?: ExtraModules) {\n let knownModules = [...Object.keys(extraModules || {}), ...Object.keys(modules)];\n let origin = location.origin;\n\n let result = code.replaceAll(/from ('|\")([^\"']+)('|\")/g, (_, __, modulePath) => {\n if (knownModules.includes(modulePath)) {\n return `from '${origin}/${modulePath}'`;\n }\n\n return `from 'https://cdn.skypack.dev/${modulePath}'`;\n });\n\n return result;\n}\n\nasync function evalSnippet(code: string) {\n let encodedJs = encodeURIComponent(code);\n let result = await import(\n /* webpackIgnore: true */ `data:text/javascript;charset=utf-8,${encodedJs}`\n );\n\n if (!result.default) {\n throw new Error(`Expected module to have a default export, found ${Object.keys(result)}`);\n }\n\n return result as {\n default: Component;\n services?: { [key: string]: unknown };\n };\n}\n\nasync function compileGJS({ code: input, name }: Info) {\n let preprocessed = preprocess(input, name);\n let result = await transform(preprocessed, name, {\n modules: false,\n });\n\n if (!result) {\n return;\n }\n\n let { code } = result;\n\n return code;\n}\n"],"names":["compileJS","code","extraModules","name","nameFor","component","error","compiled","compileGJS","Error","proxyToSkypack","evalSnippet","e","knownModules","Object","keys","modules","origin","location","result","replaceAll","_","__","modulePath","includes","encodedJs","encodeURIComponent","default","input","preprocessed","preprocess","transform"],"mappings":";;;;AAaO,eAAeA,SAASA,CAACC,IAAY,EAAEC,YAA2B,EAA0B;AACjG,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,UAAU,CAAC;AAAEP,MAAAA,IAAI,EAAEA,IAAI;AAAEE,MAAAA,IAAAA;AAAK,KAAC,CAAC,CAAA;IAErD,IAAI,CAACI,QAAQ,EAAE;AACb,MAAA,MAAM,IAAIE,KAAK,CAAE,CAAA,0BAAA,CAA2B,CAAC,CAAA;AAC/C,KAAA;;AAEA;AACAF,IAAAA,QAAQ,GAAGG,cAAc,CAACH,QAAQ,EAAEL,YAAY,CAAC,CAAA;AACjDG,IAAAA,SAAS,GAAI,MAAMM,WAAW,CAACJ,QAAQ,CAA8B,CAAA;GACtE,CAAC,OAAOK,CAAC,EAAE;AACVN,IAAAA,KAAK,GAAGM,CAAsB,CAAA;AAChC,GAAA;EAEA,OAAO;IAAET,IAAI;IAAEE,SAAS;AAAEC,IAAAA,KAAAA;GAAO,CAAA;AACnC,CAAA;AAEO,SAASI,cAAcA,CAACT,IAAY,EAAEC,YAA2B,EAAE;EACxE,IAAIW,YAAY,GAAG,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACb,YAAY,IAAI,EAAE,CAAC,EAAE,GAAGY,MAAM,CAACC,IAAI,CAACC,OAAO,CAAC,CAAC,CAAA;AAChF,EAAA,IAAIC,MAAM,GAAGC,QAAQ,CAACD,MAAM,CAAA;AAE5B,EAAA,IAAIE,MAAM,GAAGlB,IAAI,CAACmB,UAAU,CAAC,0BAA0B,EAAE,CAACC,CAAC,EAAEC,EAAE,EAAEC,UAAU,KAAK;AAC9E,IAAA,IAAIV,YAAY,CAACW,QAAQ,CAACD,UAAU,CAAC,EAAE;AACrC,MAAA,OAAQ,CAAQN,MAAAA,EAAAA,MAAO,CAAGM,CAAAA,EAAAA,UAAW,CAAE,CAAA,CAAA,CAAA;AACzC,KAAA;IAEA,OAAQ,CAAA,8BAAA,EAAgCA,UAAW,CAAE,CAAA,CAAA,CAAA;AACvD,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOJ,MAAM,CAAA;AACf,CAAA;AAEA,eAAeR,WAAWA,CAACV,IAAY,EAAE;AACvC,EAAA,IAAIwB,SAAS,GAAGC,kBAAkB,CAACzB,IAAI,CAAC,CAAA;EACxC,IAAIkB,MAAM,GAAG,MAAM,iCACU,CAAA,mCAAA,EAAqCM,SAAU,CAAA,CAC5E,CAAC,CAAA;AAED,EAAA,IAAI,CAACN,MAAM,CAACQ,OAAO,EAAE;IACnB,MAAM,IAAIlB,KAAK,CAAE,CAAkDK,gDAAAA,EAAAA,MAAM,CAACC,IAAI,CAACI,MAAM,CAAE,CAAA,CAAC,CAAC,CAAA;AAC3F,GAAA;AAEA,EAAA,OAAOA,MAAM,CAAA;AAIf,CAAA;AAEA,eAAeX,UAAUA,CAAC;AAAEP,EAAAA,IAAI,EAAE2B,KAAK;AAAEzB,EAAAA,IAAAA;AAAW,CAAC,EAAE;AACrD,EAAA,IAAI0B,YAAY,GAAGC,UAAU,CAACF,KAAK,EAAEzB,IAAI,CAAC,CAAA;EAC1C,IAAIgB,MAAM,GAAG,MAAMY,SAAS,CAACF,YAAY,EAAE1B,IAAI,EAAE;AAC/Ca,IAAAA,OAAO,EAAE,KAAA;AACX,GAAC,CAAC,CAAA;EAEF,IAAI,CAACG,MAAM,EAAE;AACX,IAAA,OAAA;AACF,GAAA;EAEA,IAAI;AAAElB,IAAAA,IAAAA;AAAK,GAAC,GAAGkB,MAAM,CAAA;AAErB,EAAA,OAAOlB,IAAI,CAAA;AACb;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/browser/esm/index.ts"],"sourcesContent":["import { preprocess, transform } from '../gjs.ts';\nimport { modules } from '../known-modules.ts';\nimport { nameFor } from '../utils.ts';\n\nimport type { CompileResult, ExtraModules } from '../types.ts';\nimport type Component from '@glimmer/component';\nimport type { ComponentLike } from '@glint/template';\n\nexport interface Info {\n code: string;\n name: string;\n}\n\nexport async function compileJS(code: string, extraModules?: ExtraModules): Promise<CompileResult> {\n let name = nameFor(code);\n let component: undefined | ComponentLike;\n let error: undefined | Error;\n\n try {\n let compiled = await compileGJS({ code: code, name });\n\n if (!compiled) {\n throw new Error(`Compiled output is missing`);\n }\n\n // NOTE: we cannot `eval` ESM\n compiled = proxyToSkypack(compiled, extraModules);\n component = (await evalSnippet(compiled)) as unknown as ComponentLike;\n } catch (e) {\n error = e as Error | undefined;\n }\n\n return { name, component, error };\n}\n\nexport function proxyToSkypack(code: string, extraModules?: ExtraModules) {\n let knownModules = [...Object.keys(extraModules || {}), ...Object.keys(modules)];\n let origin = location.origin;\n\n let result = code.replaceAll(/from ('|\")([^\"']+)('|\")/g, (_, __, modulePath) => {\n if (knownModules.includes(modulePath)) {\n return `from '${origin}/${modulePath}'`;\n }\n\n return `from 'https://cdn.skypack.dev/${modulePath}'`;\n });\n\n return result;\n}\n\nasync function evalSnippet(code: string) {\n let encodedJs = encodeURIComponent(code);\n let result = await import(\n /* webpackIgnore: true */ `data:text/javascript;charset=utf-8,${encodedJs}`\n );\n\n if (!result.default) {\n throw new Error(`Expected module to have a default export, found ${Object.keys(result)}`);\n }\n\n return result as {\n default: Component;\n services?: { [key: string]: unknown };\n };\n}\n\nasync function compileGJS({ code: input, name }: Info) {\n let preprocessed = await preprocess(input, name);\n let result = await transform(preprocessed, name, {\n modules: false,\n });\n\n if (!result) {\n return;\n }\n\n let { code } = result;\n\n return code;\n}\n"],"names":["compileJS","code","extraModules","name","nameFor","component","error","compiled","compileGJS","Error","proxyToSkypack","evalSnippet","e","knownModules","Object","keys","modules","origin","location","result","replaceAll","_","__","modulePath","includes","encodedJs","encodeURIComponent","default","input","preprocessed","preprocess","transform"],"mappings":";;;;AAaO,eAAeA,SAASA,CAACC,IAAY,EAAEC,YAA2B,EAA0B;AACjG,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,UAAU,CAAC;AAAEP,MAAAA,IAAI,EAAEA,IAAI;AAAEE,MAAAA,IAAAA;AAAK,KAAC,CAAC,CAAA;IAErD,IAAI,CAACI,QAAQ,EAAE;AACb,MAAA,MAAM,IAAIE,KAAK,CAAE,CAAA,0BAAA,CAA2B,CAAC,CAAA;AAC/C,KAAA;;AAEA;AACAF,IAAAA,QAAQ,GAAGG,cAAc,CAACH,QAAQ,EAAEL,YAAY,CAAC,CAAA;AACjDG,IAAAA,SAAS,GAAI,MAAMM,WAAW,CAACJ,QAAQ,CAA8B,CAAA;GACtE,CAAC,OAAOK,CAAC,EAAE;AACVN,IAAAA,KAAK,GAAGM,CAAsB,CAAA;AAChC,GAAA;EAEA,OAAO;IAAET,IAAI;IAAEE,SAAS;AAAEC,IAAAA,KAAAA;GAAO,CAAA;AACnC,CAAA;AAEO,SAASI,cAAcA,CAACT,IAAY,EAAEC,YAA2B,EAAE;EACxE,IAAIW,YAAY,GAAG,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACb,YAAY,IAAI,EAAE,CAAC,EAAE,GAAGY,MAAM,CAACC,IAAI,CAACC,OAAO,CAAC,CAAC,CAAA;AAChF,EAAA,IAAIC,MAAM,GAAGC,QAAQ,CAACD,MAAM,CAAA;AAE5B,EAAA,IAAIE,MAAM,GAAGlB,IAAI,CAACmB,UAAU,CAAC,0BAA0B,EAAE,CAACC,CAAC,EAAEC,EAAE,EAAEC,UAAU,KAAK;AAC9E,IAAA,IAAIV,YAAY,CAACW,QAAQ,CAACD,UAAU,CAAC,EAAE;AACrC,MAAA,OAAQ,CAAQN,MAAAA,EAAAA,MAAO,CAAGM,CAAAA,EAAAA,UAAW,CAAE,CAAA,CAAA,CAAA;AACzC,KAAA;IAEA,OAAQ,CAAA,8BAAA,EAAgCA,UAAW,CAAE,CAAA,CAAA,CAAA;AACvD,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOJ,MAAM,CAAA;AACf,CAAA;AAEA,eAAeR,WAAWA,CAACV,IAAY,EAAE;AACvC,EAAA,IAAIwB,SAAS,GAAGC,kBAAkB,CAACzB,IAAI,CAAC,CAAA;EACxC,IAAIkB,MAAM,GAAG,MAAM,iCACU,CAAA,mCAAA,EAAqCM,SAAU,CAAA,CAC5E,CAAC,CAAA;AAED,EAAA,IAAI,CAACN,MAAM,CAACQ,OAAO,EAAE;IACnB,MAAM,IAAIlB,KAAK,CAAE,CAAkDK,gDAAAA,EAAAA,MAAM,CAACC,IAAI,CAACI,MAAM,CAAE,CAAA,CAAC,CAAC,CAAA;AAC3F,GAAA;AAEA,EAAA,OAAOA,MAAM,CAAA;AAIf,CAAA;AAEA,eAAeX,UAAUA,CAAC;AAAEP,EAAAA,IAAI,EAAE2B,KAAK;AAAEzB,EAAAA,IAAAA;AAAW,CAAC,EAAE;EACrD,IAAI0B,YAAY,GAAG,MAAMC,UAAU,CAACF,KAAK,EAAEzB,IAAI,CAAC,CAAA;EAChD,IAAIgB,MAAM,GAAG,MAAMY,SAAS,CAACF,YAAY,EAAE1B,IAAI,EAAE;AAC/Ca,IAAAA,OAAO,EAAE,KAAA;AACX,GAAC,CAAC,CAAA;EAEF,IAAI,CAACG,MAAM,EAAE;AACX,IAAA,OAAA;AACF,GAAA;EAEA,IAAI;AAAElB,IAAAA,IAAAA;AAAK,GAAC,GAAGkB,MAAM,CAAA;AAErB,EAAA,OAAOlB,IAAI,CAAA;AACb;;;;"}
@@ -1,25 +1,24 @@
1
1
  import { importSync } from '@embroider/macros';
2
2
  import babelPluginEmberTemplateCompilation from 'babel-plugin-ember-template-compilation';
3
- import babelPluginIntermediateGJS from './eti/babel-plugin.js';
4
- import { preprocessEmbeddedTemplates } from './eti/preprocess.js';
5
- import { TEMPLATE_TAG_NAME, TEMPLATE_TAG_PLACEHOLDER } from './eti/util.js';
3
+ import { createPreprocessor } from 'content-tag/standalone';
6
4
 
7
5
  const compiler = importSync('ember-source/dist/ember-template-compiler.js');
8
- function preprocess(input, name) {
9
- let preprocessed = preprocessEmbeddedTemplates(input, {
10
- relativePath: `${name}.js`,
11
- includeSourceMaps: false,
12
- includeTemplateTokens: true,
13
- templateTag: TEMPLATE_TAG_NAME,
14
- templateTagReplacement: TEMPLATE_TAG_PLACEHOLDER
15
- });
16
- return preprocessed.output;
6
+ let processor;
7
+ let fetchingPromise;
8
+ async function preprocess(input, name) {
9
+ if (!fetchingPromise) {
10
+ fetchingPromise = createPreprocessor();
11
+ }
12
+ processor = await fetchingPromise;
13
+ return processor.process(input, `${name}.js`);
17
14
  }
18
15
  async function transform(intermediate, name, options = {}) {
19
16
  let babel = await import('@babel/standalone');
20
17
  return babel.transform(intermediate, {
21
18
  filename: `${name}.js`,
22
- plugins: [[babelPluginIntermediateGJS], [babelPluginEmberTemplateCompilation, {
19
+ plugins: [
20
+ // [babelPluginIntermediateGJS],
21
+ [babelPluginEmberTemplateCompilation, {
23
22
  compiler
24
23
  }], [babel.availablePlugins['proposal-decorators'], {
25
24
  legacy: true
@@ -1 +1 @@
1
- {"version":3,"file":"gjs.js","sources":["../../src/browser/gjs.ts"],"sourcesContent":["import { importSync } from '@embroider/macros';\n\nimport babelPluginEmberTemplateCompilation from 'babel-plugin-ember-template-compilation';\n\n// TODO: use real packages, and not these copied files from ember-template-imports\nimport babelPluginIntermediateGJS from './eti/babel-plugin.ts';\nimport { preprocessEmbeddedTemplates } from './eti/preprocess.ts';\nimport { TEMPLATE_TAG_NAME, TEMPLATE_TAG_PLACEHOLDER } from './eti/util.ts';\n\nimport type { Babel } from './types.ts';\n\nconst compiler = importSync('ember-source/dist/ember-template-compiler.js');\n\nexport function preprocess(input: string, name: string) {\n let preprocessed = preprocessEmbeddedTemplates(input, {\n relativePath: `${name}.js`,\n includeSourceMaps: false,\n includeTemplateTokens: true,\n templateTag: TEMPLATE_TAG_NAME,\n templateTagReplacement: TEMPLATE_TAG_PLACEHOLDER,\n });\n\n return preprocessed.output;\n}\n\nexport async 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":["compiler","importSync","preprocess","input","name","preprocessed","preprocessEmbeddedTemplates","relativePath","includeSourceMaps","includeTemplateTokens","templateTag","TEMPLATE_TAG_NAME","templateTagReplacement","TEMPLATE_TAG_PLACEHOLDER","output","transform","intermediate","options","babel","filename","plugins","babelPluginIntermediateGJS","babelPluginEmberTemplateCompilation","availablePlugins","legacy","presets","availablePresets","modules","targets","esmodules","forceAllTransforms"],"mappings":";;;;;;AAWA,MAAMA,QAAQ,GAAGC,UAAU,CAAC,8CAA8C,CAAC,CAAA;AAEpE,SAASC,UAAUA,CAACC,KAAa,EAAEC,IAAY,EAAE;AACtD,EAAA,IAAIC,YAAY,GAAGC,2BAA2B,CAACH,KAAK,EAAE;IACpDI,YAAY,EAAG,CAAEH,EAAAA,IAAK,CAAI,GAAA,CAAA;AAC1BI,IAAAA,iBAAiB,EAAE,KAAK;AACxBC,IAAAA,qBAAqB,EAAE,IAAI;AAC3BC,IAAAA,WAAW,EAAEC,iBAAiB;AAC9BC,IAAAA,sBAAsB,EAAEC,wBAAAA;AAC1B,GAAC,CAAC,CAAA;EAEF,OAAOR,YAAY,CAACS,MAAM,CAAA;AAC5B,CAAA;AAEO,eAAeC,SAASA,CAC7BC,YAAoB,EACpBZ,IAAY,EACZa,OAAY,GAAG,EAAE,EACwB;AACzC,EAAA,IAAIC,KAAK,GAAI,MAAM,OAAO,mBAAmB,CAAW,CAAA;AAExD,EAAA,OAAOA,KAAK,CAACH,SAAS,CAACC,YAAY,EAAE;IACnCG,QAAQ,EAAG,CAAEf,EAAAA,IAAK,CAAI,GAAA,CAAA;IACtBgB,OAAO,EAAE,CACP,CAACC,0BAA0B,CAAC,EAC5B,CACEC,mCAAmC,EACnC;AACEtB,MAAAA,QAAAA;KACD,CACF,EACD,CAACkB,KAAK,CAACK,gBAAgB,CAAC,qBAAqB,CAAC,EAAE;AAAEC,MAAAA,MAAM,EAAE,IAAA;KAAM,CAAC,EACjE,CAACN,KAAK,CAACK,gBAAgB,CAAC,2BAA2B,CAAC,CAAC,CACtD;IACDE,OAAO,EAAE,CACP,CACEP,KAAK,CAACQ,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
+ {"version":3,"file":"gjs.js","sources":["../../src/browser/gjs.ts"],"sourcesContent":["import { importSync } from '@embroider/macros';\n\nimport babelPluginEmberTemplateCompilation from 'babel-plugin-ember-template-compilation';\n\nimport type { Babel } from './types.ts';\n\nconst compiler = importSync('ember-source/dist/ember-template-compiler.js');\n\nimport { createPreprocessor } from 'content-tag/standalone';\n\nlet processor;\nlet fetchingPromise: Promise<any>;\n\nexport async function preprocess(input: string, name: string): Promise<string> {\n if (!fetchingPromise) {\n fetchingPromise = createPreprocessor();\n }\n\n processor = await fetchingPromise;\n\n return processor.process(input, `${name}.js`);\n}\n\nexport async 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":["compiler","importSync","processor","fetchingPromise","preprocess","input","name","createPreprocessor","process","transform","intermediate","options","babel","filename","plugins","babelPluginEmberTemplateCompilation","availablePlugins","legacy","presets","availablePresets","modules","targets","esmodules","forceAllTransforms"],"mappings":";;;;AAMA,MAAMA,QAAQ,GAAGC,UAAU,CAAC,8CAA8C,CAAC,CAAA;AAI3E,IAAIC,SAAS,CAAA;AACb,IAAIC,eAA6B,CAAA;AAE1B,eAAeC,UAAUA,CAACC,KAAa,EAAEC,IAAY,EAAmB;EAC7E,IAAI,CAACH,eAAe,EAAE;IACpBA,eAAe,GAAGI,kBAAkB,EAAE,CAAA;AACxC,GAAA;EAEAL,SAAS,GAAG,MAAMC,eAAe,CAAA;EAEjC,OAAOD,SAAS,CAACM,OAAO,CAACH,KAAK,EAAG,CAAA,EAAEC,IAAK,CAAA,GAAA,CAAI,CAAC,CAAA;AAC/C,CAAA;AAEO,eAAeG,SAASA,CAC7BC,YAAoB,EACpBJ,IAAY,EACZK,OAAY,GAAG,EAAE,EACwB;AACzC,EAAA,IAAIC,KAAK,GAAI,MAAM,OAAO,mBAAmB,CAAW,CAAA;AAExD,EAAA,OAAOA,KAAK,CAACH,SAAS,CAACC,YAAY,EAAE;IACnCG,QAAQ,EAAG,CAAEP,EAAAA,IAAK,CAAI,GAAA,CAAA;AACtBQ,IAAAA,OAAO,EAAE;AACP;AACA,IAAA,CACEC,mCAAmC,EACnC;AACEf,MAAAA,QAAAA;KACD,CACF,EACD,CAACY,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;;;;"}
@@ -9,8 +9,10 @@ import * as _destroyable from '@ember/destroyable';
9
9
  import * as _helpers from '@ember/helper';
10
10
  import * as _modifier from '@ember/modifier';
11
11
  import * as _object from '@ember/object';
12
+ import * as _owner from '@ember/owner';
12
13
  import * as _runloop from '@ember/runloop';
13
14
  import * as _service from '@ember/service';
15
+ import * as _template from '@ember/template';
14
16
  import { createTemplateFactory } from '@ember/template-factory';
15
17
  import * as _utils from '@ember/utils';
16
18
 
@@ -18,8 +20,6 @@ import * as _utils from '@ember/utils';
18
20
  * We need to import and hang on to these references so that they
19
21
  * don't get optimized away during deploy
20
22
  */
21
- // import * as _owner from '@ember/owner';
22
-
23
23
  const modules = {
24
24
  '@ember/application': _application,
25
25
  '@ember/array': _array,
@@ -36,8 +36,8 @@ const modules = {
36
36
  createTemplateFactory
37
37
  },
38
38
  '@ember/utils': _utils,
39
- // '@ember/owner': _owner,
40
-
39
+ '@ember/template': _template,
40
+ '@ember/owner': _owner,
41
41
  '@glimmer/component': _GlimmerComponent,
42
42
  '@glimmer/tracking': _tracking
43
43
  };
@@ -1 +1 @@
1
- {"version":3,"file":"known-modules.js","sources":["../../src/browser/known-modules.ts"],"sourcesContent":["/**\n * We need to import and hang on to these references so that they\n * don't get optimized away during deploy\n */\nimport _GlimmerComponent from '@glimmer/component';\nimport * as _tracking from '@glimmer/tracking';\nimport * as _application from '@ember/application';\nimport * as _array from '@ember/array';\nimport * as _EmberComponent from '@ember/component';\nimport _TO from '@ember/component/template-only';\nimport * as _debug from '@ember/debug';\nimport * as _destroyable from '@ember/destroyable';\nimport * as _helpers from '@ember/helper';\nimport * as _modifier from '@ember/modifier';\nimport * as _object from '@ember/object';\nimport * as _runloop from '@ember/runloop';\nimport * as _service from '@ember/service';\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { createTemplateFactory } from '@ember/template-factory';\nimport * as _utils from '@ember/utils';\n// import * as _owner from '@ember/owner';\n\nexport const modules = {\n '@ember/application': _application,\n '@ember/array': _array,\n '@ember/component': _EmberComponent,\n '@ember/component/template-only': _TO,\n '@ember/debug': _debug,\n '@ember/destroyable': _destroyable,\n '@ember/helper': _helpers,\n '@ember/modifier': _modifier,\n '@ember/object': _object,\n '@ember/runloop': _runloop,\n '@ember/service': _service,\n '@ember/template-factory': { createTemplateFactory },\n '@ember/utils': _utils,\n // '@ember/owner': _owner,\n\n '@glimmer/component': _GlimmerComponent,\n '@glimmer/tracking': _tracking,\n};\n"],"names":["modules","_application","_array","_EmberComponent","_TO","_debug","_destroyable","_helpers","_modifier","_object","_runloop","_service","createTemplateFactory","_utils","_GlimmerComponent","_tracking"],"mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AAkBA;;AAEO,MAAMA,OAAO,GAAG;AACrB,EAAA,oBAAoB,EAAEC,YAAY;AAClC,EAAA,cAAc,EAAEC,MAAM;AACtB,EAAA,kBAAkB,EAAEC,eAAe;AACnC,EAAA,gCAAgC,EAAEC,GAAG;AACrC,EAAA,cAAc,EAAEC,MAAM;AACtB,EAAA,oBAAoB,EAAEC,YAAY;AAClC,EAAA,eAAe,EAAEC,QAAQ;AACzB,EAAA,iBAAiB,EAAEC,SAAS;AAC5B,EAAA,eAAe,EAAEC,OAAO;AACxB,EAAA,gBAAgB,EAAEC,QAAQ;AAC1B,EAAA,gBAAgB,EAAEC,QAAQ;AAC1B,EAAA,yBAAyB,EAAE;AAAEC,IAAAA,qBAAAA;GAAuB;AACpD,EAAA,cAAc,EAAEC,MAAM;AACtB;;AAEA,EAAA,oBAAoB,EAAEC,iBAAiB;AACvC,EAAA,mBAAmB,EAAEC,SAAAA;AACvB;;;;"}
1
+ {"version":3,"file":"known-modules.js","sources":["../../src/browser/known-modules.ts"],"sourcesContent":["/**\n * We need to import and hang on to these references so that they\n * don't get optimized away during deploy\n */\nimport _GlimmerComponent from '@glimmer/component';\nimport * as _tracking from '@glimmer/tracking';\nimport * as _application from '@ember/application';\nimport * as _array from '@ember/array';\nimport * as _EmberComponent from '@ember/component';\nimport _TO from '@ember/component/template-only';\nimport * as _debug from '@ember/debug';\nimport * as _destroyable from '@ember/destroyable';\nimport * as _helpers from '@ember/helper';\nimport * as _modifier from '@ember/modifier';\nimport * as _object from '@ember/object';\nimport * as _owner from '@ember/owner';\nimport * as _runloop from '@ember/runloop';\nimport * as _service from '@ember/service';\nimport * as _template from '@ember/template';\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { createTemplateFactory } from '@ember/template-factory';\nimport * as _utils from '@ember/utils';\n\nexport const modules = {\n '@ember/application': _application,\n '@ember/array': _array,\n '@ember/component': _EmberComponent,\n '@ember/component/template-only': _TO,\n '@ember/debug': _debug,\n '@ember/destroyable': _destroyable,\n '@ember/helper': _helpers,\n '@ember/modifier': _modifier,\n '@ember/object': _object,\n '@ember/runloop': _runloop,\n '@ember/service': _service,\n '@ember/template-factory': { createTemplateFactory },\n '@ember/utils': _utils,\n '@ember/template': _template,\n '@ember/owner': _owner,\n\n '@glimmer/component': _GlimmerComponent,\n '@glimmer/tracking': _tracking,\n};\n"],"names":["modules","_application","_array","_EmberComponent","_TO","_debug","_destroyable","_helpers","_modifier","_object","_runloop","_service","createTemplateFactory","_utils","_template","_owner","_GlimmerComponent","_tracking"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AAqBO,MAAMA,OAAO,GAAG;AACrB,EAAA,oBAAoB,EAAEC,YAAY;AAClC,EAAA,cAAc,EAAEC,MAAM;AACtB,EAAA,kBAAkB,EAAEC,eAAe;AACnC,EAAA,gCAAgC,EAAEC,GAAG;AACrC,EAAA,cAAc,EAAEC,MAAM;AACtB,EAAA,oBAAoB,EAAEC,YAAY;AAClC,EAAA,eAAe,EAAEC,QAAQ;AACzB,EAAA,iBAAiB,EAAEC,SAAS;AAC5B,EAAA,eAAe,EAAEC,OAAO;AACxB,EAAA,gBAAgB,EAAEC,QAAQ;AAC1B,EAAA,gBAAgB,EAAEC,QAAQ;AAC1B,EAAA,yBAAyB,EAAE;AAAEC,IAAAA,qBAAAA;GAAuB;AACpD,EAAA,cAAc,EAAEC,MAAM;AACtB,EAAA,iBAAiB,EAAEC,SAAS;AAC5B,EAAA,cAAc,EAAEC,MAAM;AAEtB,EAAA,oBAAoB,EAAEC,iBAAiB;AACvC,EAAA,mBAAmB,EAAEC,SAAAA;AACvB;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-repl",
3
- "version": "3.0.0-beta.6",
3
+ "version": "3.0.0-beta.7",
4
4
  "description": "Addon for enabling REPL and Playground creation with Ember/Glimmer",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -60,16 +60,17 @@
60
60
  ],
61
61
  "dependencies": {
62
62
  "@babel/helper-plugin-utils": "^7.22.5",
63
- "@babel/standalone": "^7.22.14",
64
- "@embroider/addon-shim": "1.8.6",
65
- "@embroider/macros": "1.13.1",
66
- "babel-import-util": "^1.4.1",
67
- "babel-plugin-ember-template-compilation": "^2.2.0",
63
+ "@babel/standalone": "^7.23.4",
64
+ "@embroider/addon-shim": "1.8.7",
65
+ "@embroider/macros": "1.13.3",
66
+ "babel-import-util": "^2.0.1",
67
+ "babel-plugin-ember-template-compilation": "^2.2.1",
68
68
  "broccoli-file-creator": "^2.1.1",
69
- "change-case": "^4.1.2",
69
+ "change-case": "^5.2.0",
70
70
  "common-tags": "^1.8.2",
71
+ "content-tag": "github:NullVoxPopuli/content-tag#browser-support-dist",
71
72
  "line-column": "^1.0.2",
72
- "magic-string": "^0.30.3",
73
+ "magic-string": "^0.30.5",
73
74
  "mdast": "^3.0.0",
74
75
  "parse-static-imports": "^1.1.0",
75
76
  "rehype-raw": "^6.1.1",
@@ -79,54 +80,54 @@
79
80
  "remark-rehype": "^10.1.0",
80
81
  "unified": "^10.1.2",
81
82
  "unist-util-visit": "^5.0.0",
82
- "uuid": "^9.0.0",
83
+ "uuid": "^9.0.1",
83
84
  "vfile": "^6.0.1"
84
85
  },
85
86
  "devDependencies": {
86
- "@babel/core": "^7.22.11",
87
- "@babel/preset-typescript": "^7.22.11",
88
- "@babel/types": "^7.22.11",
89
- "@ember/test-helpers": "^3.2.0",
90
- "@ember/test-waiters": "^3.0.2",
91
- "@embroider/addon-dev": "4.1.0",
92
- "@glimmer/compiler": "^0.84.3",
87
+ "@babel/core": "^7.23.3",
88
+ "@babel/preset-typescript": "^7.23.3",
89
+ "@babel/types": "^7.23.4",
90
+ "@ember/test-helpers": "^3.2.1",
91
+ "@ember/test-waiters": "^3.1.0",
92
+ "@embroider/addon-dev": "4.1.2",
93
+ "@glimmer/compiler": "^0.85.13",
93
94
  "@glimmer/component": "^1.1.2",
94
- "@glimmer/interfaces": "^0.84.3",
95
- "@glimmer/reference": "^0.84.3",
96
- "@glimmer/syntax": "^0.84.3",
95
+ "@glimmer/interfaces": "^0.85.13",
96
+ "@glimmer/reference": "^0.85.13",
97
+ "@glimmer/syntax": "^0.85.13",
97
98
  "@glimmer/tracking": "^1.1.2",
98
- "@glimmer/util": "^0.84.3",
99
- "@glint/core": "^1.1.0",
100
- "@glint/environment-ember-loose": "^1.1.0",
101
- "@glint/environment-ember-template-imports": "^1.1.0",
102
- "@glint/template": "^1.1.0",
99
+ "@glimmer/util": "^0.85.13",
100
+ "@glint/core": "^1.2.1",
101
+ "@glint/environment-ember-loose": "^1.2.1",
102
+ "@glint/environment-ember-template-imports": "^1.2.1",
103
+ "@glint/template": "^1.2.1",
103
104
  "@nullvoxpopuli/eslint-configs": "^3.2.2",
104
- "@rollup/plugin-babel": "^6.0.3",
105
- "@rollup/plugin-commonjs": "^25.0.4",
106
- "@tsconfig/ember": "^3.0.0",
107
- "@types/babel__core": "^7.20.1",
108
- "@types/babel__standalone": "^7.1.4",
109
- "@types/babel__traverse": "^7.20.1",
110
- "@types/hast": "^3.0.0",
111
- "@types/mdast": "^4.0.0",
112
- "@types/unist": "^3.0.0",
113
- "@types/uuid": "^9.0.3",
114
- "@typescript-eslint/eslint-plugin": "^6.5.0",
115
- "@typescript-eslint/parser": "^6.5.0",
116
- "concurrently": "^8.2.1",
117
- "ember-resources": "^6.4.0",
118
- "ember-source": "^5.2.0",
105
+ "@rollup/plugin-babel": "^6.0.4",
106
+ "@rollup/plugin-commonjs": "^25.0.7",
107
+ "@tsconfig/ember": "^3.0.2",
108
+ "@types/babel__core": "^7.20.4",
109
+ "@types/babel__standalone": "^7.1.7",
110
+ "@types/babel__traverse": "^7.20.4",
111
+ "@types/hast": "^3.0.3",
112
+ "@types/mdast": "^4.0.3",
113
+ "@types/unist": "^3.0.2",
114
+ "@types/uuid": "^9.0.7",
115
+ "@typescript-eslint/eslint-plugin": "^6.9.1",
116
+ "@typescript-eslint/parser": "^6.9.1",
117
+ "concurrently": "^8.2.2",
118
+ "ember-resources": "^6.4.2",
119
+ "ember-source": "^5.4.0",
119
120
  "ember-template-imports": "^3.4.2",
120
- "ember-template-lint": "^5.11.2",
121
- "eslint": "^8.48.0",
121
+ "ember-template-lint": "^5.12.0",
122
+ "eslint": "^8.53.0",
122
123
  "eslint-plugin-ember": "^11.11.1",
123
124
  "eslint-plugin-node": "^11.1.0",
124
- "eslint-plugin-prettier": "^5.0.0",
125
+ "eslint-plugin-prettier": "^5.0.1",
125
126
  "prettier": "^3.0.3",
126
- "prettier-plugin-ember-template-tag": "^1.0.2",
127
- "publint": "^0.2.2",
128
- "rollup": "~3.28.1",
129
- "rollup-plugin-copy": "^3.4.0",
127
+ "prettier-plugin-ember-template-tag": "^1.1.0",
128
+ "publint": "^0.2.5",
129
+ "rollup": "~4.5.0",
130
+ "rollup-plugin-copy": "^3.5.0",
130
131
  "rollup-plugin-glimmer-template-tag": "^0.4.1",
131
132
  "typescript": "^5.2.2",
132
133
  "@nullvoxpopuli/limber-untyped": "0.0.0"
@@ -144,12 +145,12 @@
144
145
  "app-js": {}
145
146
  },
146
147
  "peerDependencies": {
147
- "@glimmer/compiler": "^0.84.3",
148
+ "@glimmer/compiler": "^0.85.13",
148
149
  "@glimmer/component": "^1.1.2",
149
- "@glimmer/syntax": "^0.84.3",
150
- "@glint/template": "^1.1.0",
151
- "ember-resources": "^6.4.0",
152
- "ember-source": "^5.2.0"
150
+ "@glimmer/syntax": "^0.85.13",
151
+ "@glint/template": "^1.2.1",
152
+ "ember-resources": "^6.4.2",
153
+ "ember-source": "^5.4.0"
153
154
  },
154
155
  "engines": {
155
156
  "node": ">= v16",
@@ -31,7 +31,7 @@ export async function compileJS(code: string, extraModules?: ExtraModules): Prom
31
31
  }
32
32
 
33
33
  async function compileGJS({ code: input, name }: Info) {
34
- let preprocessed = preprocess(input, name);
34
+ let preprocessed = await preprocess(input, name);
35
35
  let result = await transform(preprocessed, name);
36
36
 
37
37
  if (!result) {
@@ -65,7 +65,7 @@ async function evalSnippet(code: string) {
65
65
  }
66
66
 
67
67
  async function compileGJS({ code: input, name }: Info) {
68
- let preprocessed = preprocess(input, name);
68
+ let preprocessed = await preprocess(input, name);
69
69
  let result = await transform(preprocessed, name, {
70
70
  modules: false,
71
71
  });
@@ -2,25 +2,23 @@ import { importSync } from '@embroider/macros';
2
2
 
3
3
  import babelPluginEmberTemplateCompilation from 'babel-plugin-ember-template-compilation';
4
4
 
5
- // TODO: use real packages, and not these copied files from ember-template-imports
6
- import babelPluginIntermediateGJS from './eti/babel-plugin.ts';
7
- import { preprocessEmbeddedTemplates } from './eti/preprocess.ts';
8
- import { TEMPLATE_TAG_NAME, TEMPLATE_TAG_PLACEHOLDER } from './eti/util.ts';
9
-
10
5
  import type { Babel } from './types.ts';
11
6
 
12
7
  const compiler = importSync('ember-source/dist/ember-template-compiler.js');
13
8
 
14
- export function preprocess(input: string, name: string) {
15
- let preprocessed = preprocessEmbeddedTemplates(input, {
16
- relativePath: `${name}.js`,
17
- includeSourceMaps: false,
18
- includeTemplateTokens: true,
19
- templateTag: TEMPLATE_TAG_NAME,
20
- templateTagReplacement: TEMPLATE_TAG_PLACEHOLDER,
21
- });
9
+ import { createPreprocessor } from 'content-tag/standalone';
10
+
11
+ let processor;
12
+ let fetchingPromise: Promise<any>;
13
+
14
+ export async function preprocess(input: string, name: string): Promise<string> {
15
+ if (!fetchingPromise) {
16
+ fetchingPromise = createPreprocessor();
17
+ }
18
+
19
+ processor = await fetchingPromise;
22
20
 
23
- return preprocessed.output;
21
+ return processor.process(input, `${name}.js`);
24
22
  }
25
23
 
26
24
  export async function transform(
@@ -33,7 +31,7 @@ export async function transform(
33
31
  return babel.transform(intermediate, {
34
32
  filename: `${name}.js`,
35
33
  plugins: [
36
- [babelPluginIntermediateGJS],
34
+ // [babelPluginIntermediateGJS],
37
35
  [
38
36
  babelPluginEmberTemplateCompilation,
39
37
  {
@@ -13,13 +13,14 @@ import * as _destroyable from '@ember/destroyable';
13
13
  import * as _helpers from '@ember/helper';
14
14
  import * as _modifier from '@ember/modifier';
15
15
  import * as _object from '@ember/object';
16
+ import * as _owner from '@ember/owner';
16
17
  import * as _runloop from '@ember/runloop';
17
18
  import * as _service from '@ember/service';
19
+ import * as _template from '@ember/template';
18
20
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
19
21
  // @ts-ignore
20
22
  import { createTemplateFactory } from '@ember/template-factory';
21
23
  import * as _utils from '@ember/utils';
22
- // import * as _owner from '@ember/owner';
23
24
 
24
25
  export const modules = {
25
26
  '@ember/application': _application,
@@ -35,7 +36,8 @@ export const modules = {
35
36
  '@ember/service': _service,
36
37
  '@ember/template-factory': { createTemplateFactory },
37
38
  '@ember/utils': _utils,
38
- // '@ember/owner': _owner,
39
+ '@ember/template': _template,
40
+ '@ember/owner': _owner,
39
41
 
40
42
  '@glimmer/component': _GlimmerComponent,
41
43
  '@glimmer/tracking': _tracking,
@@ -1,54 +0,0 @@
1
- /**
2
- * This Babel plugin takes parseable code emitted by the string-based
3
- * preprocessor plugin in this package and converts it into calls to
4
- * the standardized `precompileTemplate` macro from `@ember/template-compilation`.
5
- *
6
- * Its goal is to convert code like this:
7
- *
8
- * ```js
9
- * import { hbs } from 'ember-template-imports';
10
- *
11
- * const A = hbs(`A`, {...});
12
- * const B = [__GLIMMER_TEMPLATE(`B`, {...})];
13
- * class C {
14
- * template = hbs(`C`, {...});
15
- * }
16
- *
17
- * [__GLIMMER_TEMPLATE(`default`, {...})];
18
- *
19
- * class D {
20
- * [__GLIMMER_TEMPLATE(`D`, {...})]
21
- * }
22
- * ```
23
- *
24
- * Into this:
25
- *
26
- * ```js
27
- * import { precompileTemplate } from '@ember/template-compilation';
28
- * import { setComponentTemplate } from '@ember/component';
29
- * import templateOnlyComponent from '@ember/component/template-only';
30
- *
31
- * const A = setComponentTemplate(
32
- * precompileTemplate(`A`, {...}),
33
- * templateOnlyComponent('this-module.js', 'A')
34
- * );
35
- * const B = setComponentTemplate(
36
- * precompileTemplate(`B`, {...}),
37
- * templateOnlyComponent('this-module.js', 'B')
38
- * );
39
- * class C {}
40
- * setComponentTemplate(precompileTemplate(`C`, {...}), C);
41
- *
42
- * export default setComponentTemplate(
43
- * precompileTemplate(`default`, {...}),
44
- * templateOnlyComponent('this-module.js', '_thisModule')
45
- * );
46
- *
47
- * class D {}
48
- * setComponentTemplate(precompileTemplate(`D`, {...}), D);
49
- * ```
50
- */
51
- export default function (babel: any): {
52
- visitor: any;
53
- };
54
- //# sourceMappingURL=babel-plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"babel-plugin.d.ts","sourceRoot":"","sources":["../../../src/browser/eti/babel-plugin.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,MAAM,CAAC,OAAO,WAAW,KAAK,EAAE,GAAG;;EA8ClC"}
@@ -1,2 +0,0 @@
1
- export declare function expect<T>(value: T | null | undefined, message: string): T;
2
- //# sourceMappingURL=debug.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../../src/browser/eti/debug.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAMzE"}
@@ -1,56 +0,0 @@
1
- export type TemplateMatch = TemplateTagMatch;
2
- export interface TemplateTagMatch {
3
- type: 'template-tag';
4
- tagName: string;
5
- start: RegExpMatchArray;
6
- end: RegExpMatchArray;
7
- contents: string;
8
- }
9
- /**
10
- * Represents a static import of a template literal.
11
- */
12
- export interface StaticImportConfig {
13
- /**
14
- * The path to the package from which we want to import the template literal
15
- * (e.g.: 'ember-cli-htmlbars')
16
- */
17
- importPath: string;
18
- /**
19
- * The name of the template literal (e.g.: 'hbs') or 'default' if this package
20
- * exports a default function
21
- */
22
- importIdentifier: string;
23
- }
24
- /**
25
- * The input options to instruct parseTemplates on how to parse the input.
26
- *
27
- * @param templateTag
28
- */
29
- export interface ParseTemplatesOptions {
30
- /** Tag to use, if parsing template tags is enabled. */
31
- templateTag?: string;
32
- }
33
- export declare const DEFAULT_PARSE_TEMPLATES_OPTIONS: {
34
- templateTag: string;
35
- };
36
- /**
37
- * Parses a template to find all possible valid matches for an embedded template.
38
- * Supported syntaxes are template literals:
39
- *
40
- * hbs`Hello, world!`
41
- *
42
- * And template tags
43
- *
44
- * <template></template>
45
- *
46
- * The parser excludes any values found within strings recursively, and also
47
- * excludes any string literals with dynamic segments (e.g `${}`) since these
48
- * cannot be valid templates.
49
- *
50
- * @param template The template to parse
51
- * @param relativePath Relative file path for the template (for errors)
52
- * @param options optional configuration options for how to parse templates
53
- * @returns
54
- */
55
- export declare function parseTemplates(template: string, relativePath: string, options?: ParseTemplatesOptions): TemplateMatch[];
56
- //# sourceMappingURL=parse-templates.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-templates.d.ts","sourceRoot":"","sources":["../../../src/browser/eti/parse-templates.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,GAAG,gBAAgB,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,gBAAgB,CAAC;IACxB,GAAG,EAAE,gBAAgB,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA8BD,eAAO,MAAM,+BAA+B;;CAE3C,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,qBAAuD,GAC/D,aAAa,EAAE,CA6LjB"}