ember-repl 6.0.0 → 7.0.1
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/LICENSE.md +1 -1
- package/README.md +2 -404
- package/config/.try.mjs +87 -0
- package/config/addon-main.cjs +7 -0
- package/config/attw.json +7 -0
- package/config/babel.publish.config.cjs +29 -0
- package/config/ember-cli-update.json +21 -0
- package/config/rollup.config.mjs +44 -0
- package/config/testem.cjs +35 -0
- package/config/tsconfig.publish.json +15 -0
- package/config/vite.config.mjs +36 -0
- package/declarations/compile/Compiled.d.ts +7 -0
- package/declarations/compile/Compiled.d.ts.map +1 -0
- package/declarations/compile/compile.d.ts +17 -0
- package/declarations/compile/compile.d.ts.map +1 -0
- package/declarations/compile/state.d.ts +43 -0
- package/declarations/compile/state.d.ts.map +1 -0
- package/declarations/compile/types.d.ts +5 -12
- package/declarations/compile/types.d.ts.map +1 -1
- package/declarations/index.d.ts +6 -2
- package/declarations/index.d.ts.map +1 -1
- package/declarations/services/compiler.d.ts +94 -0
- package/declarations/services/compiler.d.ts.map +1 -0
- package/declarations/services/known-modules.d.ts +7 -0
- package/declarations/services/known-modules.d.ts.map +1 -0
- package/declarations/setup.d.ts +7 -0
- package/declarations/setup.d.ts.map +1 -0
- package/declarations/test-support.d.ts +20 -0
- package/declarations/test-support.d.ts.map +1 -0
- package/dist/_commonjsHelpers-BAGoDD49.js +37 -0
- package/dist/_commonjsHelpers-BAGoDD49.js.map +1 -0
- package/dist/babel-8wMrbxkT.js +110427 -0
- package/dist/babel-8wMrbxkT.js.map +1 -0
- package/dist/blank-line-Bzg2Qt4K.js +482 -0
- package/dist/blank-line-Bzg2Qt4K.js.map +1 -0
- package/dist/compile/Compiled.js +26 -0
- package/dist/compile/Compiled.js.map +1 -0
- package/dist/compile/compile.js +62 -0
- package/dist/compile/compile.js.map +1 -0
- package/dist/compile/state.js +75 -0
- package/dist/compile/state.js.map +1 -0
- package/dist/compile/utils.js +213 -2
- package/dist/compile/utils.js.map +1 -1
- package/dist/default-CoqAuVeH.js +4 -0
- package/dist/default-CoqAuVeH.js.map +1 -0
- package/dist/index-BTx1k6gT.js +323 -0
- package/dist/index-BTx1k6gT.js.map +1 -0
- package/dist/index-Bxzjtr16.js +87 -0
- package/dist/index-Bxzjtr16.js.map +1 -0
- package/dist/index-C371bO_b.js +1553 -0
- package/dist/index-C371bO_b.js.map +1 -0
- package/dist/index-C4AyeeIa.js +5721 -0
- package/dist/index-C4AyeeIa.js.map +1 -0
- package/dist/index-C8S2G0FH.js +1953 -0
- package/dist/index-C8S2G0FH.js.map +1 -0
- package/dist/index-CCcIVEUK.js +409 -0
- package/dist/index-CCcIVEUK.js.map +1 -0
- package/dist/index-CDSIcg03.js +9070 -0
- package/dist/index-CDSIcg03.js.map +1 -0
- package/dist/index-D8szzCn3.js +2 -0
- package/dist/index-D8szzCn3.js.map +1 -0
- package/dist/index-DBBNT106.js +2644 -0
- package/dist/index-DBBNT106.js.map +1 -0
- package/dist/index-DP_Su7Zc.js +362 -0
- package/dist/index-DP_Su7Zc.js.map +1 -0
- package/dist/index-DejgrVqh.js +11299 -0
- package/dist/index-DejgrVqh.js.map +1 -0
- package/dist/index-Dr5iYoKt.js +1551 -0
- package/dist/index-Dr5iYoKt.js.map +1 -0
- package/dist/index-DxolpiGq.js +3336 -0
- package/dist/index-DxolpiGq.js.map +1 -0
- package/dist/index-ZyJlPFQY.js +249 -0
- package/dist/index-ZyJlPFQY.js.map +1 -0
- package/dist/index-k6CfLgeq.js +26 -0
- package/dist/index-k6CfLgeq.js.map +1 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/services/compiler.js +329 -0
- package/dist/services/compiler.js.map +1 -0
- package/dist/services/known-modules.js +123 -0
- package/dist/services/known-modules.js.map +1 -0
- package/dist/setup.js +15 -0
- package/dist/setup.js.map +1 -0
- package/dist/test-support.js +33 -0
- package/dist/test-support.js.map +1 -0
- package/package.json +117 -138
- package/src/compile/Compiled.ts +45 -0
- package/src/compile/compile.ts +89 -0
- package/src/compile/state.ts +88 -0
- package/src/compile/types.ts +14 -13
- package/src/index.ts +6 -2
- package/src/services/compiler.ts +401 -0
- package/src/services/known-modules.ts +130 -0
- package/src/setup.ts +26 -0
- package/src/test-support.ts +64 -0
- package/addon-main.cjs +0 -5
- package/declarations/__PRIVATE__.d.ts +0 -2
- package/declarations/__PRIVATE__.d.ts.map +0 -1
- package/declarations/compile/formats/gjs/babel.d.ts +0 -7
- package/declarations/compile/formats/gjs/babel.d.ts.map +0 -1
- package/declarations/compile/formats/gjs/eval.d.ts +0 -8
- package/declarations/compile/formats/gjs/eval.d.ts.map +0 -1
- package/declarations/compile/formats/gjs/index.d.ts +0 -24
- package/declarations/compile/formats/gjs/index.d.ts.map +0 -1
- package/declarations/compile/formats/gjs/known-modules.d.ts +0 -48
- package/declarations/compile/formats/gjs/known-modules.d.ts.map +0 -1
- package/declarations/compile/formats/hbs.d.ts +0 -17
- package/declarations/compile/formats/hbs.d.ts.map +0 -1
- package/declarations/compile/formats/markdown.d.ts +0 -22
- package/declarations/compile/formats/markdown.d.ts.map +0 -1
- package/declarations/compile/formats.d.ts +0 -17
- package/declarations/compile/formats.d.ts.map +0 -1
- package/declarations/compile/index.d.ts +0 -80
- package/declarations/compile/index.d.ts.map +0 -1
- package/declarations/test-support/index.d.ts +0 -2
- package/declarations/test-support/index.d.ts.map +0 -1
- package/dist/__PRIVATE__.js +0 -2
- package/dist/__PRIVATE__.js.map +0 -1
- package/dist/compile/formats/gjs/babel.js +0 -2
- package/dist/compile/formats/gjs/babel.js.map +0 -1
- package/dist/compile/formats/gjs/eval.js +0 -19
- package/dist/compile/formats/gjs/eval.js.map +0 -1
- package/dist/compile/formats/gjs/index.js +0 -122
- package/dist/compile/formats/gjs/index.js.map +0 -1
- package/dist/compile/formats/gjs/known-modules.js +0 -52
- package/dist/compile/formats/gjs/known-modules.js.map +0 -1
- package/dist/compile/formats/hbs.js +0 -93
- package/dist/compile/formats/hbs.js.map +0 -1
- package/dist/compile/formats/markdown.js +0 -266
- package/dist/compile/formats/markdown.js.map +0 -1
- package/dist/compile/formats.js +0 -173
- package/dist/compile/formats.js.map +0 -1
- package/dist/compile/index.js +0 -113
- package/dist/compile/index.js.map +0 -1
- package/dist/test-support/index.js +0 -8
- package/dist/test-support/index.js.map +0 -1
- package/src/__PRIVATE__.ts +0 -1
- package/src/compile/formats/gjs/babel.ts +0 -7
- package/src/compile/formats/gjs/eval.ts +0 -29
- package/src/compile/formats/gjs/index.ts +0 -153
- package/src/compile/formats/gjs/known-modules.ts +0 -49
- package/src/compile/formats/hbs.ts +0 -100
- package/src/compile/formats/markdown.ts +0 -345
- package/src/compile/formats.ts +0 -178
- package/src/compile/index.ts +0 -219
- package/src/test-support/index.ts +0 -5
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ember, extensions } from "@embroider/vite";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
|
|
4
|
+
import { babel } from "@rollup/plugin-babel";
|
|
5
|
+
import { defineConfig } from "vite";
|
|
6
|
+
import mkcert from "vite-plugin-mkcert";
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
build: {
|
|
10
|
+
target: ["esnext"],
|
|
11
|
+
},
|
|
12
|
+
resolve: {
|
|
13
|
+
alias: [
|
|
14
|
+
{
|
|
15
|
+
find: "ember-repl",
|
|
16
|
+
replacement: join(import.meta.dirname, `../src`),
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
optimizeDeps: {
|
|
21
|
+
// a wasm-providing dependency
|
|
22
|
+
exclude: ["content-tag"],
|
|
23
|
+
// for top-level-await, etc
|
|
24
|
+
esbuildOptions: {
|
|
25
|
+
target: "esnext",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
plugins: [
|
|
29
|
+
mkcert(),
|
|
30
|
+
ember(),
|
|
31
|
+
babel({
|
|
32
|
+
babelHelpers: "inline",
|
|
33
|
+
extensions,
|
|
34
|
+
}),
|
|
35
|
+
],
|
|
36
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CompileState } from './state.ts';
|
|
2
|
+
import type { Format, Input } from './types.ts';
|
|
3
|
+
export declare function Compiled(markdownText: Input | (() => Input)): CompileState;
|
|
4
|
+
export declare function Compiled(markdownText: Input | (() => Input), format?: Format, flavor?: string): CompileState;
|
|
5
|
+
export declare function Compiled(markdownText: Input | (() => Input), format: () => Format): CompileState;
|
|
6
|
+
export declare function Compiled(markdownText: Input | (() => Input), format: () => Format, flavor: () => string): CompileState;
|
|
7
|
+
//# sourceMappingURL=Compiled.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Compiled.d.ts","sourceRoot":"","sources":["../../src/compile/Compiled.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEhD,wBAAgB,QAAQ,CAAC,YAAY,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,GAAG,YAAY,CAAC;AAC5E,wBAAgB,QAAQ,CACtB,YAAY,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,EACnC,MAAM,CAAC,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,GACd,YAAY,CAAC;AAChB,wBAAgB,QAAQ,CAAC,YAAY,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,MAAM,GAAG,YAAY,CAAC;AAClG,wBAAgB,QAAQ,CACtB,YAAY,EAAE,KAAK,GAAG,CAAC,MAAM,KAAK,CAAC,EACnC,MAAM,EAAE,MAAM,MAAM,EACpB,MAAM,EAAE,MAAM,MAAM,GACnB,YAAY,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CompileState } from './state.ts';
|
|
2
|
+
import type CompilerService from '../services/compiler.ts';
|
|
3
|
+
import type { Format, Input } from './types.ts';
|
|
4
|
+
import type { ComponentLike } from '@glint/template';
|
|
5
|
+
export declare const CACHE: Map<string, ComponentLike>;
|
|
6
|
+
interface Options {
|
|
7
|
+
format: Format;
|
|
8
|
+
flavor?: string;
|
|
9
|
+
remarkPlugins?: unknown[];
|
|
10
|
+
rehypePlugins?: unknown[];
|
|
11
|
+
onSuccess?: (component: ComponentLike) => Promise<unknown> | unknown;
|
|
12
|
+
onError?: (error: string) => Promise<unknown> | unknown;
|
|
13
|
+
onCompileStart?: () => Promise<unknown> | unknown;
|
|
14
|
+
}
|
|
15
|
+
export declare function compile(service: CompilerService, text: Input, options: Options): CompileState;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/compile/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqC,MAAM,YAAY,CAAC;AAG7E,OAAO,KAAK,eAAe,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAiB,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,eAAO,MAAM,KAAK,4BAAmC,CAAC;AAEtD,UAAU,OAAO;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC;IAC1B,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACrE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACxD,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;CACnD;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY,CAe7F"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ComponentLike } from '@glint/template';
|
|
2
|
+
export declare const RESOLVE: unique symbol;
|
|
3
|
+
export declare const REJECT: unique symbol;
|
|
4
|
+
interface State {
|
|
5
|
+
component: ComponentLike | undefined;
|
|
6
|
+
error: Error | undefined;
|
|
7
|
+
isReady: boolean;
|
|
8
|
+
reason: string | undefined;
|
|
9
|
+
promise: Promise<ComponentLike>;
|
|
10
|
+
format: string;
|
|
11
|
+
}
|
|
12
|
+
interface Data {
|
|
13
|
+
format: string;
|
|
14
|
+
flavor?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class CompileState implements State {
|
|
17
|
+
#private;
|
|
18
|
+
component: undefined | ComponentLike;
|
|
19
|
+
error: undefined | Error;
|
|
20
|
+
isReady: boolean;
|
|
21
|
+
constructor(data: Data);
|
|
22
|
+
get format(): string;
|
|
23
|
+
get reason(): string | undefined;
|
|
24
|
+
get isWaiting(): boolean;
|
|
25
|
+
get promise(): Promise<ComponentLike>;
|
|
26
|
+
/**
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
[RESOLVE](component: ComponentLike): void;
|
|
30
|
+
/**
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
[REJECT](error: Error): void;
|
|
34
|
+
}
|
|
35
|
+
export declare class MissingTextState extends CompileState {
|
|
36
|
+
}
|
|
37
|
+
export declare class CachedCompileState extends CompileState {
|
|
38
|
+
#private;
|
|
39
|
+
constructor(data: Data, component: ComponentLike);
|
|
40
|
+
get promise(): Promise<ComponentLike>;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/compile/state.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,eAAO,MAAM,OAAO,eAAkC,CAAC;AACvD,eAAO,MAAM,MAAM,eAAiC,CAAC;AAErD,UAAU,KAAK;IACb,SAAS,EAAE,aAAa,GAAG,SAAS,CAAC;IACrC,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,IAAI;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,YAAa,YAAW,KAAK;;IAC/B,SAAS,EAAE,SAAS,GAAG,aAAa,CAAC;IACrC,KAAK,EAAE,SAAS,GAAG,KAAK,CAAC;IAEzB,OAAO,UAAS;gBAUb,IAAI,EAAE,IAAI;IAItB,IAAI,MAAM,WAET;IAED,IAAI,MAAM,uBAET;IAED,IAAI,SAAS,YAEZ;IAED,IAAI,OAAO,2BAEV;IAED;;OAEG;IACH,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,aAAa;IAKlC;;OAEG;IACH,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK;CAItB;AAED,qBAAa,gBAAiB,SAAQ,YAAY;CAAG;AAErD,qBAAa,kBAAmB,SAAQ,YAAY;;gBAEtC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa;IAQhD,IAAI,OAAO,2BAEV;CACF"}
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
import type { ComponentLike } from '@glint/template';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
[moduleName: string]: ScopeMap;
|
|
5
|
-
}
|
|
2
|
+
export type Input = string | undefined | null;
|
|
3
|
+
export type Format = 'glimdown' | 'jsx' | 'md' | 'vue' | 'svelte' | 'gjs' | 'hbs' | 'mermaid' | 'react';
|
|
6
4
|
export interface ScopeMap {
|
|
7
5
|
[localName: string]: unknown;
|
|
8
6
|
}
|
|
9
|
-
export
|
|
7
|
+
export interface ModuleMap {
|
|
8
|
+
[key: string]: () => Promise<unknown> | Record<string, unknown>;
|
|
9
|
+
}
|
|
10
10
|
export interface CompileResult {
|
|
11
11
|
component?: ComponentLike;
|
|
12
12
|
error?: Error;
|
|
13
13
|
name: string;
|
|
14
14
|
}
|
|
15
|
-
export type Options = {
|
|
16
|
-
/**
|
|
17
|
-
* @internal
|
|
18
|
-
* @deprecated do not use - not under semver
|
|
19
|
-
*/
|
|
20
|
-
skypack?: boolean;
|
|
21
|
-
};
|
|
22
15
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/compile/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/compile/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;AAC9C,MAAM,MAAM,MAAM,GACd,UAAU,GACV,KAAK,GACL,IAAI,GACJ,KAAK,GACL,QAAQ,GACR,KAAK,GACL,KAAK,GACL,SAAS,GACT,OAAO,CAAC;AAEZ,MAAM,WAAW,QAAQ;IACvB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,SAAS;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjE;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd"}
|
package/declarations/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
export { compile
|
|
1
|
+
export { compile } from './compile/compile.ts';
|
|
2
|
+
export { Compiled } from './compile/Compiled.ts';
|
|
2
3
|
export { invocationName, invocationOf, nameFor } from './compile/utils.ts';
|
|
3
|
-
export
|
|
4
|
+
export { getCompiler } from './services/compiler.ts';
|
|
5
|
+
export { setup as setupCompiler } from './setup.ts';
|
|
6
|
+
export type { CompileState } from './compile/state.ts';
|
|
7
|
+
export type { Format, ModuleMap, ScopeMap } from './compile/types.ts';
|
|
4
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,YAAY,CAAC;AAGpD,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Compiler } from 'repl-sdk';
|
|
2
|
+
import type { CompileResult, ModuleMap } from '../compile/types.ts';
|
|
3
|
+
import type { ComponentLike } from '@glint/template';
|
|
4
|
+
import type { EditorView } from 'codemirror';
|
|
5
|
+
import type { ErrorMessage, InfoMessage, Message } from 'repl-sdk';
|
|
6
|
+
export declare function getCompiler(context: object): CompilerService;
|
|
7
|
+
interface CompilerOptions {
|
|
8
|
+
hbs?: {
|
|
9
|
+
scope?: Record<string, unknown>;
|
|
10
|
+
};
|
|
11
|
+
md?: {
|
|
12
|
+
remarkPlugins?: unknown[];
|
|
13
|
+
rehypePlugins?: unknown[];
|
|
14
|
+
};
|
|
15
|
+
gmd?: {
|
|
16
|
+
scope?: Record<string, unknown>;
|
|
17
|
+
remarkPlugins?: unknown[];
|
|
18
|
+
rehypePlugins?: unknown[];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export default class CompilerService {
|
|
22
|
+
#private;
|
|
23
|
+
constructor();
|
|
24
|
+
messages: Message[];
|
|
25
|
+
get lastInfo(): InfoMessage | undefined;
|
|
26
|
+
get lastError(): ErrorMessage | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* @param {ModuleMap} [ extraModules ]: map of import paths to modules.
|
|
29
|
+
* These modules are useful if you need to document a library or a any design system or a styleguide or
|
|
30
|
+
* if there are additional modules that could be imported in the passed `code`.
|
|
31
|
+
* @param {object} [options] optional compiler options for each format/flavor
|
|
32
|
+
*
|
|
33
|
+
* Later on, imports that are not present by default (ember/glimmer) or that
|
|
34
|
+
* are not provided by extraModules will be searched on npm to see if a package
|
|
35
|
+
* needs to be downloaded before running the `code` / invoking the component
|
|
36
|
+
*/
|
|
37
|
+
setup: (extraModules?: ModuleMap, options?: CompilerOptions) => void;
|
|
38
|
+
get compiler(): Compiler;
|
|
39
|
+
createEditor(element: HTMLElement, options: {
|
|
40
|
+
text: string | null | undefined;
|
|
41
|
+
format: string;
|
|
42
|
+
handleUpdate: (text: string) => void;
|
|
43
|
+
extensions?: unknown[];
|
|
44
|
+
}): Promise<{
|
|
45
|
+
view: EditorView;
|
|
46
|
+
setText: (text: string, format: string) => Promise<void>;
|
|
47
|
+
setFormat: (format: string) => Promise<void>;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* @public
|
|
51
|
+
*
|
|
52
|
+
* Defers to the underlying repl-SDK and gives us a component we can render.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} ext the ext/format to be compiled
|
|
55
|
+
* @param {string} text the code to be compiled using the configured compiler for the ext
|
|
56
|
+
*/
|
|
57
|
+
compile(ext: string, text: string, options?: Record<string, unknown>): Promise<{
|
|
58
|
+
name: string;
|
|
59
|
+
component: ComponentLike | undefined;
|
|
60
|
+
error: Error | undefined;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* @public
|
|
64
|
+
*
|
|
65
|
+
* Transpiles GlimmerJS (*.gjs) formatted text into and evaluates as a JS Module.
|
|
66
|
+
* The returned component can be invoked explicitly in the consuming project.
|
|
67
|
+
*
|
|
68
|
+
* @param {string} code the code to be compiled
|
|
69
|
+
*/
|
|
70
|
+
compileGJS(code: string): Promise<CompileResult>;
|
|
71
|
+
/**
|
|
72
|
+
* compile a template with an empty scope
|
|
73
|
+
* to use components, helpers, etc, you will need to compile with JS
|
|
74
|
+
*
|
|
75
|
+
* (templates alone do not have a way to import / define complex structures)
|
|
76
|
+
*/
|
|
77
|
+
compileHBS(source: string, options?: {
|
|
78
|
+
/**
|
|
79
|
+
* Used for debug viewing
|
|
80
|
+
*/
|
|
81
|
+
moduleName?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Additional values to include in hbs scope.
|
|
84
|
+
* This is a _strict mode_ hbs component.
|
|
85
|
+
*/
|
|
86
|
+
scope?: Record<string, unknown>;
|
|
87
|
+
}): Promise<CompileResult>;
|
|
88
|
+
compileMD(source: string, options?: {
|
|
89
|
+
remarkPlugins?: unknown[];
|
|
90
|
+
rehypePlugins?: unknown[];
|
|
91
|
+
}): Promise<CompileResult>;
|
|
92
|
+
}
|
|
93
|
+
export {};
|
|
94
|
+
//# sourceMappingURL=compiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.d.ts","sourceRoot":"","sources":["../../src/services/compiler.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAMpC,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnE,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,mBAM1C;AA2BD,UAAU,eAAe;IACvB,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACjC,CAAC;IACF,EAAE,CAAC,EAAE;QACH,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC;QAC1B,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC;KAC3B,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChC,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC;QAC1B,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC;KAC3B,CAAC;CACH;AAyED,MAAM,CAAC,OAAO,OAAO,eAAe;;;IAmBzB,QAAQ,EAAE,OAAO,EAAE,CAAM;IAElC,IAAI,QAAQ,IAAI,WAAW,GAAG,SAAS,CAQtC;IAED,IAAI,SAAS,IAAI,YAAY,GAAG,SAAS,CAQxC;IAED;;;;;;;;;OASG;IACH,KAAK,GAAI,eAAc,SAAc,EAAE,UAAS,eAAoB,UA+DlE;IAEF,IAAI,QAAQ,IAAI,QAAQ,CAevB;IAEK,YAAY,CAChB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;QAChC,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QACrC,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC;KACxB,GACA,OAAO,CAAC;QACT,IAAI,EAAE,UAAU,CAAC;QACjB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QACzD,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KAC9C,CAAC;IAmBF;;;;;;;OAOG;IAEG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;IA2B1E;;;;;;;OAOG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIhD;;;;;OAKG;IAEG,UAAU,CACd,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;QACP;;WAEG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC5B,GACL,OAAO,CAAC,aAAa,CAAC;IAKzB,SAAS,CACP,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;QACR,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC;QAC1B,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC;KAC3B,GACA,OAAO,CAAC,aAAa,CAAC;CAG1B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ModuleMap } from '../compile/types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* If any real packages are defined here, they would fallback to fetching from NPM
|
|
4
|
+
* instead of loading from this pre-made bundle.
|
|
5
|
+
*/
|
|
6
|
+
export declare const modules: (extraModules: ModuleMap) => ModuleMap;
|
|
7
|
+
//# sourceMappingURL=known-modules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-modules.d.ts","sourceRoot":"","sources":["../../src/services/known-modules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAuHrD;;;GAGG;AACH,eAAO,MAAM,OAAO,GAAI,cAAc,SAAS,KAAG,SAMhD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ModuleMap } from './compile/types.ts';
|
|
2
|
+
import type CompilerService from './services/compiler.ts';
|
|
3
|
+
export declare function setup(context: object, options?: {
|
|
4
|
+
modules?: ModuleMap;
|
|
5
|
+
options?: object;
|
|
6
|
+
}): CompilerService;
|
|
7
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAI1D,wBAAgB,KAAK,CACnB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAClD,eAAe,CAajB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ModuleMap } from './compile/types.ts';
|
|
2
|
+
import type { Options } from 'repl-sdk';
|
|
3
|
+
export declare function clearCompileCache(): void;
|
|
4
|
+
type Hooks = {
|
|
5
|
+
beforeEach: (this: object, callback: (...args: unknown[]) => void | Promise<void>) => void | Promise<void>;
|
|
6
|
+
afterEach: (this: object, callback: (...args: unknown[]) => void | Promise<void>) => void | Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
export declare function clearCache(hooks: Hooks): void;
|
|
9
|
+
export declare function setupCompiler(hooks: Hooks, options?: {
|
|
10
|
+
modules?: ModuleMap;
|
|
11
|
+
/**
|
|
12
|
+
* Clear all the compile caches between tests.
|
|
13
|
+
* This is false by default, so that tests run faster, and
|
|
14
|
+
* we thrash the network less.
|
|
15
|
+
*/
|
|
16
|
+
clearCache?: true;
|
|
17
|
+
options?: Options['options'];
|
|
18
|
+
}): void;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=test-support.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-support.d.ts","sourceRoot":"","sources":["../src/test-support.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,wBAAgB,iBAAiB,SAEhC;AAED,KAAK,KAAK,GAAG;IACX,UAAU,EAAE,CACV,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KACnD,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,SAAS,EAAE,CACT,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KACnD,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,QAOtC;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;CAC9B,QAmBF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2
|
+
|
|
3
|
+
function getDefaultExportFromCjs (x) {
|
|
4
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function getAugmentedNamespace(n) {
|
|
8
|
+
if (Object.prototype.hasOwnProperty.call(n, '__esModule')) return n;
|
|
9
|
+
var f = n.default;
|
|
10
|
+
if (typeof f == "function") {
|
|
11
|
+
var a = function a () {
|
|
12
|
+
var isInstance = false;
|
|
13
|
+
try {
|
|
14
|
+
isInstance = this instanceof a;
|
|
15
|
+
} catch {}
|
|
16
|
+
if (isInstance) {
|
|
17
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
18
|
+
}
|
|
19
|
+
return f.apply(this, arguments);
|
|
20
|
+
};
|
|
21
|
+
a.prototype = f.prototype;
|
|
22
|
+
} else a = {};
|
|
23
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
24
|
+
Object.keys(n).forEach(function (k) {
|
|
25
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
26
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () {
|
|
29
|
+
return n[k];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
return a;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { getAugmentedNamespace as a, commonjsGlobal as c, getDefaultExportFromCjs as g };
|
|
37
|
+
//# sourceMappingURL=_commonjsHelpers-BAGoDD49.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_commonjsHelpers-BAGoDD49.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|