ember-repl 3.0.0-beta.6 → 3.0.0-beta.8
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.
- package/README.md +2 -2
- package/declarations/browser/compile/index.d.ts +5 -10
- package/declarations/browser/compile/index.d.ts.map +1 -1
- package/declarations/browser/gjs.d.ts +1 -1
- package/declarations/browser/gjs.d.ts.map +1 -1
- package/declarations/browser/known-modules.d.ts +26 -0
- package/declarations/browser/known-modules.d.ts.map +1 -1
- package/dist/browser/cjs/index.js +1 -1
- package/dist/browser/cjs/index.js.map +1 -1
- package/dist/browser/compile/index.js +7 -8
- package/dist/browser/compile/index.js.map +1 -1
- package/dist/browser/esm/index.js +1 -1
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/gjs.js +16 -13
- package/dist/browser/gjs.js.map +1 -1
- package/dist/browser/known-modules.js +6 -4
- package/dist/browser/known-modules.js.map +1 -1
- package/package.json +60 -56
- package/src/browser/cjs/index.ts +1 -1
- package/src/browser/compile/index.ts +11 -14
- package/src/browser/esm/index.ts +1 -1
- package/src/browser/gjs.ts +15 -15
- package/src/browser/known-modules.ts +6 -2
- package/declarations/browser/eti/babel-plugin.d.ts +0 -54
- package/declarations/browser/eti/babel-plugin.d.ts.map +0 -1
- package/declarations/browser/eti/debug.d.ts +0 -2
- package/declarations/browser/eti/debug.d.ts.map +0 -1
- package/declarations/browser/eti/parse-templates.d.ts +0 -56
- package/declarations/browser/eti/parse-templates.d.ts.map +0 -1
- package/declarations/browser/eti/preprocess.d.ts +0 -58
- package/declarations/browser/eti/preprocess.d.ts.map +0 -1
- package/declarations/browser/eti/template-tag-transform.d.ts +0 -15
- package/declarations/browser/eti/template-tag-transform.d.ts.map +0 -1
- package/declarations/browser/eti/util.d.ts +0 -14
- package/declarations/browser/eti/util.d.ts.map +0 -1
- package/dist/browser/eti/babel-plugin.js +0 -95
- package/dist/browser/eti/babel-plugin.js.map +0 -1
- package/dist/browser/eti/debug.js +0 -9
- package/dist/browser/eti/debug.js.map +0 -1
- package/dist/browser/eti/parse-templates.js +0 -181
- package/dist/browser/eti/parse-templates.js.map +0 -1
- package/dist/browser/eti/preprocess.js +0 -106
- package/dist/browser/eti/preprocess.js.map +0 -1
- package/dist/browser/eti/template-tag-transform.js +0 -46
- package/dist/browser/eti/template-tag-transform.js.map +0 -1
- package/dist/browser/eti/util.js +0 -39
- package/dist/browser/eti/util.js.map +0 -1
- package/src/browser/eti/babel-plugin.ts +0 -105
- package/src/browser/eti/debug.ts +0 -7
- package/src/browser/eti/parse-templates.ts +0 -284
- package/src/browser/eti/preprocess.ts +0 -187
- package/src/browser/eti/template-tag-transform.ts +0 -100
- package/src/browser/eti/util.ts +0 -72
package/README.md
CHANGED
|
@@ -91,7 +91,7 @@ resource so that when an error occurs, you could keep rendering the latest succe
|
|
|
91
91
|
import Component from '@glimmer/component';
|
|
92
92
|
import { Compiled } from 'ember-repl';
|
|
93
93
|
import { use } from 'ember-resources';
|
|
94
|
-
import { keepLatest } from '
|
|
94
|
+
import { keepLatest } from 'reactiveweb/keep-latest';
|
|
95
95
|
|
|
96
96
|
export class Renderer extends Component {
|
|
97
97
|
@use compile = Compiled(() => this.args.gjsText, 'gjs');
|
|
@@ -198,7 +198,7 @@ resource so that when an error occurs, you could keep rendering the latest succe
|
|
|
198
198
|
import Component from '@glimmer/component';
|
|
199
199
|
import { Compiled } from 'ember-repl';
|
|
200
200
|
import { use } from 'ember-resources';
|
|
201
|
-
import { keepLatest } from '
|
|
201
|
+
import { keepLatest } from 'reactiveweb/keep-latest';
|
|
202
202
|
|
|
203
203
|
export class Renderer extends Component {
|
|
204
204
|
@use compile = Compiled(() => this.args.mdText, 'glimdown');
|
|
@@ -62,15 +62,10 @@ export interface Value {
|
|
|
62
62
|
error: string | null;
|
|
63
63
|
component: ComponentLike;
|
|
64
64
|
}
|
|
65
|
-
export declare function
|
|
66
|
-
export declare function
|
|
67
|
-
export declare function
|
|
68
|
-
export declare function
|
|
69
|
-
export declare function
|
|
70
|
-
/**
|
|
71
|
-
* By default, this compiles to `glimdown`. A Markdown format which
|
|
72
|
-
* extracts `live` tagged code snippets and compiles them to components.
|
|
73
|
-
*/
|
|
74
|
-
export declare const Compiled: typeof buildCompiler;
|
|
65
|
+
export declare function Compiled(markdownText: Input | (() => Input)): Value;
|
|
66
|
+
export declare function Compiled(markdownText: Input | (() => Input), options?: Format): Value;
|
|
67
|
+
export declare function Compiled(markdownText: Input | (() => Input), options?: () => Format): Value;
|
|
68
|
+
export declare function Compiled(markdownText: Input | (() => Input), options?: ExtraOptions): Value;
|
|
69
|
+
export declare function Compiled(markdownText: Input | (() => Input), options?: () => ExtraOptions): Value;
|
|
75
70
|
export {};
|
|
76
71
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/compile/index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,KAAK,MAAM,GAAG,UAAU,GAAG,KAAK,GAAG,KAAK,CAAC;AAEzC,eAAO,MAAM,KAAK,4BAAmC,CAAC;AAEtD,UAAU,MAAM;IACd,SAAS,EAAE,CAAC,SAAS,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACpE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACvD,cAAc,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;CAClD;AAED,UAAU,KAAK;IACb,SAAS,CAAC,EAAE,aAAa,CAAC;CAC3B;AAID,UAAU,eAAgB,SAAQ,KAAK,EAAE,MA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C,YAAY,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,MAAM,GAAG,KAAK,CAAC;AAC7F,wBAAgB,QAAQ,CAAC,YAAY,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,KAAK,CAAC;AAC7F,wBAAgB,QAAQ,CAAC,YAAY,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,YAAY,GAAG,KAAK,CAAC"}
|
|
@@ -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":"
|
|
1
|
+
{"version":3,"file":"gjs.d.ts","sourceRoot":"","sources":["../../src/browser/gjs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAOxC,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAY7E;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,3 +1,23 @@
|
|
|
1
|
+
/// <reference types="ember-source/types/stable/@glimmer/tracking" />
|
|
2
|
+
/// <reference types="ember-source/types/stable/@ember/application" />
|
|
3
|
+
/// <reference types="ember-source/types/stable/@ember/array" />
|
|
4
|
+
/// <reference types="ember-source/types/stable/@ember/component" />
|
|
5
|
+
/// <reference types="ember-source/types/stable/@ember/component/helper" />
|
|
6
|
+
/// <reference types="ember-source/types/stable/@ember/debug" />
|
|
7
|
+
/// <reference types="ember-source/types/stable/@ember/destroyable" />
|
|
8
|
+
/// <reference types="ember-source/types/stable/@ember/helper" />
|
|
9
|
+
/// <reference types="ember-source/types/stable/@ember/modifier" />
|
|
10
|
+
/// <reference types="ember-source/types/stable/@ember/object" />
|
|
11
|
+
/// <reference types="ember-source/types/stable/@ember/owner" />
|
|
12
|
+
/// <reference types="ember-source/types/stable/@ember/controller/owner-ext" />
|
|
13
|
+
/// <reference types="ember-source/types/stable/@ember/routing/owner-ext" />
|
|
14
|
+
/// <reference types="ember-source/types/stable/@ember/service/owner-ext" />
|
|
15
|
+
/// <reference types="ember-source/types/stable/@ember/runloop" />
|
|
16
|
+
/// <reference types="ember-source/types/stable/@ember/service" />
|
|
17
|
+
/// <reference types="ember-source/types/stable/@ember/routing/service-ext" />
|
|
18
|
+
/// <reference types="ember-source/types/stable/@ember/template" />
|
|
19
|
+
/// <reference types="ember-source/types/stable/@ember/template-factory" />
|
|
20
|
+
/// <reference types="ember-source/types/stable/@ember/utils" />
|
|
1
21
|
/// <reference types="ember-source/types/stable/@ember/component/template-only" />
|
|
2
22
|
/**
|
|
3
23
|
* We need to import and hang on to these references so that they
|
|
@@ -8,19 +28,23 @@ import * as _tracking from '@glimmer/tracking';
|
|
|
8
28
|
import * as _application from '@ember/application';
|
|
9
29
|
import * as _array from '@ember/array';
|
|
10
30
|
import * as _EmberComponent from '@ember/component';
|
|
31
|
+
import * as _EmberComponentHelper from '@ember/component/helper';
|
|
11
32
|
import * as _debug from '@ember/debug';
|
|
12
33
|
import * as _destroyable from '@ember/destroyable';
|
|
13
34
|
import * as _helpers from '@ember/helper';
|
|
14
35
|
import * as _modifier from '@ember/modifier';
|
|
15
36
|
import * as _object from '@ember/object';
|
|
37
|
+
import * as _owner from '@ember/owner';
|
|
16
38
|
import * as _runloop from '@ember/runloop';
|
|
17
39
|
import * as _service from '@ember/service';
|
|
40
|
+
import * as _template from '@ember/template';
|
|
18
41
|
import { createTemplateFactory } from '@ember/template-factory';
|
|
19
42
|
import * as _utils from '@ember/utils';
|
|
20
43
|
export declare const modules: {
|
|
21
44
|
'@ember/application': typeof _application;
|
|
22
45
|
'@ember/array': typeof _array;
|
|
23
46
|
'@ember/component': typeof _EmberComponent;
|
|
47
|
+
'@ember/component/helper': typeof _EmberComponentHelper;
|
|
24
48
|
'@ember/component/template-only': <S>(moduleName?: string | undefined, name?: string | undefined) => import("@ember/component/template-only").TemplateOnlyComponent<S>;
|
|
25
49
|
'@ember/debug': typeof _debug;
|
|
26
50
|
'@ember/destroyable': typeof _destroyable;
|
|
@@ -33,6 +57,8 @@ export declare const modules: {
|
|
|
33
57
|
createTemplateFactory: typeof createTemplateFactory;
|
|
34
58
|
};
|
|
35
59
|
'@ember/utils': typeof _utils;
|
|
60
|
+
'@ember/template': typeof _template;
|
|
61
|
+
'@ember/owner': typeof _owner;
|
|
36
62
|
'@glimmer/component': typeof _GlimmerComponent;
|
|
37
63
|
'@glimmer/tracking': typeof _tracking;
|
|
38
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"known-modules.d.ts","sourceRoot":"","sources":["../../src/browser/known-modules.ts"],"names":[],"mappings":"
|
|
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;AACpD,OAAO,KAAK,qBAAqB,MAAM,yBAAyB,CAAC;AAEjE,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;;;;;;;;;;;;;;;;;;;;;CAoBnB,CAAC"}
|
|
@@ -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;
|
|
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;;;;"}
|
|
@@ -69,7 +69,11 @@ async function compile(text, options) {
|
|
|
69
69
|
* @internal
|
|
70
70
|
*/
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
/**
|
|
73
|
+
* By default, this compiles to `glimdown`. A Markdown format which
|
|
74
|
+
* extracts `live` tagged code snippets and compiles them to components.
|
|
75
|
+
*/
|
|
76
|
+
function Compiled(markdownText, maybeOptions) {
|
|
73
77
|
return resource(() => {
|
|
74
78
|
let maybeObject = typeof maybeOptions === 'function' ? maybeOptions() : maybeOptions;
|
|
75
79
|
let format = (typeof maybeObject === 'string' ? maybeObject : maybeObject?.format) || 'glimdown';
|
|
@@ -103,12 +107,7 @@ function buildCompiler(markdownText, maybeOptions) {
|
|
|
103
107
|
});
|
|
104
108
|
});
|
|
105
109
|
}
|
|
110
|
+
resourceFactory(Compiled);
|
|
106
111
|
|
|
107
|
-
|
|
108
|
-
* By default, this compiles to `glimdown`. A Markdown format which
|
|
109
|
-
* extracts `live` tagged code snippets and compiles them to components.
|
|
110
|
-
*/
|
|
111
|
-
const Compiled = resourceFactory(buildCompiler);
|
|
112
|
-
|
|
113
|
-
export { CACHE, Compiled, buildCompiler, compile };
|
|
112
|
+
export { CACHE, Compiled, compile };
|
|
114
113
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/browser/compile/index.ts"],"sourcesContent":["import { cell, resource, resourceFactory } from 'ember-resources';\n\nimport { nameFor } from '../utils.ts';\nimport {\n compileGJS as processGJS,\n compileHBS as processHBS,\n compileMD as processMD,\n} from './formats.ts';\n\nimport type { CompileResult } from '../types.ts';\nimport type { UnifiedPlugin } from './types.ts';\nimport type { EvalImportMap, ScopeMap } from './types.ts';\nimport type { ComponentLike } from '@glint/template';\ntype Format = 'glimdown' | 'gjs' | 'hbs';\n\nexport const CACHE = new Map<string, ComponentLike>();\n\ninterface Events {\n onSuccess: (component: ComponentLike) => Promise<unknown> | unknown;\n onError: (error: string) => Promise<unknown> | unknown;\n onCompileStart: () => Promise<unknown> | unknown;\n}\n\ninterface Scope {\n importMap?: EvalImportMap;\n}\n\nconst SUPPORTED_FORMATS = ['glimdown', 'gjs', 'hbs'];\n\ninterface GlimdownOptions extends Scope, Events {\n format: 'glimdown';\n remarkPlugins?: UnifiedPlugin[];\n CopyComponent?: string;\n ShadowComponent?: string;\n topLevelScope?: ScopeMap;\n}\ninterface GJSOptions extends Scope, Events {\n format: 'gjs';\n}\n\ninterface HBSOptions extends Scope, Events {\n format: 'hbs';\n topLevelScope?: ScopeMap;\n}\n\n/**\n * Compile GitHub-flavored Markdown with GJS support\n * and optionally render gjs-snippets via a `live` meta tag\n * on the code fences.\n */\nexport async function compile(text: string, options: GlimdownOptions): Promise<void>;\n\n/**\n * Compile GJS\n */\nexport async function compile(text: string, options: GJSOptions): Promise<void>;\n\n/**\n * Compile a stateless component using just the template\n */\nexport async function compile(text: string, options: HBSOptions): Promise<void>;\n\n/**\n * This compileMD is a more robust version of the raw compiling used in \"formats\".\n * This function manages cache, and has events for folks building UIs to hook in to\n */\nexport async function compile(\n text: string,\n options: GlimdownOptions | GJSOptions | HBSOptions\n): Promise<void> {\n let { onSuccess, onError, onCompileStart } = options;\n let id = nameFor(text);\n\n let existing = CACHE.get(id);\n\n if (existing) {\n onSuccess(existing);\n\n return;\n }\n\n if (!SUPPORTED_FORMATS.includes(options.format)) {\n await onError(`Unsupported format: ${options.format}. Supported formats: ${SUPPORTED_FORMATS}`);\n\n return;\n }\n\n await onCompileStart();\n\n if (!text) {\n await onError('No Input Document yet');\n\n return;\n }\n\n let result: CompileResult;\n\n if (options.format === 'glimdown') {\n result = await processMD(text, options);\n } else if (options.format === 'gjs') {\n result = await processGJS(text, options.importMap);\n } else if (options.format === 'hbs') {\n result = await processHBS(text, {\n scope: options.topLevelScope,\n });\n } else {\n await onError(\n `Unsupported format: ${(options as any).format}. Supported formats: ${SUPPORTED_FORMATS}`\n );\n\n return;\n }\n\n if (result.error) {\n await onError(result.error.message || `${result.error}`);\n\n return;\n }\n\n CACHE.set(id, result.component as ComponentLike);\n\n await onSuccess(result.component as ComponentLike);\n}\n\ntype Input = string | undefined | null;\n\ntype ExtraOptions =\n | {\n format: 'glimdown';\n remarkPlugins?: UnifiedPlugin[];\n importMap?: EvalImportMap;\n CopyComponent?: string;\n ShadowComponent?: string;\n topLevelScope?: ScopeMap;\n }\n | {\n format: 'hbs';\n topLevelScope?: ScopeMap;\n }\n | {\n format: 'gjs';\n importMap?: EvalImportMap;\n };\n\n/**\n * @internal\n */\nexport interface Value {\n isReady: boolean;\n error: string | null;\n component: ComponentLike;\n}\n\nexport function
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/browser/compile/index.ts"],"sourcesContent":["import { cell, resource, resourceFactory } from 'ember-resources';\n\nimport { nameFor } from '../utils.ts';\nimport {\n compileGJS as processGJS,\n compileHBS as processHBS,\n compileMD as processMD,\n} from './formats.ts';\n\nimport type { CompileResult } from '../types.ts';\nimport type { UnifiedPlugin } from './types.ts';\nimport type { EvalImportMap, ScopeMap } from './types.ts';\nimport type { ComponentLike } from '@glint/template';\ntype Format = 'glimdown' | 'gjs' | 'hbs';\n\nexport const CACHE = new Map<string, ComponentLike>();\n\ninterface Events {\n onSuccess: (component: ComponentLike) => Promise<unknown> | unknown;\n onError: (error: string) => Promise<unknown> | unknown;\n onCompileStart: () => Promise<unknown> | unknown;\n}\n\ninterface Scope {\n importMap?: EvalImportMap;\n}\n\nconst SUPPORTED_FORMATS = ['glimdown', 'gjs', 'hbs'];\n\ninterface GlimdownOptions extends Scope, Events {\n format: 'glimdown';\n remarkPlugins?: UnifiedPlugin[];\n CopyComponent?: string;\n ShadowComponent?: string;\n topLevelScope?: ScopeMap;\n}\ninterface GJSOptions extends Scope, Events {\n format: 'gjs';\n}\n\ninterface HBSOptions extends Scope, Events {\n format: 'hbs';\n topLevelScope?: ScopeMap;\n}\n\n/**\n * Compile GitHub-flavored Markdown with GJS support\n * and optionally render gjs-snippets via a `live` meta tag\n * on the code fences.\n */\nexport async function compile(text: string, options: GlimdownOptions): Promise<void>;\n\n/**\n * Compile GJS\n */\nexport async function compile(text: string, options: GJSOptions): Promise<void>;\n\n/**\n * Compile a stateless component using just the template\n */\nexport async function compile(text: string, options: HBSOptions): Promise<void>;\n\n/**\n * This compileMD is a more robust version of the raw compiling used in \"formats\".\n * This function manages cache, and has events for folks building UIs to hook in to\n */\nexport async function compile(\n text: string,\n options: GlimdownOptions | GJSOptions | HBSOptions\n): Promise<void> {\n let { onSuccess, onError, onCompileStart } = options;\n let id = nameFor(text);\n\n let existing = CACHE.get(id);\n\n if (existing) {\n onSuccess(existing);\n\n return;\n }\n\n if (!SUPPORTED_FORMATS.includes(options.format)) {\n await onError(`Unsupported format: ${options.format}. Supported formats: ${SUPPORTED_FORMATS}`);\n\n return;\n }\n\n await onCompileStart();\n\n if (!text) {\n await onError('No Input Document yet');\n\n return;\n }\n\n let result: CompileResult;\n\n if (options.format === 'glimdown') {\n result = await processMD(text, options);\n } else if (options.format === 'gjs') {\n result = await processGJS(text, options.importMap);\n } else if (options.format === 'hbs') {\n result = await processHBS(text, {\n scope: options.topLevelScope,\n });\n } else {\n await onError(\n `Unsupported format: ${(options as any).format}. Supported formats: ${SUPPORTED_FORMATS}`\n );\n\n return;\n }\n\n if (result.error) {\n await onError(result.error.message || `${result.error}`);\n\n return;\n }\n\n CACHE.set(id, result.component as ComponentLike);\n\n await onSuccess(result.component as ComponentLike);\n}\n\ntype Input = string | undefined | null;\n\ntype ExtraOptions =\n | {\n format: 'glimdown';\n remarkPlugins?: UnifiedPlugin[];\n importMap?: EvalImportMap;\n CopyComponent?: string;\n ShadowComponent?: string;\n topLevelScope?: ScopeMap;\n }\n | {\n format: 'hbs';\n topLevelScope?: ScopeMap;\n }\n | {\n format: 'gjs';\n importMap?: EvalImportMap;\n };\n\n/**\n * @internal\n */\nexport interface Value {\n isReady: boolean;\n error: string | null;\n component: ComponentLike;\n}\n\nexport function Compiled(markdownText: Input | (() => Input)): Value;\nexport function Compiled(markdownText: Input | (() => Input), options?: Format): Value;\nexport function Compiled(markdownText: Input | (() => Input), options?: () => Format): Value;\nexport function Compiled(markdownText: Input | (() => Input), options?: ExtraOptions): Value;\nexport function Compiled(markdownText: Input | (() => Input), options?: () => ExtraOptions): Value;\n\n/**\n * By default, this compiles to `glimdown`. A Markdown format which\n * extracts `live` tagged code snippets and compiles them to components.\n */\nexport function Compiled(\n markdownText: Input | (() => Input),\n maybeOptions?: Format | (() => Format) | ExtraOptions | (() => ExtraOptions)\n): Value {\n return resource(() => {\n let maybeObject = typeof maybeOptions === 'function' ? maybeOptions() : maybeOptions;\n let format =\n (typeof maybeObject === 'string' ? maybeObject : maybeObject?.format) || 'glimdown';\n let options = (typeof maybeObject === 'string' ? {} : maybeObject) || {};\n\n let input = typeof markdownText === 'function' ? markdownText() : markdownText;\n let ready = cell(false);\n let error = cell<string | null>();\n let result = cell<ComponentLike>();\n\n if (input) {\n compile(input, {\n // narrowing is hard here, but this is an implementation detail\n format: format as any,\n onSuccess: async (component) => {\n result.current = component;\n ready.set(true);\n error.set(null);\n },\n onError: async (e) => {\n error.set(e);\n },\n onCompileStart: async () => {\n ready.set(false);\n },\n ...options,\n });\n }\n\n return () => ({\n isReady: ready.current,\n error: error.current,\n component: result.current,\n });\n });\n}\n\nresourceFactory(Compiled);\n"],"names":["CACHE","Map","SUPPORTED_FORMATS","compile","text","options","onSuccess","onError","onCompileStart","id","nameFor","existing","get","includes","format","result","processMD","processGJS","importMap","processHBS","scope","topLevelScope","error","message","set","component","Compiled","markdownText","maybeOptions","resource","maybeObject","input","ready","cell","current","e","isReady","resourceFactory"],"mappings":";;;;MAeaA,KAAK,GAAG,IAAIC,GAAG,GAAyB;AAYrD,MAAMC,iBAAiB,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;;AAkBpD;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACO,eAAeC,OAAOA,CAC3BC,IAAY,EACZC,OAAkD,EACnC;EACf,IAAI;IAAEC,SAAS;IAAEC,OAAO;AAAEC,IAAAA,cAAAA;AAAe,GAAC,GAAGH,OAAO,CAAA;AACpD,EAAA,IAAII,EAAE,GAAGC,OAAO,CAACN,IAAI,CAAC,CAAA;AAEtB,EAAA,IAAIO,QAAQ,GAAGX,KAAK,CAACY,GAAG,CAACH,EAAE,CAAC,CAAA;AAE5B,EAAA,IAAIE,QAAQ,EAAE;IACZL,SAAS,CAACK,QAAQ,CAAC,CAAA;AAEnB,IAAA,OAAA;AACF,GAAA;EAEA,IAAI,CAACT,iBAAiB,CAACW,QAAQ,CAACR,OAAO,CAACS,MAAM,CAAC,EAAE;IAC/C,MAAMP,OAAO,CAAE,CAAsBF,oBAAAA,EAAAA,OAAO,CAACS,MAAO,CAAA,qBAAA,EAAuBZ,iBAAkB,CAAA,CAAC,CAAC,CAAA;AAE/F,IAAA,OAAA;AACF,GAAA;EAEA,MAAMM,cAAc,EAAE,CAAA;EAEtB,IAAI,CAACJ,IAAI,EAAE;IACT,MAAMG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AAEtC,IAAA,OAAA;AACF,GAAA;AAEA,EAAA,IAAIQ,MAAqB,CAAA;AAEzB,EAAA,IAAIV,OAAO,CAACS,MAAM,KAAK,UAAU,EAAE;AACjCC,IAAAA,MAAM,GAAG,MAAMC,SAAS,CAACZ,IAAI,EAAEC,OAAO,CAAC,CAAA;AACzC,GAAC,MAAM,IAAIA,OAAO,CAACS,MAAM,KAAK,KA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IAAIC,KAAK,GAAG,OAAOJ,YAAY,KAAK,UAAU,GAAGA,YAAY,EAAE,GAAGA,YAAY,CAAA;AAC9E,IAAA,IAAIK,KAAK,GAAGC,IAAI,CAAC,KAAK,CAAC,CAAA;AACvB,IAAA,IAAIX,KAAK,GAAGW,IAAI,EAAiB,CAAA;AACjC,IAAA,IAAIlB,MAAM,GAAGkB,IAAI,EAAiB,CAAA;AAElC,IAAA,IAAIF,KAAK,EAAE;MACT5B,OAAO,CAAC4B,KAAK,EAAE;AACb;AACAjB,QAAAA,MAAM,EAAEA,MAAa;QACrBR,SAAS,EAAE,MAAOmB,SAAS,IAAK;UAC9BV,MAAM,CAACmB,OAAO,GAAGT,SAAS,CAAA;AAC1BO,UAAAA,KAAK,CAACR,GAAG,CAAC,IAAI,CAAC,CAAA;AACfF,UAAAA,KAAK,CAACE,GAAG,CAAC,IAAI,CAAC,CAAA;SAChB;QACDjB,OAAO,EAAE,MAAO4B,CAAC,IAAK;AACpBb,UAAAA,KAAK,CAACE,GAAG,CAACW,CAAC,CAAC,CAAA;SACb;QACD3B,cAAc,EAAE,YAAY;AAC1BwB,UAAAA,KAAK,CAACR,GAAG,CAAC,KAAK,CAAC,CAAA;SACjB;QACD,GAAGnB,OAAAA;AACL,OAAC,CAAC,CAAA;AACJ,KAAA;AAEA,IAAA,OAAO,OAAO;MACZ+B,OAAO,EAAEJ,KAAK,CAACE,OAAO;MACtBZ,KAAK,EAAEA,KAAK,CAACY,OAAO;MACpBT,SAAS,EAAEV,MAAM,CAACmB,OAAAA;AACpB,KAAC,CAAC,CAAA;AACJ,GAAC,CAAC,CAAA;AACJ,CAAA;AAEAG,eAAe,CAACX,QAAQ,CAAC;;;;"}
|
|
@@ -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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zC,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;
|
|
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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K,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;;;;"}
|
package/dist/browser/gjs.js
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
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';
|
|
6
3
|
|
|
7
4
|
const compiler = importSync('ember-source/dist/ember-template-compiler.js');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
let processor;
|
|
6
|
+
let fetchingPromise;
|
|
7
|
+
async function preprocess(input, name) {
|
|
8
|
+
if (!fetchingPromise) {
|
|
9
|
+
fetchingPromise = import('content-tag');
|
|
10
|
+
}
|
|
11
|
+
if (!processor) {
|
|
12
|
+
let {
|
|
13
|
+
Preprocessor
|
|
14
|
+
} = await fetchingPromise;
|
|
15
|
+
processor = new Preprocessor();
|
|
16
|
+
}
|
|
17
|
+
return processor.process(input, `${name}.js`);
|
|
17
18
|
}
|
|
18
19
|
async function transform(intermediate, name, options = {}) {
|
|
19
20
|
let babel = await import('@babel/standalone');
|
|
20
21
|
return babel.transform(intermediate, {
|
|
21
22
|
filename: `${name}.js`,
|
|
22
|
-
plugins: [
|
|
23
|
+
plugins: [
|
|
24
|
+
// [babelPluginIntermediateGJS],
|
|
25
|
+
[babelPluginEmberTemplateCompilation, {
|
|
23
26
|
compiler
|
|
24
27
|
}], [babel.availablePlugins['proposal-decorators'], {
|
|
25
28
|
legacy: true
|
package/dist/browser/gjs.js.map
CHANGED
|
@@ -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\
|
|
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\nlet processor: any;\nlet fetchingPromise: Promise<any>;\n\nexport async 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\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","Preprocessor","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;AAE3E,IAAIC,SAAc,CAAA;AAClB,IAAIC,eAA6B,CAAA;AAE1B,eAAeC,UAAUA,CAACC,KAAa,EAAEC,IAAY,EAAmB;EAC7E,IAAI,CAACH,eAAe,EAAE;AACpBA,IAAAA,eAAe,GAAG,OAAO,aAAa,CAAC,CAAA;AACzC,GAAA;EAEA,IAAI,CAACD,SAAS,EAAE;IACd,IAAI;AAAEK,MAAAA,YAAAA;KAAc,GAAG,MAAMJ,eAAe,CAAA;AAE5CD,IAAAA,SAAS,GAAG,IAAIK,YAAY,EAAE,CAAA;AAChC,GAAA;EAEA,OAAOL,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;;;;"}
|
|
@@ -3,14 +3,17 @@ import * as _tracking from '@glimmer/tracking';
|
|
|
3
3
|
import * as _application from '@ember/application';
|
|
4
4
|
import * as _array from '@ember/array';
|
|
5
5
|
import * as _EmberComponent from '@ember/component';
|
|
6
|
+
import * as _EmberComponentHelper from '@ember/component/helper';
|
|
6
7
|
import _TO from '@ember/component/template-only';
|
|
7
8
|
import * as _debug from '@ember/debug';
|
|
8
9
|
import * as _destroyable from '@ember/destroyable';
|
|
9
10
|
import * as _helpers from '@ember/helper';
|
|
10
11
|
import * as _modifier from '@ember/modifier';
|
|
11
12
|
import * as _object from '@ember/object';
|
|
13
|
+
import * as _owner from '@ember/owner';
|
|
12
14
|
import * as _runloop from '@ember/runloop';
|
|
13
15
|
import * as _service from '@ember/service';
|
|
16
|
+
import * as _template from '@ember/template';
|
|
14
17
|
import { createTemplateFactory } from '@ember/template-factory';
|
|
15
18
|
import * as _utils from '@ember/utils';
|
|
16
19
|
|
|
@@ -18,12 +21,11 @@ import * as _utils from '@ember/utils';
|
|
|
18
21
|
* We need to import and hang on to these references so that they
|
|
19
22
|
* don't get optimized away during deploy
|
|
20
23
|
*/
|
|
21
|
-
// import * as _owner from '@ember/owner';
|
|
22
|
-
|
|
23
24
|
const modules = {
|
|
24
25
|
'@ember/application': _application,
|
|
25
26
|
'@ember/array': _array,
|
|
26
27
|
'@ember/component': _EmberComponent,
|
|
28
|
+
'@ember/component/helper': _EmberComponentHelper,
|
|
27
29
|
'@ember/component/template-only': _TO,
|
|
28
30
|
'@ember/debug': _debug,
|
|
29
31
|
'@ember/destroyable': _destroyable,
|
|
@@ -36,8 +38,8 @@ const modules = {
|
|
|
36
38
|
createTemplateFactory
|
|
37
39
|
},
|
|
38
40
|
'@ember/utils': _utils,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
'@ember/template': _template,
|
|
42
|
+
'@ember/owner': _owner,
|
|
41
43
|
'@glimmer/component': _GlimmerComponent,
|
|
42
44
|
'@glimmer/tracking': _tracking
|
|
43
45
|
};
|
|
@@ -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
|
|
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 * as _EmberComponentHelper from '@ember/component/helper';\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/helper': _EmberComponentHelper,\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","_EmberComponentHelper","_TO","_debug","_destroyable","_helpers","_modifier","_object","_runloop","_service","createTemplateFactory","_utils","_template","_owner","_GlimmerComponent","_tracking"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AAsBO,MAAMA,OAAO,GAAG;AACrB,EAAA,oBAAoB,EAAEC,YAAY;AAClC,EAAA,cAAc,EAAEC,MAAM;AACtB,EAAA,kBAAkB,EAAEC,eAAe;AACnC,EAAA,yBAAyB,EAAEC,qBAAqB;AAChD,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.
|
|
3
|
+
"version": "3.0.0-beta.8",
|
|
4
4
|
"description": "Addon for enabling REPL and Playground creation with Ember/Glimmer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -60,18 +60,23 @@
|
|
|
60
60
|
],
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@babel/helper-plugin-utils": "^7.22.5",
|
|
63
|
-
"@babel/standalone": "^7.
|
|
64
|
-
"@embroider/addon-shim": "1.8.
|
|
65
|
-
"@embroider/macros": "1.13.
|
|
66
|
-
"
|
|
67
|
-
"
|
|
63
|
+
"@babel/standalone": "^7.23.6",
|
|
64
|
+
"@embroider/addon-shim": "1.8.7",
|
|
65
|
+
"@embroider/macros": "1.13.5",
|
|
66
|
+
"@glimmer/compiler": ">= 0.86.0",
|
|
67
|
+
"@glimmer/syntax": ">= 0.86.0",
|
|
68
|
+
"babel-import-util": "^2.0.1",
|
|
69
|
+
"babel-plugin-ember-template-compilation": "^2.2.1",
|
|
68
70
|
"broccoli-file-creator": "^2.1.1",
|
|
69
|
-
"change-case": "^
|
|
71
|
+
"change-case": "^5.3.0",
|
|
70
72
|
"common-tags": "^1.8.2",
|
|
73
|
+
"content-tag": "^1.2.1",
|
|
74
|
+
"decorator-transforms": "^1.1.0",
|
|
71
75
|
"line-column": "^1.0.2",
|
|
72
|
-
"magic-string": "^0.30.
|
|
76
|
+
"magic-string": "^0.30.5",
|
|
73
77
|
"mdast": "^3.0.0",
|
|
74
78
|
"parse-static-imports": "^1.1.0",
|
|
79
|
+
"reactiveweb": "^1.2.0",
|
|
75
80
|
"rehype-raw": "^6.1.1",
|
|
76
81
|
"rehype-stringify": "^9.0.4",
|
|
77
82
|
"remark-gfm": "^3.0.1",
|
|
@@ -79,56 +84,55 @@
|
|
|
79
84
|
"remark-rehype": "^10.1.0",
|
|
80
85
|
"unified": "^10.1.2",
|
|
81
86
|
"unist-util-visit": "^5.0.0",
|
|
82
|
-
"uuid": "^9.0.
|
|
87
|
+
"uuid": "^9.0.1",
|
|
83
88
|
"vfile": "^6.0.1"
|
|
84
89
|
},
|
|
85
90
|
"devDependencies": {
|
|
86
|
-
"@babel/core": "^7.
|
|
87
|
-
"@babel/
|
|
88
|
-
"@babel/
|
|
89
|
-
"@
|
|
90
|
-
"@ember/test-
|
|
91
|
-
"@
|
|
92
|
-
"@
|
|
91
|
+
"@babel/core": "^7.23.7",
|
|
92
|
+
"@babel/plugin-transform-typescript": "^7.23.6",
|
|
93
|
+
"@babel/preset-typescript": "^7.23.3",
|
|
94
|
+
"@babel/types": "^7.23.9",
|
|
95
|
+
"@ember/test-helpers": "^3.2.1",
|
|
96
|
+
"@ember/test-waiters": "^3.1.0",
|
|
97
|
+
"@embroider/addon-dev": "4.1.3",
|
|
93
98
|
"@glimmer/component": "^1.1.2",
|
|
94
|
-
"@glimmer/interfaces": "
|
|
95
|
-
"@glimmer/reference": "
|
|
96
|
-
"@glimmer/syntax": "^0.84.3",
|
|
99
|
+
"@glimmer/interfaces": ">= 0.86.0",
|
|
100
|
+
"@glimmer/reference": ">= 0.86.0",
|
|
97
101
|
"@glimmer/tracking": "^1.1.2",
|
|
98
|
-
"@glimmer/util": "^0.
|
|
99
|
-
"@glint/core": "
|
|
100
|
-
"@glint/environment-ember-loose": "
|
|
101
|
-
"@glint/environment-ember-template-imports": "
|
|
102
|
-
"@glint/template": "
|
|
102
|
+
"@glimmer/util": "^0.88.0",
|
|
103
|
+
"@glint/core": "1.3.0",
|
|
104
|
+
"@glint/environment-ember-loose": "1.3.0",
|
|
105
|
+
"@glint/environment-ember-template-imports": "1.3.0",
|
|
106
|
+
"@glint/template": "1.3.0",
|
|
103
107
|
"@nullvoxpopuli/eslint-configs": "^3.2.2",
|
|
104
|
-
"@rollup/plugin-babel": "^6.0.
|
|
105
|
-
"@rollup/plugin-commonjs": "^25.0.
|
|
106
|
-
"@tsconfig/ember": "^3.0.
|
|
107
|
-
"@types/babel__core": "^7.20.
|
|
108
|
-
"@types/babel__standalone": "^7.1.
|
|
109
|
-
"@types/babel__traverse": "^7.20.
|
|
110
|
-
"@types/hast": "^3.0.
|
|
111
|
-
"@types/mdast": "^4.0.
|
|
112
|
-
"@types/unist": "^3.0.
|
|
113
|
-
"@types/uuid": "^9.0.
|
|
114
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
115
|
-
"@typescript-eslint/parser": "^6.
|
|
116
|
-
"concurrently": "^8.2.
|
|
117
|
-
"ember-resources": "^6.4.
|
|
118
|
-
"ember-source": "^5.
|
|
108
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
109
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
110
|
+
"@tsconfig/ember": "^3.0.2",
|
|
111
|
+
"@types/babel__core": "^7.20.5",
|
|
112
|
+
"@types/babel__standalone": "^7.1.7",
|
|
113
|
+
"@types/babel__traverse": "^7.20.4",
|
|
114
|
+
"@types/hast": "^3.0.3",
|
|
115
|
+
"@types/mdast": "^4.0.3",
|
|
116
|
+
"@types/unist": "^3.0.2",
|
|
117
|
+
"@types/uuid": "^9.0.7",
|
|
118
|
+
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
|
119
|
+
"@typescript-eslint/parser": "^6.20.0",
|
|
120
|
+
"concurrently": "^8.2.2",
|
|
121
|
+
"ember-resources": "^6.4.2",
|
|
122
|
+
"ember-source": "^5.5.0",
|
|
119
123
|
"ember-template-imports": "^3.4.2",
|
|
120
|
-
"ember-template-lint": "^5.
|
|
121
|
-
"eslint": "^8.
|
|
122
|
-
"eslint-plugin-ember": "^
|
|
124
|
+
"ember-template-lint": "^5.13.0",
|
|
125
|
+
"eslint": "^8.55.0",
|
|
126
|
+
"eslint-plugin-ember": "^12.0.0",
|
|
123
127
|
"eslint-plugin-node": "^11.1.0",
|
|
124
|
-
"eslint-plugin-prettier": "^5.0.
|
|
125
|
-
"prettier": "^3.
|
|
126
|
-
"prettier-plugin-ember-template-tag": "^
|
|
127
|
-
"publint": "^0.2.
|
|
128
|
-
"rollup": "~
|
|
129
|
-
"rollup-plugin-copy": "^3.
|
|
128
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
129
|
+
"prettier": "^3.1.1",
|
|
130
|
+
"prettier-plugin-ember-template-tag": "^2.0.0",
|
|
131
|
+
"publint": "^0.2.6",
|
|
132
|
+
"rollup": "~4.9.0",
|
|
133
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
130
134
|
"rollup-plugin-glimmer-template-tag": "^0.4.1",
|
|
131
|
-
"typescript": "^5.
|
|
135
|
+
"typescript": "^5.3.3",
|
|
132
136
|
"@nullvoxpopuli/limber-untyped": "0.0.0"
|
|
133
137
|
},
|
|
134
138
|
"volta": {
|
|
@@ -144,12 +148,12 @@
|
|
|
144
148
|
"app-js": {}
|
|
145
149
|
},
|
|
146
150
|
"peerDependencies": {
|
|
147
|
-
"@glimmer/compiler": "
|
|
151
|
+
"@glimmer/compiler": ">= 0.86.0",
|
|
148
152
|
"@glimmer/component": "^1.1.2",
|
|
149
|
-
"@glimmer/syntax": "
|
|
150
|
-
"@glint/template": "
|
|
151
|
-
"ember-resources": "
|
|
152
|
-
"ember-source": "
|
|
153
|
+
"@glimmer/syntax": ">= 0.86.0",
|
|
154
|
+
"@glint/template": ">= 1.3.0",
|
|
155
|
+
"ember-resources": ">= 6.4.2",
|
|
156
|
+
"ember-source": ">= 5.5.0"
|
|
153
157
|
},
|
|
154
158
|
"engines": {
|
|
155
159
|
"node": ">= v16",
|
|
@@ -159,7 +163,6 @@
|
|
|
159
163
|
"scripts": {
|
|
160
164
|
"build": "concurrently 'npm:build:*'",
|
|
161
165
|
"build:js": "rollup --config",
|
|
162
|
-
"build:types": "tsc --emitDeclarationOnly --noEmit false",
|
|
163
166
|
"lint:types": "tsc --noEmit",
|
|
164
167
|
"lint:fix": "pnpm -w exec lint fix",
|
|
165
168
|
"start": "rollup --config --watch",
|
|
@@ -170,6 +173,7 @@
|
|
|
170
173
|
"lint:hbs": "pnpm -w exec lint hbs",
|
|
171
174
|
"lint:hbs:fix": "pnpm -w exec lint hbs:fix",
|
|
172
175
|
"lint:prettier:fix": "pnpm -w exec lint prettier:fix",
|
|
173
|
-
"lint:prettier": "pnpm -w exec lint prettier"
|
|
176
|
+
"lint:prettier": "pnpm -w exec lint prettier",
|
|
177
|
+
"build:types": "tsc --emitDeclarationOnly --noEmit false"
|
|
174
178
|
}
|
|
175
179
|
}
|
package/src/browser/cjs/index.ts
CHANGED
|
@@ -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) {
|