ember-repl 3.0.0-beta.4 → 3.0.0-beta.5
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/declarations/browser/cjs/eval.d.ts +9 -0
- package/declarations/browser/cjs/eval.d.ts.map +1 -0
- package/declarations/browser/cjs/index.d.ts +7 -0
- package/declarations/browser/cjs/index.d.ts.map +1 -0
- package/declarations/browser/compile/formats.d.ts +16 -0
- package/declarations/browser/compile/formats.d.ts.map +1 -0
- package/{dist → declarations}/browser/compile/index.d.ts +14 -13
- package/declarations/browser/compile/index.d.ts.map +1 -0
- package/{dist → declarations}/browser/compile/markdown-to-ember.d.ts +5 -4
- package/declarations/browser/compile/markdown-to-ember.d.ts.map +1 -0
- package/declarations/browser/compile/types.d.ts +7 -0
- package/declarations/browser/compile/types.d.ts.map +1 -0
- package/declarations/browser/esm/index.d.ts +8 -0
- package/declarations/browser/esm/index.d.ts.map +1 -0
- package/{dist → declarations}/browser/eti/babel-plugin.d.ts +2 -2
- package/declarations/browser/eti/babel-plugin.d.ts.map +1 -0
- package/declarations/browser/eti/debug.d.ts +2 -0
- package/declarations/browser/eti/debug.d.ts.map +1 -0
- package/{dist → declarations}/browser/eti/parse-templates.d.ts +7 -7
- package/declarations/browser/eti/parse-templates.d.ts.map +1 -0
- package/{dist → declarations}/browser/eti/preprocess.d.ts +3 -2
- package/declarations/browser/eti/preprocess.d.ts.map +1 -0
- package/{dist → declarations}/browser/eti/template-tag-transform.d.ts +2 -2
- package/declarations/browser/eti/template-tag-transform.d.ts.map +1 -0
- package/declarations/browser/eti/util.d.ts +14 -0
- package/declarations/browser/eti/util.d.ts.map +1 -0
- package/declarations/browser/gjs.d.ts +4 -0
- package/declarations/browser/gjs.d.ts.map +1 -0
- package/{dist → declarations}/browser/hbs.d.ts +4 -3
- package/declarations/browser/hbs.d.ts.map +1 -0
- package/declarations/browser/index.d.ts +7 -0
- package/declarations/browser/index.d.ts.map +1 -0
- package/{dist → declarations}/browser/js.d.ts +3 -3
- package/declarations/browser/js.d.ts.map +1 -0
- package/{dist → declarations}/browser/known-modules.d.ts +6 -5
- package/declarations/browser/known-modules.d.ts.map +1 -0
- package/declarations/browser/types.d.ts +21 -0
- package/declarations/browser/types.d.ts.map +1 -0
- package/{dist → declarations}/browser/utils.d.ts +4 -4
- package/declarations/browser/utils.d.ts.map +1 -0
- package/declarations/test-support/index.d.ts +2 -0
- package/declarations/test-support/index.d.ts.map +1 -0
- package/dist/browser/cjs/eval.js.map +1 -1
- package/dist/browser/cjs/index.js.map +1 -1
- package/dist/browser/compile/formats.js.map +1 -1
- package/dist/browser/compile/index.js.map +1 -1
- package/dist/browser/compile/markdown-to-ember.js +2 -2
- package/dist/browser/compile/markdown-to-ember.js.map +1 -1
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/eti/babel-plugin.js.map +1 -1
- package/dist/browser/eti/parse-templates.js.map +1 -1
- package/dist/browser/eti/preprocess.js +2 -167
- package/dist/browser/eti/preprocess.js.map +1 -1
- package/dist/browser/eti/template-tag-transform.js.map +1 -1
- package/dist/browser/eti/util.js.map +1 -1
- package/dist/browser/gjs.js.map +1 -1
- package/dist/browser/hbs.js.map +1 -1
- package/dist/browser/js.js.map +1 -1
- package/dist/test-support/index.js.map +1 -1
- package/package.json +76 -56
- package/src/browser/cjs/eval.ts +2 -2
- package/src/browser/cjs/index.ts +4 -4
- package/src/browser/compile/formats.ts +14 -11
- package/src/browser/compile/index.ts +6 -6
- package/src/browser/compile/markdown-to-ember.ts +5 -5
- package/src/browser/esm/index.ts +4 -4
- package/src/browser/eti/babel-plugin.ts +2 -2
- package/src/browser/eti/parse-templates.ts +2 -2
- package/src/browser/eti/preprocess.ts +3 -3
- package/src/browser/eti/template-tag-transform.ts +1 -1
- package/src/browser/eti/util.ts +1 -1
- package/src/browser/gjs.ts +4 -4
- package/src/browser/hbs.ts +2 -2
- package/src/browser/index.ts +5 -5
- package/src/browser/js.ts +3 -3
- package/src/test-support/index.ts +1 -1
- package/dist/browser/cjs/eval.d.ts +0 -10
- package/dist/browser/cjs/eval.d.ts.map +0 -1
- package/dist/browser/cjs/index.d.ts +0 -7
- package/dist/browser/compile/formats.d.ts +0 -16
- package/dist/browser/compile/types.d.ts +0 -7
- package/dist/browser/esm/index.d.ts +0 -8
- package/dist/browser/eti/debug.d.ts +0 -2
- package/dist/browser/eti/util.d.ts +0 -14
- package/dist/browser/gjs.d.ts +0 -4
- package/dist/browser/index.d.ts +0 -6
- package/dist/browser/types.d.ts +0 -21
- package/dist/test-support/index.d.ts +0 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ExtraModules } from '../types.ts';
|
|
2
|
+
import type Component from '@glimmer/component';
|
|
3
|
+
export declare function evalSnippet(compiled: string, extraModules?: ExtraModules): {
|
|
4
|
+
default: Component;
|
|
5
|
+
services?: {
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=eval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eval.d.ts","sourceRoot":"","sources":["../../../src/browser/cjs/eval.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAC;AAEhD,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,YAAY,GAAE,YAAiB,GAC9B;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,QAAQ,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;CACvC,CAmBA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/cjs/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG/D,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAkBjG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CompileResult } from '../types.ts';
|
|
2
|
+
import type { EvalImportMap, ScopeMap } from './types.ts';
|
|
3
|
+
export declare function compileGJS(gjsInput: string, importMap?: EvalImportMap): Promise<CompileResult>;
|
|
4
|
+
export declare function compileHBS(hbsInput: string, options?: {
|
|
5
|
+
moduleName?: string;
|
|
6
|
+
scope?: Record<string, unknown>;
|
|
7
|
+
}): Promise<CompileResult>;
|
|
8
|
+
export declare function compileMD(glimdownInput: string, options?: {
|
|
9
|
+
importMap?: EvalImportMap;
|
|
10
|
+
topLevelScope?: ScopeMap;
|
|
11
|
+
CopyComponent?: string;
|
|
12
|
+
ShadowComponent?: string;
|
|
13
|
+
}): Promise<CompileResult & {
|
|
14
|
+
rootTemplate?: string;
|
|
15
|
+
}>;
|
|
16
|
+
//# sourceMappingURL=formats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formats.d.ts","sourceRoot":"","sources":["../../../src/browser/compile/formats.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAY1D,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,aAAa,GACxB,OAAO,CAAC,aAAa,CAAC,CAQxB;AAED,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;IACR,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC,GACA,OAAO,CAAC,aAAa,CAAC,CAQxB;AAwCD,wBAAsB,SAAS,CAC7B,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE;IACR,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,aAAa,CAAC,EAAE,QAAQ,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GACA,OAAO,CAAC,aAAa,GAAG;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAiFpD"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { EvalImportMap, ScopeMap } from
|
|
2
|
-
import { ComponentLike } from '@glint/template';
|
|
1
|
+
import type { EvalImportMap, ScopeMap } from './types.ts';
|
|
2
|
+
import type { ComponentLike } from '@glint/template';
|
|
3
3
|
type Format = 'glimdown' | 'gjs' | 'hbs';
|
|
4
|
-
declare const CACHE: Map<string, ComponentLike>;
|
|
4
|
+
export declare const CACHE: Map<string, ComponentLike>;
|
|
5
5
|
/**
|
|
6
6
|
* This compileMD is a more robust version of the raw compiling used in "formats".
|
|
7
7
|
* This function manages cache, and has events for folks building UIs to hook in to
|
|
8
8
|
*/
|
|
9
|
-
declare function compile(text: string, { format, onSuccess, onError, onCompileStart, ...options }: {
|
|
9
|
+
export declare function compile(text: string, { format, onSuccess, onError, onCompileStart, ...options }: {
|
|
10
10
|
format: Format;
|
|
11
11
|
onSuccess: (component: ComponentLike) => Promise<unknown> | unknown;
|
|
12
12
|
onError: (error: string) => Promise<unknown> | unknown;
|
|
@@ -33,19 +33,20 @@ type ExtraOptions = {
|
|
|
33
33
|
/**
|
|
34
34
|
* @internal
|
|
35
35
|
*/
|
|
36
|
-
interface Value {
|
|
36
|
+
export interface Value {
|
|
37
37
|
isReady: boolean;
|
|
38
|
-
error:
|
|
38
|
+
error: string | null;
|
|
39
39
|
component: ComponentLike;
|
|
40
40
|
}
|
|
41
|
-
declare function buildCompiler(markdownText: Input | (() => Input)): Value;
|
|
42
|
-
declare function buildCompiler(markdownText: Input | (() => Input), options?: Format): Value;
|
|
43
|
-
declare function buildCompiler(markdownText: Input | (() => Input), options?: () => Format): Value;
|
|
44
|
-
declare function buildCompiler(markdownText: Input | (() => Input), options?: ExtraOptions): Value;
|
|
45
|
-
declare function buildCompiler(markdownText: Input | (() => Input), options?: () => ExtraOptions): Value;
|
|
41
|
+
export declare function buildCompiler(markdownText: Input | (() => Input)): Value;
|
|
42
|
+
export declare function buildCompiler(markdownText: Input | (() => Input), options?: Format): Value;
|
|
43
|
+
export declare function buildCompiler(markdownText: Input | (() => Input), options?: () => Format): Value;
|
|
44
|
+
export declare function buildCompiler(markdownText: Input | (() => Input), options?: ExtraOptions): Value;
|
|
45
|
+
export declare function buildCompiler(markdownText: Input | (() => Input), options?: () => ExtraOptions): Value;
|
|
46
46
|
/**
|
|
47
47
|
* By default, this compiles to `glimdown`. A Markdown format which
|
|
48
48
|
* extracts `live` tagged code snippets and compiles them to components.
|
|
49
49
|
*/
|
|
50
|
-
declare const Compiled: typeof buildCompiler;
|
|
51
|
-
export {
|
|
50
|
+
export declare const Compiled: typeof buildCompiler;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/compile/index.ts"],"names":[],"mappings":"AAUA,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;AAItD;;;GAGG;AACH,wBAAsB,OAAO,CAC3B,IAAI,EAAE,MAAM,EACZ,EACE,MAAM,EACN,SAAS,EACT,O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AC,EAAE,MAAM,GAAG,KAAK,CAAC;AAC5F,wBAAgB,aAAa,CAAC,YAAY,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,MAAM,GAAG,KAAK,CAAC;AAClG,wBAAgB,aAAa,CAAC,YAAY,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,KAAK,CAAC;AAClG,wBAAgB,aAAa,CAC3B,YAAY,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,EACnC,OAAO,CAAC,EAAE,MAAM,YAAY,GAC3B,KAAK,CAAC;AA2CT;;;GAGG;AACH,eAAO,MAAM,QAAQ,sBAAyD,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
interface ExtractedCode {
|
|
1
|
+
export interface ExtractedCode {
|
|
2
2
|
name: string;
|
|
3
3
|
code: string;
|
|
4
4
|
lang: string;
|
|
5
5
|
}
|
|
6
|
-
interface LiveCodeExtraction {
|
|
6
|
+
export interface LiveCodeExtraction {
|
|
7
7
|
templateOnlyGlimdown: string;
|
|
8
8
|
blocks: ExtractedCode[];
|
|
9
9
|
}
|
|
@@ -14,5 +14,6 @@ interface ParseMarkdownOptions {
|
|
|
14
14
|
/**
|
|
15
15
|
* @internal not under semver
|
|
16
16
|
*/
|
|
17
|
-
declare function parseMarkdown(input: string, options?: ParseMarkdownOptions): Promise<LiveCodeExtraction>;
|
|
18
|
-
export {
|
|
17
|
+
export declare function parseMarkdown(input: string, options?: ParseMarkdownOptions): Promise<LiveCodeExtraction>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=markdown-to-ember.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-to-ember.d.ts","sourceRoot":"","sources":["../../../src/browser/compile/markdown-to-ember.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB;AAoRD,UAAU,oBAAoB;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,kBAAkB,CAAC,CAO7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/browser/compile/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,CAAC;CAChC;AAED,MAAM,WAAW,QAAQ;IACvB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;CAC9B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CompileResult, ExtraModules } from '../types.ts';
|
|
2
|
+
export interface Info {
|
|
3
|
+
code: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function compileJS(code: string, extraModules?: ExtraModules): Promise<CompileResult>;
|
|
7
|
+
export declare function proxyToSkypack(code: string, extraModules?: ExtraModules): string;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/esm/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI/D,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAoBjG;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,YAAY,UAavE"}
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
* setComponentTemplate(precompileTemplate(`D`, {...}), D);
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
export default function (babel: any): {
|
|
52
52
|
visitor: any;
|
|
53
53
|
};
|
|
54
|
-
|
|
54
|
+
//# sourceMappingURL=babel-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"babel-plugin.d.ts","sourceRoot":"","sources":["../../../src/browser/eti/babel-plugin.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,MAAM,CAAC,OAAO,WAAW,KAAK,EAAE,GAAG;;EA8ClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../../src/browser/eti/debug.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAMzE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
type TemplateMatch = TemplateTagMatch;
|
|
2
|
-
interface TemplateTagMatch {
|
|
1
|
+
export type TemplateMatch = TemplateTagMatch;
|
|
2
|
+
export interface TemplateTagMatch {
|
|
3
3
|
type: 'template-tag';
|
|
4
4
|
tagName: string;
|
|
5
5
|
start: RegExpMatchArray;
|
|
@@ -9,7 +9,7 @@ interface TemplateTagMatch {
|
|
|
9
9
|
/**
|
|
10
10
|
* Represents a static import of a template literal.
|
|
11
11
|
*/
|
|
12
|
-
interface StaticImportConfig {
|
|
12
|
+
export interface StaticImportConfig {
|
|
13
13
|
/**
|
|
14
14
|
* The path to the package from which we want to import the template literal
|
|
15
15
|
* (e.g.: 'ember-cli-htmlbars')
|
|
@@ -26,11 +26,11 @@ interface StaticImportConfig {
|
|
|
26
26
|
*
|
|
27
27
|
* @param templateTag
|
|
28
28
|
*/
|
|
29
|
-
interface ParseTemplatesOptions {
|
|
29
|
+
export interface ParseTemplatesOptions {
|
|
30
30
|
/** Tag to use, if parsing template tags is enabled. */
|
|
31
31
|
templateTag?: string;
|
|
32
32
|
}
|
|
33
|
-
declare const DEFAULT_PARSE_TEMPLATES_OPTIONS: {
|
|
33
|
+
export declare const DEFAULT_PARSE_TEMPLATES_OPTIONS: {
|
|
34
34
|
templateTag: string;
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
@@ -52,5 +52,5 @@ declare const DEFAULT_PARSE_TEMPLATES_OPTIONS: {
|
|
|
52
52
|
* @param options optional configuration options for how to parse templates
|
|
53
53
|
* @returns
|
|
54
54
|
*/
|
|
55
|
-
declare function parseTemplates(template: string, relativePath: string, options?: ParseTemplatesOptions): TemplateMatch[];
|
|
56
|
-
|
|
55
|
+
export declare function parseTemplates(template: string, relativePath: string, options?: ParseTemplatesOptions): TemplateMatch[];
|
|
56
|
+
//# sourceMappingURL=parse-templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-templates.d.ts","sourceRoot":"","sources":["../../../src/browser/eti/parse-templates.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,GAAG,gBAAgB,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,gBAAgB,CAAC;IACxB,GAAG,EAAE,gBAAgB,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA8BD,eAAO,MAAM,+BAA+B;;CAE3C,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,qBAAuD,GAC/D,aAAa,EAAE,CA6LjB"}
|
|
@@ -53,5 +53,6 @@ interface Replacement {
|
|
|
53
53
|
*
|
|
54
54
|
* hbs(`<MyComponent/>`, { scope() { return {MyComponent}; } });
|
|
55
55
|
*/
|
|
56
|
-
declare function preprocessEmbeddedTemplates(template: string, options: PreprocessOptions): PreprocessedOutput;
|
|
57
|
-
export {
|
|
56
|
+
export declare function preprocessEmbeddedTemplates(template: string, options: PreprocessOptions): PreprocessedOutput;
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=preprocess.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preprocess.d.ts","sourceRoot":"","sources":["../../../src/browser/eti/preprocess.ts"],"names":[],"mappings":"AAcA,UAAU,sBAAsB;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAED,UAAU,qBAAqB;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAED,KAAK,iBAAiB,GAAG,qBAAqB,GAAG,sBAAsB,CAAC;AAExE,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,WAAW,EAAE,CAAC;CAC7B;AAED,UAAU,WAAW;IACnB,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAoED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,iBAAiB,GACzB,kBAAkB,CAgCpB"}
|
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
* [GLIMMER_TEMPLATE('hello')];
|
|
12
12
|
* }
|
|
13
13
|
*/
|
|
14
|
-
declare const transformTemplateTag: (t: any, templatePath: any, state: any) => void;
|
|
15
|
-
|
|
14
|
+
export declare const transformTemplateTag: (t: any, templatePath: any, state: any) => void;
|
|
15
|
+
//# sourceMappingURL=template-tag-transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-tag-transform.d.ts","sourceRoot":"","sources":["../../../src/browser/eti/template-tag-transform.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,MAAgB,GAAG,gBAAgB,GAAG,SAAS,GAAG,SAgFlF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TemplateMatch } from './parse-templates.ts';
|
|
2
|
+
import type { NodePath } from '@babel/traverse';
|
|
3
|
+
import type { CallExpression } from '@babel/types';
|
|
4
|
+
import type { ImportUtil } from 'babel-import-util';
|
|
5
|
+
export declare const TEMPLATE_TAG_NAME = "template";
|
|
6
|
+
export declare const TEMPLATE_TAG_PLACEHOLDER = "__GLIMMER_TEMPLATE";
|
|
7
|
+
export declare function isTemplateTag(callExpressionPath: NodePath<CallExpression>): boolean;
|
|
8
|
+
export declare function buildPrecompileTemplateCall(t: any, callExpressionPath: NodePath<CallExpression>, state: {
|
|
9
|
+
importUtil: ImportUtil;
|
|
10
|
+
}): CallExpression;
|
|
11
|
+
export declare function registerRefs(newPath: string | string[], getRefPaths: (path: string) => NodePath[]): void;
|
|
12
|
+
export declare function isSupportedScriptFileExtension(filePath: string): boolean;
|
|
13
|
+
export declare function isStrictMode(templateInfo: TemplateMatch): boolean;
|
|
14
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/browser/eti/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,eAAO,MAAM,iBAAiB,aAAa,CAAC;AAC5C,eAAO,MAAM,wBAAwB,uBAAuB,CAAC;AAE7D,wBAAgB,aAAa,CAAC,kBAAkB,EAAE,QAAQ,CAAC,cAAc,CAAC,WAMzE;AAED,wBAAgB,2BAA2B,CACzC,CAAC,EAAE,GAAG,EACN,kBAAkB,EAAE,QAAQ,CAAC,cAAc,CAAC,EAC5C,KAAK,EAAE;IACL,UAAU,EAAE,UAAU,CAAC;CACxB,GACA,cAAc,CAOhB;AAED,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,QAAQ,EAAE,QA2B1C;AAID,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,WAE9D;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,aAAa,GAAG,OAAO,CAEjE"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Babel } from './types.ts';
|
|
2
|
+
export declare function preprocess(input: string, name: string): string;
|
|
3
|
+
export declare function transform(intermediate: string, name: string, options?: any): Promise<ReturnType<Babel['transform']>>;
|
|
4
|
+
//# sourceMappingURL=gjs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gjs.d.ts","sourceRoot":"","sources":["../../src/browser/gjs.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAIxC,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAUrD;AAED,wBAAsB,SAAS,CAC7B,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,GAAQ,GAChB,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CA6BzC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { CompileResult } from
|
|
1
|
+
import type { CompileResult } from './types.ts';
|
|
2
2
|
/**
|
|
3
3
|
* compile a template with an empty scope
|
|
4
4
|
* to use components, helpers, etc, you will need to compile with JS
|
|
5
5
|
*
|
|
6
6
|
* (templates alone do not have a way to import / define complex structures)
|
|
7
7
|
*/
|
|
8
|
-
declare function compileHBS(template: string, options?: CompileTemplateOptions): CompileResult;
|
|
8
|
+
export declare function compileHBS(template: string, options?: CompileTemplateOptions): CompileResult;
|
|
9
9
|
interface CompileTemplateOptions {
|
|
10
10
|
/**
|
|
11
11
|
* Used for debug viewing
|
|
@@ -13,4 +13,5 @@ interface CompileTemplateOptions {
|
|
|
13
13
|
moduleName?: string;
|
|
14
14
|
scope?: Record<string, unknown>;
|
|
15
15
|
}
|
|
16
|
-
export {
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=hbs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hbs.d.ts","sourceRoot":"","sources":["../../src/browser/hbs.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAQhD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,sBAA2B,GAAG,aAAa,CAehG;AAED,UAAU,sBAAsB;IAC9B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { compile, Compiled } from './compile/index.ts';
|
|
2
|
+
export { compileHBS } from './hbs.ts';
|
|
3
|
+
export { compileJS } from './js.ts';
|
|
4
|
+
export { modules as frameworkModules } from './known-modules.ts';
|
|
5
|
+
export { invocationName, invocationOf, nameFor } from './utils.ts';
|
|
6
|
+
export type { CompileResult } from './types';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGnE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CompileResult, ExtraModules, Options } from
|
|
1
|
+
import type { CompileResult, ExtraModules, Options } from './types.ts';
|
|
2
2
|
/**
|
|
3
3
|
* @public
|
|
4
4
|
* Transpiles GlimmerJS (*.gjs) formatted text into and evaluates as a JS Module.
|
|
@@ -16,5 +16,5 @@ import { CompileResult, ExtraModules, Options } from "./types.js";
|
|
|
16
16
|
* are not provided by extraModules will be searched on npm to see if a package
|
|
17
17
|
* needs to be downloaded before running the `code` / invoking the component
|
|
18
18
|
*/
|
|
19
|
-
declare function compileJS(code: string, extraModules?: ExtraModules, options?: Options): Promise<CompileResult>;
|
|
20
|
-
|
|
19
|
+
export declare function compileJS(code: string, extraModules?: ExtraModules, options?: Options): Promise<CompileResult>;
|
|
20
|
+
//# sourceMappingURL=js.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"js.d.ts","sourceRoot":"","sources":["../../src/browser/js.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEvE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,YAAY,EAC3B,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,aAAa,CAAC,CAexB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="ember-source/types/stable/@ember/component/template-only" />
|
|
1
2
|
/**
|
|
2
3
|
* We need to import and hang on to these references so that they
|
|
3
4
|
* don't get optimized away during deploy
|
|
@@ -7,7 +8,6 @@ import * as _tracking from '@glimmer/tracking';
|
|
|
7
8
|
import * as _application from '@ember/application';
|
|
8
9
|
import * as _array from '@ember/array';
|
|
9
10
|
import * as _EmberComponent from '@ember/component';
|
|
10
|
-
import _TO from '@ember/component/template-only';
|
|
11
11
|
import * as _debug from '@ember/debug';
|
|
12
12
|
import * as _destroyable from '@ember/destroyable';
|
|
13
13
|
import * as _helpers from '@ember/helper';
|
|
@@ -15,12 +15,13 @@ import * as _modifier from '@ember/modifier';
|
|
|
15
15
|
import * as _object from '@ember/object';
|
|
16
16
|
import * as _runloop from '@ember/runloop';
|
|
17
17
|
import * as _service from '@ember/service';
|
|
18
|
+
import { createTemplateFactory } from '@ember/template-factory';
|
|
18
19
|
import * as _utils from '@ember/utils';
|
|
19
|
-
declare const modules: {
|
|
20
|
+
export declare const modules: {
|
|
20
21
|
'@ember/application': typeof _application;
|
|
21
22
|
'@ember/array': typeof _array;
|
|
22
23
|
'@ember/component': typeof _EmberComponent;
|
|
23
|
-
'@ember/component/template-only':
|
|
24
|
+
'@ember/component/template-only': <S>(moduleName?: string | undefined, name?: string | undefined) => import("@ember/component/template-only").TemplateOnlyComponent<S>;
|
|
24
25
|
'@ember/debug': typeof _debug;
|
|
25
26
|
'@ember/destroyable': typeof _destroyable;
|
|
26
27
|
'@ember/helper': typeof _helpers;
|
|
@@ -29,10 +30,10 @@ declare const modules: {
|
|
|
29
30
|
'@ember/runloop': typeof _runloop;
|
|
30
31
|
'@ember/service': typeof _service;
|
|
31
32
|
'@ember/template-factory': {
|
|
32
|
-
createTemplateFactory:
|
|
33
|
+
createTemplateFactory: typeof createTemplateFactory;
|
|
33
34
|
};
|
|
34
35
|
'@ember/utils': typeof _utils;
|
|
35
36
|
'@glimmer/component': typeof _GlimmerComponent;
|
|
36
37
|
'@glimmer/tracking': typeof _tracking;
|
|
37
38
|
};
|
|
38
|
-
|
|
39
|
+
//# sourceMappingURL=known-modules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-modules.d.ts","sourceRoot":"","sources":["../../src/browser/known-modules.ts"],"names":[],"mappings":";AAAA;;;GAGG;AACH,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,eAAe,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAG3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AAGvC,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;CAkBnB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { availablePlugins, availablePresets, transform } from '@babel/standalone';
|
|
2
|
+
import type { ComponentLike } from '@glint/template';
|
|
3
|
+
export interface CompileResult {
|
|
4
|
+
component?: ComponentLike;
|
|
5
|
+
error?: Error;
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
export interface Babel {
|
|
9
|
+
availablePlugins: typeof availablePlugins;
|
|
10
|
+
availablePresets: typeof availablePresets;
|
|
11
|
+
transform: typeof transform;
|
|
12
|
+
}
|
|
13
|
+
export type Options = {
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
* @deprecated do not use - not under semver
|
|
17
|
+
*/
|
|
18
|
+
skypack?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type ExtraModules = Record<string, unknown>;
|
|
21
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/browser/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACvF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,KAAK;IACpB,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;IAC1C,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;IAC1C,SAAS,EAAE,OAAO,SAAS,CAAC;CAC7B;AAED,MAAM,MAAM,OAAO,GAAG;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
* This can help with cacheing previously compiled components,
|
|
5
5
|
* and generally allowing a consumer to derive "known references" to user-input
|
|
6
6
|
*/
|
|
7
|
-
declare function nameFor(code: string, prefix?: string): string;
|
|
7
|
+
export declare function nameFor(code: string, prefix?: string): string;
|
|
8
8
|
/**
|
|
9
9
|
* Returns the text for invoking a component with a given name.
|
|
10
10
|
* It is assumed the component takes no arguments, as would be the
|
|
11
11
|
* case in REPLs / Playgrounds for the "root" component.
|
|
12
12
|
*/
|
|
13
|
-
declare function invocationOf(name: string): string;
|
|
13
|
+
export declare function invocationOf(name: string): string;
|
|
14
14
|
/**
|
|
15
15
|
* Core team does not want to support changes to '@ember/string' (v2 addonification, specifically)
|
|
16
16
|
* inflection does not support hyphens
|
|
17
17
|
*/
|
|
18
|
-
declare function invocationName(name: string): string;
|
|
19
|
-
|
|
18
|
+
export declare function invocationName(name: string): string;
|
|
19
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/browser/utils.ts"],"names":[],"mappings":"AAaA;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,SAAiB,UAI5D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,UAWxC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,UAE1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-support/index.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,SAEhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eval.js","sources":["../../../src/browser/cjs/eval.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { modules } from '../known-modules';\n\nimport type { ExtraModules } from '../types';\nimport type Component from '@glimmer/component';\n\nexport function evalSnippet(\n compiled: string,\n extraModules: ExtraModules = {}\n): {\n default: Component;\n services?: { [key: string]: unknown };\n} {\n const exports = {};\n\n function require(moduleName: keyof typeof modules): unknown {\n let preConfigured = modules[moduleName] || extraModules[moduleName];\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return preConfigured || window.require(moduleName);\n }\n\n // https://github.com/glimmerjs/glimmer-experimental/blob/master/packages/examples/playground/src/utils/eval-snippet.ts\n eval(compiled);\n\n return Object.assign(exports, { require }) as {\n default: Component;\n services?: { [key: string]: unknown };\n require: unknown;\n };\n}\n"],"names":["evalSnippet","compiled","extraModules","exports","require","moduleName","preConfigured","modules","window","eval","Object","assign"],"mappings":";;AAAA;AAMO,SAASA,WAAWA,CACzBC,QAAgB,EAChBC,YAA0B,GAAG,EAAE,EAI/B;EACA,MAAMC,OAAO,GAAG,EAAE,CAAA;EAElB,SAASC,OAAOA,CAACC,UAAgC,EAAW;IAC1D,IAAIC,aAAa,GAAGC,OAAO,CAACF,UAAU,CAAC,IAAIH,YAAY,CAACG,UAAU,CAAC,CAAA;;AAEnE;AACA;AACA,IAAA,OAAOC,aAAa,IAAIE,MAAM,CAACJ,OAAO,CAACC,UAAU,CAAC,CAAA;AACpD,GAAA;;AAEA;EACAI,IAAI,CAACR,QAAQ,CAAC,CAAA;AAEd,EAAA,OAAOS,MAAM,CAACC,MAAM,CAACR,OAAO,EAAE;AAAEC,IAAAA,OAAAA;AAAQ,GAAC,CAAC,CAAA;AAK5C;;;;"}
|
|
1
|
+
{"version":3,"file":"eval.js","sources":["../../../src/browser/cjs/eval.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { modules } from '../known-modules.ts';\n\nimport type { ExtraModules } from '../types.ts';\nimport type Component from '@glimmer/component';\n\nexport function evalSnippet(\n compiled: string,\n extraModules: ExtraModules = {}\n): {\n default: Component;\n services?: { [key: string]: unknown };\n} {\n const exports = {};\n\n function require(moduleName: keyof typeof modules): unknown {\n let preConfigured = modules[moduleName] || extraModules[moduleName];\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return preConfigured || window.require(moduleName);\n }\n\n // https://github.com/glimmerjs/glimmer-experimental/blob/master/packages/examples/playground/src/utils/eval-snippet.ts\n eval(compiled);\n\n return Object.assign(exports, { require }) as {\n default: Component;\n services?: { [key: string]: unknown };\n require: unknown;\n };\n}\n"],"names":["evalSnippet","compiled","extraModules","exports","require","moduleName","preConfigured","modules","window","eval","Object","assign"],"mappings":";;AAAA;AAMO,SAASA,WAAWA,CACzBC,QAAgB,EAChBC,YAA0B,GAAG,EAAE,EAI/B;EACA,MAAMC,OAAO,GAAG,EAAE,CAAA;EAElB,SAASC,OAAOA,CAACC,UAAgC,EAAW;IAC1D,IAAIC,aAAa,GAAGC,OAAO,CAACF,UAAU,CAAC,IAAIH,YAAY,CAACG,UAAU,CAAC,CAAA;;AAEnE;AACA;AACA,IAAA,OAAOC,aAAa,IAAIE,MAAM,CAACJ,OAAO,CAACC,UAAU,CAAC,CAAA;AACpD,GAAA;;AAEA;EACAI,IAAI,CAACR,QAAQ,CAAC,CAAA;AAEd,EAAA,OAAOS,MAAM,CAACC,MAAM,CAACR,OAAO,EAAE;AAAEC,IAAAA,OAAAA;AAAQ,GAAC,CAAC,CAAA;AAK5C;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/browser/cjs/index.ts"],"sourcesContent":["import { preprocess, transform } from '../gjs';\nimport { nameFor } from '../utils';\nimport { evalSnippet } from './eval';\n\nimport type { CompileResult, ExtraModules } from '../types';\nimport type { ComponentLike } from '@glint/template';\n\nexport interface Info {\n code: string;\n name: string;\n}\n\nexport async function compileJS(code: string, extraModules?: ExtraModules): Promise<CompileResult> {\n let name = nameFor(code);\n let component: undefined | ComponentLike;\n let error: undefined | Error;\n\n try {\n let compiled = await compileGJS({ code: code, name });\n\n if (!compiled) {\n throw new Error(`Compiled output is missing`);\n }\n\n component = evalSnippet(compiled, extraModules).default as unknown as ComponentLike;\n } catch (e) {\n error = e as Error | undefined;\n }\n\n return { name, component, error };\n}\n\nasync function compileGJS({ code: input, name }: Info) {\n let preprocessed = preprocess(input, name);\n let result = await transform(preprocessed, name);\n\n if (!result) {\n return;\n }\n\n let { code } = result;\n\n return code;\n}\n"],"names":["compileJS","code","extraModules","name","nameFor","component","error","compiled","compileGJS","Error","evalSnippet","default","e","input","preprocessed","preprocess","result","transform"],"mappings":";;;;AAYO,eAAeA,SAASA,CAACC,IAAY,EAAEC,YAA2B,EAA0B;AACjG,EAAA,IAAIC,IAAI,GAAGC,OAAO,CAACH,IAAI,CAAC,CAAA;AACxB,EAAA,IAAII,SAAoC,CAAA;AACxC,EAAA,IAAIC,KAAwB,CAAA;EAE5B,IAAI;AACF,IAAA,IAAIC,QAAQ,GAAG,MAAMC,UAAU,CAAC;AAAEP,MAAAA,IAAI,EAAEA,IAAI;AAAEE,MAAAA,IAAAA;AAAK,KAAC,CAAC,CAAA;IAErD,IAAI,CAACI,QAAQ,EAAE;AACb,MAAA,MAAM,IAAIE,KAAK,CAAE,CAAA,0BAAA,CAA2B,CAAC,CAAA;AAC/C,KAAA;IAEAJ,SAAS,GAAGK,WAAW,CAACH,QAAQ,EAAEL,YAAY,CAAC,CAACS,OAAmC,CAAA;GACpF,CAAC,OAAOC,CAAC,EAAE;AACVN,IAAAA,KAAK,GAAGM,CAAsB,CAAA;AAChC,GAAA;EAEA,OAAO;IAAET,IAAI;IAAEE,SAAS;AAAEC,IAAAA,KAAAA;GAAO,CAAA;AACnC,CAAA;AAEA,eAAeE,UAAUA,CAAC;AAAEP,EAAAA,IAAI,EAAEY,KAAK;AAAEV,EAAAA,IAAAA;AAAW,CAAC,EAAE;AACrD,EAAA,IAAIW,YAAY,GAAGC,UAAU,CAACF,KAAK,EAAEV,IAAI,CAAC,CAAA;EAC1C,IAAIa,MAAM,GAAG,MAAMC,SAAS,CAACH,YAAY,EAAEX,IAAI,CAAC,CAAA;EAEhD,IAAI,CAACa,MAAM,EAAE;AACX,IAAA,OAAA;AACF,GAAA;EAEA,IAAI;AAAEf,IAAAA,IAAAA;AAAK,GAAC,GAAGe,MAAM,CAAA;AAErB,EAAA,OAAOf,IAAI,CAAA;AACb;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/browser/cjs/index.ts"],"sourcesContent":["import { preprocess, transform } from '../gjs.ts';\nimport { nameFor } from '../utils.ts';\nimport { evalSnippet } from './eval.ts';\n\nimport type { CompileResult, ExtraModules } from '../types.ts';\nimport type { ComponentLike } from '@glint/template';\n\nexport interface Info {\n code: string;\n name: string;\n}\n\nexport async function compileJS(code: string, extraModules?: ExtraModules): Promise<CompileResult> {\n let name = nameFor(code);\n let component: undefined | ComponentLike;\n let error: undefined | Error;\n\n try {\n let compiled = await compileGJS({ code: code, name });\n\n if (!compiled) {\n throw new Error(`Compiled output is missing`);\n }\n\n component = evalSnippet(compiled, extraModules).default as unknown as ComponentLike;\n } catch (e) {\n error = e as Error | undefined;\n }\n\n return { name, component, error };\n}\n\nasync function compileGJS({ code: input, name }: Info) {\n let preprocessed = preprocess(input, name);\n let result = await transform(preprocessed, name);\n\n if (!result) {\n return;\n }\n\n let { code } = result;\n\n return code;\n}\n"],"names":["compileJS","code","extraModules","name","nameFor","component","error","compiled","compileGJS","Error","evalSnippet","default","e","input","preprocessed","preprocess","result","transform"],"mappings":";;;;AAYO,eAAeA,SAASA,CAACC,IAAY,EAAEC,YAA2B,EAA0B;AACjG,EAAA,IAAIC,IAAI,GAAGC,OAAO,CAACH,IAAI,CAAC,CAAA;AACxB,EAAA,IAAII,SAAoC,CAAA;AACxC,EAAA,IAAIC,KAAwB,CAAA;EAE5B,IAAI;AACF,IAAA,IAAIC,QAAQ,GAAG,MAAMC,UAAU,CAAC;AAAEP,MAAAA,IAAI,EAAEA,IAAI;AAAEE,MAAAA,IAAAA;AAAK,KAAC,CAAC,CAAA;IAErD,IAAI,CAACI,QAAQ,EAAE;AACb,MAAA,MAAM,IAAIE,KAAK,CAAE,CAAA,0BAAA,CAA2B,CAAC,CAAA;AAC/C,KAAA;IAEAJ,SAAS,GAAGK,WAAW,CAACH,QAAQ,EAAEL,YAAY,CAAC,CAACS,OAAmC,CAAA;GACpF,CAAC,OAAOC,CAAC,EAAE;AACVN,IAAAA,KAAK,GAAGM,CAAsB,CAAA;AAChC,GAAA;EAEA,OAAO;IAAET,IAAI;IAAEE,SAAS;AAAEC,IAAAA,KAAAA;GAAO,CAAA;AACnC,CAAA;AAEA,eAAeE,UAAUA,CAAC;AAAEP,EAAAA,IAAI,EAAEY,KAAK;AAAEV,EAAAA,IAAAA;AAAW,CAAC,EAAE;AACrD,EAAA,IAAIW,YAAY,GAAGC,UAAU,CAACF,KAAK,EAAEV,IAAI,CAAC,CAAA;EAC1C,IAAIa,MAAM,GAAG,MAAMC,SAAS,CAACH,YAAY,EAAEX,IAAI,CAAC,CAAA;EAEhD,IAAI,CAACa,MAAM,EAAE;AACX,IAAA,OAAA;AACF,GAAA;EAEA,IAAI;AAAEf,IAAAA,IAAAA;AAAK,GAAC,GAAGe,MAAM,CAAA;AAErB,EAAA,OAAOf,IAAI,CAAA;AACb;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formats.js","sources":["../../../src/browser/compile/formats.ts"],"sourcesContent":["import { invocationName } from '../utils';\n\nimport type { CompileResult } from '../types';\nimport type { ExtractedCode } from './markdown-to-ember';\nimport type { EvalImportMap, ScopeMap } from './types';\n\nasync function compileAll(js: { code: string }[], importMap?: EvalImportMap) {\n let modules = await Promise.all(\n js.map(async ({ code }) => {\n return await compileGJS(code, importMap);\n })\n );\n\n return modules;\n}\n\nexport async function compileGJS(\n gjsInput: string,\n importMap?: EvalImportMap\n): Promise<CompileResult> {\n try {\n let { compileJS } = await import('../js');\n\n return await compileJS(gjsInput, importMap);\n } catch (error) {\n return { error: error as Error, name: 'unknown' };\n }\n}\n\nexport async function compileHBS(\n hbsInput: string,\n options?: {\n moduleName?: string;\n scope?: Record<string, unknown>;\n }\n): Promise<CompileResult> {\n try {\n let { compileHBS } = await import('../hbs');\n\n return compileHBS(hbsInput, options);\n } catch (error) {\n return { error: error as Error, name: 'unknown' };\n }\n}\n\nasync function extractScope(\n liveCode: ExtractedCode[],\n importMap?: EvalImportMap\n): Promise<CompileResult[]> {\n let scope: CompileResult[] = [];\n\n let hbs = liveCode.filter((code) => code.lang === 'hbs');\n let js = liveCode.filter((code) => ['js', 'gjs'].includes(code.lang));\n\n if (js.length > 0) {\n let compiled = await compileAll(js, importMap);\n\n await Promise.all(\n compiled.map(async (info) => {\n // using web worker + import maps is not available yet (need firefox support)\n // (and to somehow be able to point at npm)\n //\n // if ('importPath' in info) {\n // return scope.push({\n // moduleName: name,\n // component: await import(/* webpackIgnore: true */ info.importPath),\n // });\n // }\n\n return scope.push(info);\n })\n );\n }\n\n for (let { code } of hbs) {\n let compiled = await compileHBS(code);\n\n scope.push(compiled);\n }\n\n return scope;\n}\n\nexport async function compileMD(\n glimdownInput: string,\n options?: {\n importMap?: EvalImportMap;\n topLevelScope?: ScopeMap;\n CopyComponent?: string;\n ShadowComponent?: string;\n }\n): Promise<CompileResult & { rootTemplate?: string }> {\n let importMap = options?.importMap;\n let topLevelScope = options?.topLevelScope ?? {};\n let rootTemplate: string;\n let liveCode: ExtractedCode[];\n let scope: CompileResult[] = [];\n\n /**\n * Step 1: Convert Markdown To HTML (Ember).\n *\n * The remark plugin, remark-code-extra also extracts\n * and transforms the code blocks we care about.\n *\n * These blocks will be compiled through babel and eval'd so the\n * compiled rootTemplate can invoke them\n */\n try {\n let { parseMarkdown } = await import('./markdown-to-ember');\n let { templateOnlyGlimdown, blocks } = await parseMarkdown(glimdownInput, {\n CopyComponent: options?.CopyComponent,\n ShadowComponent: options?.ShadowComponent,\n });\n\n rootTemplate = templateOnlyGlimdown;\n liveCode = blocks;\n } catch (error) {\n return { error: error as Error, name: 'unknown' };\n }\n\n /**\n * Step 2: Compile the live code samples\n */\n if (liveCode.length > 0) {\n try {\n scope = await extractScope(liveCode, importMap);\n } catch (error) {\n console.info({ scope });\n console.error(error);\n\n return { error: error as Error, rootTemplate, name: 'unknown' };\n }\n }\n\n /**\n * Make sure non of our snippets errored\n *\n * TODO: for these errors, report them differently so that we\n * can render the 'Ember' and still highlight the correct line?\n * or maybe there is a way to highlight in the editor instead?\n */\n for (let { error, component } of scope) {\n if (!component) {\n if (error) {\n return { error, rootTemplate, name: 'unknown' };\n }\n }\n }\n\n /**\n * Step 4: Compile the Ember Template\n */\n try {\n let localScope = scope.reduce((accum, { component, name }) => {\n
|
|
1
|
+
{"version":3,"file":"formats.js","sources":["../../../src/browser/compile/formats.ts"],"sourcesContent":["import { invocationName } from '../utils.ts';\n\nimport type { CompileResult } from '../types.ts';\nimport type { ExtractedCode } from './markdown-to-ember.ts';\nimport type { EvalImportMap, ScopeMap } from './types.ts';\n\nasync function compileAll(js: { code: string }[], importMap?: EvalImportMap) {\n let modules = await Promise.all(\n js.map(async ({ code }) => {\n return await compileGJS(code, importMap);\n })\n );\n\n return modules;\n}\n\nexport async function compileGJS(\n gjsInput: string,\n importMap?: EvalImportMap\n): Promise<CompileResult> {\n try {\n let { compileJS } = await import('../js.ts');\n\n return await compileJS(gjsInput, importMap);\n } catch (error) {\n return { error: error as Error, name: 'unknown' };\n }\n}\n\nexport async function compileHBS(\n hbsInput: string,\n options?: {\n moduleName?: string;\n scope?: Record<string, unknown>;\n }\n): Promise<CompileResult> {\n try {\n let { compileHBS } = await import('../hbs.ts');\n\n return compileHBS(hbsInput, options);\n } catch (error) {\n return { error: error as Error, name: 'unknown' };\n }\n}\n\nasync function extractScope(\n liveCode: ExtractedCode[],\n importMap?: EvalImportMap\n): Promise<CompileResult[]> {\n let scope: CompileResult[] = [];\n\n let hbs = liveCode.filter((code) => code.lang === 'hbs');\n let js = liveCode.filter((code) => ['js', 'gjs'].includes(code.lang));\n\n if (js.length > 0) {\n let compiled = await compileAll(js, importMap);\n\n await Promise.all(\n compiled.map(async (info) => {\n // using web worker + import maps is not available yet (need firefox support)\n // (and to somehow be able to point at npm)\n //\n // if ('importPath' in info) {\n // return scope.push({\n // moduleName: name,\n // component: await import(/* webpackIgnore: true */ info.importPath),\n // });\n // }\n\n return scope.push(info);\n })\n );\n }\n\n for (let { code } of hbs) {\n let compiled = await compileHBS(code);\n\n scope.push(compiled);\n }\n\n return scope;\n}\n\nexport async function compileMD(\n glimdownInput: string,\n options?: {\n importMap?: EvalImportMap;\n topLevelScope?: ScopeMap;\n CopyComponent?: string;\n ShadowComponent?: string;\n }\n): Promise<CompileResult & { rootTemplate?: string }> {\n let importMap = options?.importMap;\n let topLevelScope = options?.topLevelScope ?? {};\n let rootTemplate: string;\n let liveCode: ExtractedCode[];\n let scope: CompileResult[] = [];\n\n /**\n * Step 1: Convert Markdown To HTML (Ember).\n *\n * The remark plugin, remark-code-extra also extracts\n * and transforms the code blocks we care about.\n *\n * These blocks will be compiled through babel and eval'd so the\n * compiled rootTemplate can invoke them\n */\n try {\n let { parseMarkdown } = await import('./markdown-to-ember.ts');\n let { templateOnlyGlimdown, blocks } = await parseMarkdown(glimdownInput, {\n CopyComponent: options?.CopyComponent,\n ShadowComponent: options?.ShadowComponent,\n });\n\n rootTemplate = templateOnlyGlimdown;\n liveCode = blocks;\n } catch (error) {\n return { error: error as Error, name: 'unknown' };\n }\n\n /**\n * Step 2: Compile the live code samples\n */\n if (liveCode.length > 0) {\n try {\n scope = await extractScope(liveCode, importMap);\n } catch (error) {\n console.info({ scope });\n console.error(error);\n\n return { error: error as Error, rootTemplate, name: 'unknown' };\n }\n }\n\n /**\n * Make sure non of our snippets errored\n *\n * TODO: for these errors, report them differently so that we\n * can render the 'Ember' and still highlight the correct line?\n * or maybe there is a way to highlight in the editor instead?\n */\n for (let { error, component } of scope) {\n if (!component) {\n if (error) {\n return { error, rootTemplate, name: 'unknown' };\n }\n }\n }\n\n /**\n * Step 4: Compile the Ember Template\n */\n try {\n let localScope = scope.reduce(\n (accum, { component, name }) => {\n accum[invocationName(name)] = component;\n\n return accum;\n },\n {} as Record<string, unknown>\n );\n\n return await compileHBS(rootTemplate, {\n moduleName: 'DynamicRootTemplate',\n scope: {\n ...topLevelScope,\n ...localScope,\n },\n });\n } catch (error) {\n return { error: error as Error, rootTemplate, name: 'unknown' };\n }\n}\n"],"names":["compileAll","js","importMap","modules","Promise","all","map","code","compileGJS","gjsInput","compileJS","error","name","compileHBS","hbsInput","options","extractScope","liveCode","scope","hbs","filter","lang","includes","length","compiled","info","push","compileMD","glimdownInput","topLevelScope","rootTemplate","parseMarkdown","templateOnlyGlimdown","blocks","CopyComponent","ShadowComponent","console","component","localScope","reduce","accum","invocationName","moduleName"],"mappings":";;AAMA,eAAeA,UAAUA,CAACC,EAAsB,EAAEC,SAAyB,EAAE;EAC3E,IAAIC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EzB,MAAAA,IAAAA;AAAK,KAAC,KAAK;AAC9B4B,MAAAA,KAAK,CAACC,cAAc,CAAC7B,IAAI,CAAC,CAAC,GAAGyB,SAAS,CAAA;AAEvC,MAAA,OAAOG,KAAK,CAAA;KACb,EACD,EACF,CAAC,CAAA;AAED,IAAA,OAAO,MAAM3B,UAAU,CAACiB,YAAY,EAAE;AACpCY,MAAAA,UAAU,EAAE,qBAAqB;AACjCxB,MAAAA,KAAK,EAAE;AACL,QAAA,GAAGW,aAAa;QAChB,GAAGS,UAAAA;AACL,OAAA;AACF,KAAC,CAAC,CAAA;GACH,CAAC,OAAO3B,KAAK,EAAE;IACd,OAAO;AAAEA,MAAAA,KAAK,EAAEA,KAAc;MAAEmB,YAAY;AAAElB,MAAAA,IAAI,EAAE,SAAA;KAAW,CAAA;AACjE,GAAA;AACF;;;;"}
|
|
@@ -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';\nimport {\n compileGJS as processGJS,\n compileHBS as processHBS,\n compileMD as processMD,\n} from './formats';\n\nimport type { CompileResult } from '../types';\nimport type { EvalImportMap, ScopeMap } from './types';\nimport type { ComponentLike } from '@glint/template';\ntype Format = 'glimdown' | 'gjs' | 'hbs';\n\nexport const CACHE = new Map<string, ComponentLike>();\n\nconst SUPPORTED_FORMATS = ['glimdown', 'gjs', 'hbs'];\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 {\n format,\n onSuccess,\n onError,\n onCompileStart,\n ...options\n }: {\n format: Format;\n onSuccess: (component: ComponentLike) => Promise<unknown> | unknown;\n onError: (error: string) => Promise<unknown> | unknown;\n onCompileStart: () => Promise<unknown> | unknown;\n importMap?: EvalImportMap;\n CopyComponent?: string;\n ShadowComponent?: string;\n topLevelScope?: ScopeMap;\n }\n) {\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(format)) {\n await onError(`Unsupported format: ${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 (format === 'glimdown') {\n result = await processMD(text, options);\n } else if (format === 'gjs') {\n result = await processGJS(text, options.importMap);\n } else if (format === 'hbs') {\n result = await processHBS(text, {\n scope: options.topLevelScope,\n });\n } else {\n await onError(`Unsupported format: ${format}. Supported formats: ${SUPPORTED_FORMATS}`);\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 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:
|
|
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 { 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\nconst SUPPORTED_FORMATS = ['glimdown', 'gjs', 'hbs'];\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 {\n format,\n onSuccess,\n onError,\n onCompileStart,\n ...options\n }: {\n format: Format;\n onSuccess: (component: ComponentLike) => Promise<unknown> | unknown;\n onError: (error: string) => Promise<unknown> | unknown;\n onCompileStart: () => Promise<unknown> | unknown;\n importMap?: EvalImportMap;\n CopyComponent?: string;\n ShadowComponent?: string;\n topLevelScope?: ScopeMap;\n }\n) {\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(format)) {\n await onError(`Unsupported format: ${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 (format === 'glimdown') {\n result = await processMD(text, options);\n } else if (format === 'gjs') {\n result = await processGJS(text, options.importMap);\n } else if (format === 'hbs') {\n result = await processHBS(text, {\n scope: options.topLevelScope,\n });\n } else {\n await onError(`Unsupported format: ${format}. Supported formats: ${SUPPORTED_FORMATS}`);\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 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 buildCompiler(markdownText: Input | (() => Input)): Value;\nexport function buildCompiler(markdownText: Input | (() => Input), options?: Format): Value;\nexport function buildCompiler(markdownText: Input | (() => Input), options?: () => Format): Value;\nexport function buildCompiler(markdownText: Input | (() => Input), options?: ExtraOptions): Value;\nexport function buildCompiler(\n markdownText: Input | (() => Input),\n options?: () => ExtraOptions\n): Value;\n\nexport function buildCompiler(\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 format,\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\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 const Compiled = resourceFactory(buildCompiler) as typeof buildCompiler;\n"],"names":["CACHE","Map","SUPPORTED_FORMATS","compile","text","format","onSuccess","onError","onCompileStart","options","id","nameFor","existing","get","includes","result","processMD","processGJS","importMap","processHBS","scope","topLevelScope","error","message","set","component","buildCompiler","markdownText","maybeOptions","resource","maybeObject","input","ready","cell","current","e","isReady","Compiled","resourceFactory"],"mappings":";;;;MAcaA,KAAK,GAAG,IAAIC,GAAG,GAAyB;AAErD,MAAMC,iBAAiB,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;;AAEpD;AACA;AACA;AACA;AACO,eAAeC,OAAOA,CAC3BC,IAAY,EACZ;EACEC,MAAM;EACNC,SAAS;EACTC,OAAO;EACPC,cAAc;EACd,GAAGC,OAAAA;AAUL,CAAC,EACD;AACA,EAAA,IAAIC,EAAE,GAA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,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,GAAGf,OAAAA;AACL,OAAC,CAAC,CAAA;AACJ,KAAA;AAEA,IAAA,OAAO,OAAO;MACZ2B,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;;AAEA;AACA;AACA;AACA;MACaG,QAAQ,GAAGC,eAAe,CAACZ,aAAa;;;;"}
|
|
@@ -95,8 +95,8 @@ function liveCodeExtraction(options = {}) {
|
|
|
95
95
|
const seen = new Set();
|
|
96
96
|
return function transformer(tree, file) {
|
|
97
97
|
visit(tree, ['code'], function (node, index, parent) {
|
|
98
|
-
if (parent === null) return;
|
|
99
|
-
if (index === null) return;
|
|
98
|
+
if (parent === null || parent === undefined) return;
|
|
99
|
+
if (index === null || index === undefined) return;
|
|
100
100
|
if (!isRelevantCode(node)) {
|
|
101
101
|
let enhanced = enhance(node);
|
|
102
102
|
parent.children[index] = enhanced;
|