ember-repl 3.0.0-beta.7 → 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.map +1 -1
- package/declarations/browser/known-modules.d.ts +22 -0
- package/declarations/browser/known-modules.d.ts.map +1 -1
- package/dist/browser/compile/index.js +7 -8
- package/dist/browser/compile/index.js.map +1 -1
- package/dist/browser/gjs.js +7 -3
- package/dist/browser/gjs.js.map +1 -1
- package/dist/browser/known-modules.js +2 -0
- package/dist/browser/known-modules.js.map +1 -1
- package/package.json +39 -36
- package/src/browser/compile/index.ts +11 -14
- package/src/browser/gjs.ts +7 -5
- package/src/browser/known-modules.ts +2 -0
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,KAA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AAK,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;AACvF,wBAAgB,QAAQ,CAAC,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gjs.d.ts","sourceRoot":"","sources":["../../src/browser/gjs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;
|
|
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,6 +28,7 @@ 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';
|
|
@@ -23,6 +44,7 @@ export declare const modules: {
|
|
|
23
44
|
'@ember/application': typeof _application;
|
|
24
45
|
'@ember/array': typeof _array;
|
|
25
46
|
'@ember/component': typeof _EmberComponent;
|
|
47
|
+
'@ember/component/helper': typeof _EmberComponentHelper;
|
|
26
48
|
'@ember/component/template-only': <S>(moduleName?: string | undefined, name?: string | undefined) => import("@ember/component/template-only").TemplateOnlyComponent<S>;
|
|
27
49
|
'@ember/debug': typeof _debug;
|
|
28
50
|
'@ember/destroyable': typeof _destroyable;
|
|
@@ -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"}
|
|
@@ -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;A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AAI,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;;;;"}
|
package/dist/browser/gjs.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { importSync } from '@embroider/macros';
|
|
2
2
|
import babelPluginEmberTemplateCompilation from 'babel-plugin-ember-template-compilation';
|
|
3
|
-
import { createPreprocessor } from 'content-tag/standalone';
|
|
4
3
|
|
|
5
4
|
const compiler = importSync('ember-source/dist/ember-template-compiler.js');
|
|
6
5
|
let processor;
|
|
7
6
|
let fetchingPromise;
|
|
8
7
|
async function preprocess(input, name) {
|
|
9
8
|
if (!fetchingPromise) {
|
|
10
|
-
fetchingPromise =
|
|
9
|
+
fetchingPromise = import('content-tag');
|
|
10
|
+
}
|
|
11
|
+
if (!processor) {
|
|
12
|
+
let {
|
|
13
|
+
Preprocessor
|
|
14
|
+
} = await fetchingPromise;
|
|
15
|
+
processor = new Preprocessor();
|
|
11
16
|
}
|
|
12
|
-
processor = await fetchingPromise;
|
|
13
17
|
return processor.process(input, `${name}.js`);
|
|
14
18
|
}
|
|
15
19
|
async function transform(intermediate, name, options = {}) {
|
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\nimport type { Babel } from './types.ts';\n\nconst compiler = importSync('ember-source/dist/ember-template-compiler.js');\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,6 +3,7 @@ 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';
|
|
@@ -24,6 +25,7 @@ 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,
|
|
@@ -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 _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":"
|
|
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,19 +60,23 @@
|
|
|
60
60
|
],
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@babel/helper-plugin-utils": "^7.22.5",
|
|
63
|
-
"@babel/standalone": "^7.23.
|
|
63
|
+
"@babel/standalone": "^7.23.6",
|
|
64
64
|
"@embroider/addon-shim": "1.8.7",
|
|
65
|
-
"@embroider/macros": "1.13.
|
|
65
|
+
"@embroider/macros": "1.13.5",
|
|
66
|
+
"@glimmer/compiler": ">= 0.86.0",
|
|
67
|
+
"@glimmer/syntax": ">= 0.86.0",
|
|
66
68
|
"babel-import-util": "^2.0.1",
|
|
67
69
|
"babel-plugin-ember-template-compilation": "^2.2.1",
|
|
68
70
|
"broccoli-file-creator": "^2.1.1",
|
|
69
|
-
"change-case": "^5.
|
|
71
|
+
"change-case": "^5.3.0",
|
|
70
72
|
"common-tags": "^1.8.2",
|
|
71
|
-
"content-tag": "
|
|
73
|
+
"content-tag": "^1.2.1",
|
|
74
|
+
"decorator-transforms": "^1.1.0",
|
|
72
75
|
"line-column": "^1.0.2",
|
|
73
76
|
"magic-string": "^0.30.5",
|
|
74
77
|
"mdast": "^3.0.0",
|
|
75
78
|
"parse-static-imports": "^1.1.0",
|
|
79
|
+
"reactiveweb": "^1.2.0",
|
|
76
80
|
"rehype-raw": "^6.1.1",
|
|
77
81
|
"rehype-stringify": "^9.0.4",
|
|
78
82
|
"remark-gfm": "^3.0.1",
|
|
@@ -84,52 +88,51 @@
|
|
|
84
88
|
"vfile": "^6.0.1"
|
|
85
89
|
},
|
|
86
90
|
"devDependencies": {
|
|
87
|
-
"@babel/core": "^7.23.
|
|
91
|
+
"@babel/core": "^7.23.7",
|
|
92
|
+
"@babel/plugin-transform-typescript": "^7.23.6",
|
|
88
93
|
"@babel/preset-typescript": "^7.23.3",
|
|
89
|
-
"@babel/types": "^7.23.
|
|
94
|
+
"@babel/types": "^7.23.9",
|
|
90
95
|
"@ember/test-helpers": "^3.2.1",
|
|
91
96
|
"@ember/test-waiters": "^3.1.0",
|
|
92
|
-
"@embroider/addon-dev": "4.1.
|
|
93
|
-
"@glimmer/compiler": "^0.85.13",
|
|
97
|
+
"@embroider/addon-dev": "4.1.3",
|
|
94
98
|
"@glimmer/component": "^1.1.2",
|
|
95
|
-
"@glimmer/interfaces": "
|
|
96
|
-
"@glimmer/reference": "
|
|
97
|
-
"@glimmer/syntax": "^0.85.13",
|
|
99
|
+
"@glimmer/interfaces": ">= 0.86.0",
|
|
100
|
+
"@glimmer/reference": ">= 0.86.0",
|
|
98
101
|
"@glimmer/tracking": "^1.1.2",
|
|
99
|
-
"@glimmer/util": "^0.
|
|
100
|
-
"@glint/core": "
|
|
101
|
-
"@glint/environment-ember-loose": "
|
|
102
|
-
"@glint/environment-ember-template-imports": "
|
|
103
|
-
"@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",
|
|
104
107
|
"@nullvoxpopuli/eslint-configs": "^3.2.2",
|
|
105
108
|
"@rollup/plugin-babel": "^6.0.4",
|
|
106
109
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
107
110
|
"@tsconfig/ember": "^3.0.2",
|
|
108
|
-
"@types/babel__core": "^7.20.
|
|
111
|
+
"@types/babel__core": "^7.20.5",
|
|
109
112
|
"@types/babel__standalone": "^7.1.7",
|
|
110
113
|
"@types/babel__traverse": "^7.20.4",
|
|
111
114
|
"@types/hast": "^3.0.3",
|
|
112
115
|
"@types/mdast": "^4.0.3",
|
|
113
116
|
"@types/unist": "^3.0.2",
|
|
114
117
|
"@types/uuid": "^9.0.7",
|
|
115
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
116
|
-
"@typescript-eslint/parser": "^6.
|
|
118
|
+
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
|
119
|
+
"@typescript-eslint/parser": "^6.20.0",
|
|
117
120
|
"concurrently": "^8.2.2",
|
|
118
121
|
"ember-resources": "^6.4.2",
|
|
119
|
-
"ember-source": "^5.
|
|
122
|
+
"ember-source": "^5.5.0",
|
|
120
123
|
"ember-template-imports": "^3.4.2",
|
|
121
|
-
"ember-template-lint": "^5.
|
|
122
|
-
"eslint": "^8.
|
|
123
|
-
"eslint-plugin-ember": "^
|
|
124
|
+
"ember-template-lint": "^5.13.0",
|
|
125
|
+
"eslint": "^8.55.0",
|
|
126
|
+
"eslint-plugin-ember": "^12.0.0",
|
|
124
127
|
"eslint-plugin-node": "^11.1.0",
|
|
125
128
|
"eslint-plugin-prettier": "^5.0.1",
|
|
126
|
-
"prettier": "^3.
|
|
127
|
-
"prettier-plugin-ember-template-tag": "^
|
|
128
|
-
"publint": "^0.2.
|
|
129
|
-
"rollup": "~4.
|
|
129
|
+
"prettier": "^3.1.1",
|
|
130
|
+
"prettier-plugin-ember-template-tag": "^2.0.0",
|
|
131
|
+
"publint": "^0.2.6",
|
|
132
|
+
"rollup": "~4.9.0",
|
|
130
133
|
"rollup-plugin-copy": "^3.5.0",
|
|
131
134
|
"rollup-plugin-glimmer-template-tag": "^0.4.1",
|
|
132
|
-
"typescript": "^5.
|
|
135
|
+
"typescript": "^5.3.3",
|
|
133
136
|
"@nullvoxpopuli/limber-untyped": "0.0.0"
|
|
134
137
|
},
|
|
135
138
|
"volta": {
|
|
@@ -145,12 +148,12 @@
|
|
|
145
148
|
"app-js": {}
|
|
146
149
|
},
|
|
147
150
|
"peerDependencies": {
|
|
148
|
-
"@glimmer/compiler": "
|
|
151
|
+
"@glimmer/compiler": ">= 0.86.0",
|
|
149
152
|
"@glimmer/component": "^1.1.2",
|
|
150
|
-
"@glimmer/syntax": "
|
|
151
|
-
"@glint/template": "
|
|
152
|
-
"ember-resources": "
|
|
153
|
-
"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"
|
|
154
157
|
},
|
|
155
158
|
"engines": {
|
|
156
159
|
"node": ">= v16",
|
|
@@ -160,7 +163,6 @@
|
|
|
160
163
|
"scripts": {
|
|
161
164
|
"build": "concurrently 'npm:build:*'",
|
|
162
165
|
"build:js": "rollup --config",
|
|
163
|
-
"build:types": "tsc --emitDeclarationOnly --noEmit false",
|
|
164
166
|
"lint:types": "tsc --noEmit",
|
|
165
167
|
"lint:fix": "pnpm -w exec lint fix",
|
|
166
168
|
"start": "rollup --config --watch",
|
|
@@ -171,6 +173,7 @@
|
|
|
171
173
|
"lint:hbs": "pnpm -w exec lint hbs",
|
|
172
174
|
"lint:hbs:fix": "pnpm -w exec lint hbs:fix",
|
|
173
175
|
"lint:prettier:fix": "pnpm -w exec lint prettier:fix",
|
|
174
|
-
"lint:prettier": "pnpm -w exec lint prettier"
|
|
176
|
+
"lint:prettier": "pnpm -w exec lint prettier",
|
|
177
|
+
"build:types": "tsc --emitDeclarationOnly --noEmit false"
|
|
175
178
|
}
|
|
176
179
|
}
|
|
@@ -151,16 +151,17 @@ export interface Value {
|
|
|
151
151
|
component: ComponentLike;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
export function
|
|
155
|
-
export function
|
|
156
|
-
export function
|
|
157
|
-
export function
|
|
158
|
-
export function
|
|
159
|
-
markdownText: Input | (() => Input),
|
|
160
|
-
options?: () => ExtraOptions
|
|
161
|
-
): Value;
|
|
154
|
+
export function Compiled(markdownText: Input | (() => Input)): Value;
|
|
155
|
+
export function Compiled(markdownText: Input | (() => Input), options?: Format): Value;
|
|
156
|
+
export function Compiled(markdownText: Input | (() => Input), options?: () => Format): Value;
|
|
157
|
+
export function Compiled(markdownText: Input | (() => Input), options?: ExtraOptions): Value;
|
|
158
|
+
export function Compiled(markdownText: Input | (() => Input), options?: () => ExtraOptions): Value;
|
|
162
159
|
|
|
163
|
-
|
|
160
|
+
/**
|
|
161
|
+
* By default, this compiles to `glimdown`. A Markdown format which
|
|
162
|
+
* extracts `live` tagged code snippets and compiles them to components.
|
|
163
|
+
*/
|
|
164
|
+
export function Compiled(
|
|
164
165
|
markdownText: Input | (() => Input),
|
|
165
166
|
maybeOptions?: Format | (() => Format) | ExtraOptions | (() => ExtraOptions)
|
|
166
167
|
): Value {
|
|
@@ -202,8 +203,4 @@ export function buildCompiler(
|
|
|
202
203
|
});
|
|
203
204
|
}
|
|
204
205
|
|
|
205
|
-
|
|
206
|
-
* By default, this compiles to `glimdown`. A Markdown format which
|
|
207
|
-
* extracts `live` tagged code snippets and compiles them to components.
|
|
208
|
-
*/
|
|
209
|
-
export const Compiled = resourceFactory(buildCompiler) as typeof buildCompiler;
|
|
206
|
+
resourceFactory(Compiled);
|
package/src/browser/gjs.ts
CHANGED
|
@@ -6,17 +6,19 @@ import type { Babel } from './types.ts';
|
|
|
6
6
|
|
|
7
7
|
const compiler = importSync('ember-source/dist/ember-template-compiler.js');
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
let processor;
|
|
9
|
+
let processor: any;
|
|
12
10
|
let fetchingPromise: Promise<any>;
|
|
13
11
|
|
|
14
12
|
export async function preprocess(input: string, name: string): Promise<string> {
|
|
15
13
|
if (!fetchingPromise) {
|
|
16
|
-
fetchingPromise =
|
|
14
|
+
fetchingPromise = import('content-tag');
|
|
17
15
|
}
|
|
18
16
|
|
|
19
|
-
processor
|
|
17
|
+
if (!processor) {
|
|
18
|
+
let { Preprocessor } = await fetchingPromise;
|
|
19
|
+
|
|
20
|
+
processor = new Preprocessor();
|
|
21
|
+
}
|
|
20
22
|
|
|
21
23
|
return processor.process(input, `${name}.js`);
|
|
22
24
|
}
|
|
@@ -7,6 +7,7 @@ import * as _tracking from '@glimmer/tracking';
|
|
|
7
7
|
import * as _application from '@ember/application';
|
|
8
8
|
import * as _array from '@ember/array';
|
|
9
9
|
import * as _EmberComponent from '@ember/component';
|
|
10
|
+
import * as _EmberComponentHelper from '@ember/component/helper';
|
|
10
11
|
import _TO from '@ember/component/template-only';
|
|
11
12
|
import * as _debug from '@ember/debug';
|
|
12
13
|
import * as _destroyable from '@ember/destroyable';
|
|
@@ -26,6 +27,7 @@ export const modules = {
|
|
|
26
27
|
'@ember/application': _application,
|
|
27
28
|
'@ember/array': _array,
|
|
28
29
|
'@ember/component': _EmberComponent,
|
|
30
|
+
'@ember/component/helper': _EmberComponentHelper,
|
|
29
31
|
'@ember/component/template-only': _TO,
|
|
30
32
|
'@ember/debug': _debug,
|
|
31
33
|
'@ember/destroyable': _destroyable,
|