ember-repl 8.2.3 → 8.3.0
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/compile/Compiled.d.ts +11 -0
- package/declarations/compile/Compiled.d.ts.map +1 -1
- package/declarations/compile/compile.d.ts +9 -0
- package/declarations/compile/compile.d.ts.map +1 -1
- package/declarations/compile/state.d.ts +0 -5
- package/declarations/compile/state.d.ts.map +1 -1
- package/declarations/compile/types.d.ts +1 -1
- package/declarations/compile/types.d.ts.map +1 -1
- package/declarations/services/compiler.d.ts +22 -1
- package/declarations/services/compiler.d.ts.map +1 -1
- package/declarations/services/known-modules.d.ts +9 -0
- package/declarations/services/known-modules.d.ts.map +1 -1
- package/declarations/setup.d.ts.map +1 -1
- package/dist/{_commonjsHelpers-BAGoDD49.js → _commonjsHelpers-Bssqqw1Q.js} +2 -4
- package/dist/_commonjsHelpers-Bssqqw1Q.js.map +1 -0
- package/dist/compile/Compiled.js +7 -1
- package/dist/compile/Compiled.js.map +1 -1
- package/dist/compile/compile.js +0 -5
- package/dist/compile/compile.js.map +1 -1
- package/dist/compile/state.js +1 -13
- package/dist/compile/state.js.map +1 -1
- package/dist/compile/utils.js.map +1 -1
- package/dist/{index-DNPwtadt.js → index-CPzChcIg.js} +2 -2
- package/dist/{index-DNPwtadt.js.map → index-CPzChcIg.js.map} +1 -1
- package/dist/{index-C0sat7kP.js → index-D55gYNjO.js} +29 -8
- package/dist/index-D55gYNjO.js.map +1 -0
- package/dist/index-DNctqogm.js +70615 -0
- package/dist/index-DNctqogm.js.map +1 -0
- package/dist/{plugin-ZDtYFKJg.js → plugin-Deq-PxMR.js} +58 -37
- package/dist/plugin-Deq-PxMR.js.map +1 -0
- package/dist/services/compiler.js +90 -36
- package/dist/services/compiler.js.map +1 -1
- package/dist/services/known-modules.js +72 -60
- package/dist/services/known-modules.js.map +1 -1
- package/dist/setup.js +1 -4
- package/dist/setup.js.map +1 -1
- package/dist/test-support.js.map +1 -1
- package/package.json +35 -36
- package/src/compile/Compiled.ts +17 -0
- package/src/compile/compile.ts +9 -7
- package/src/compile/state.ts +0 -15
- package/src/compile/types.ts +2 -0
- package/src/services/compiler.ts +117 -31
- package/src/services/known-modules.ts +87 -56
- package/src/setup.ts +1 -8
- package/dist/_commonjsHelpers-BAGoDD49.js.map +0 -1
- package/dist/babel-DbH-RlNa.js +0 -106895
- package/dist/babel-DbH-RlNa.js.map +0 -1
- package/dist/index-C0sat7kP.js.map +0 -1
- package/dist/plugin-ZDtYFKJg.js.map +0 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { VERSION } from '@ember/version';
|
|
2
|
+
|
|
1
3
|
const frameworkModules = {
|
|
2
4
|
'@ember/application': () => import('@ember/application'),
|
|
3
5
|
'@ember/application/instance': () => import('@ember/application/instance'),
|
|
@@ -38,9 +40,11 @@ const frameworkModules = {
|
|
|
38
40
|
'@glimmer/tracking/primitives/cache': () => import('@glimmer/tracking/primitives/cache')
|
|
39
41
|
};
|
|
40
42
|
const coreLibraries = {
|
|
41
|
-
'ember-resolver': () => import('ember-resolver'),
|
|
42
43
|
'ember-resources': () => import('ember-resources'),
|
|
43
44
|
'ember-primitives': () => import('ember-primitives'),
|
|
45
|
+
// The prebuilt entry has its dependencies inlined and loads each diagram type on demand.
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
mermaid: () => import('mermaid/dist/mermaid.esm.min.mjs'),
|
|
44
48
|
'repl-sdk': () => import('repl-sdk')
|
|
45
49
|
};
|
|
46
50
|
const emberCompilationModules = {
|
|
@@ -50,69 +54,17 @@ const emberCompilationModules = {
|
|
|
50
54
|
// @ts-ignore
|
|
51
55
|
'ember-source/ember-template-compiler/index.js'),
|
|
52
56
|
// Direct Dependencies
|
|
53
|
-
'@babel
|
|
57
|
+
'@glimdown/babel-8-lite': () => import('../index-DNctqogm.js'),
|
|
54
58
|
'content-tag': () => import('content-tag'),
|
|
55
59
|
'decorator-transforms': () => import('decorator-transforms'),
|
|
56
60
|
'decorator-transforms/runtime': () => import('decorator-transforms/runtime'),
|
|
57
61
|
'decorator-transforms/runtime-esm': () => import('decorator-transforms/runtime-esm'),
|
|
58
62
|
'decorator-transforms/globals': () => import('decorator-transforms/globals'),
|
|
59
|
-
'babel-plugin-ember-template-compilation': () => import('../plugin-
|
|
63
|
+
'babel-plugin-ember-template-compilation': () => import('../plugin-Deq-PxMR.js'),
|
|
60
64
|
// Dependencies of the above
|
|
61
|
-
'babel-import-util': () => import('../index-
|
|
65
|
+
'babel-import-util': () => import('../index-CPzChcIg.js').then(function (n) { return n.i; }),
|
|
62
66
|
// @ts-ignore
|
|
63
|
-
'babel-plugin-debug-macros': () => import('../index-
|
|
64
|
-
'@embroider/macros': () => ({
|
|
65
|
-
// passthrough, we are not doing dead-code-elimination
|
|
66
|
-
macroCondition: x => x,
|
|
67
|
-
// I *could* actually implement this
|
|
68
|
-
appEmberSatisfies: () => true,
|
|
69
|
-
// I *could* actually implement this
|
|
70
|
-
dependencySatisfies: () => true,
|
|
71
|
-
isDevelopingApp: () => true,
|
|
72
|
-
// Trying to use warp-drive in a REPL environment may be impossible, since they
|
|
73
|
-
// encourage choosing your own adventure without a buildless recommended path.
|
|
74
|
-
// The use of nested configs (specifically env) is also problematic for
|
|
75
|
-
// "falling back to false" as what all other macros-using libraries use.
|
|
76
|
-
// (many of us have seen "Cannot access DEBUG on undefined" in build errors)
|
|
77
|
-
// Even with this config, I have not successfully been able to use warp-drive
|
|
78
|
-
// in any of my REPL-based projects.
|
|
79
|
-
//
|
|
80
|
-
// (Its also perfectly fine for warp-drive to decide they don't care about the same things I do)
|
|
81
|
-
getGlobalConfig: () => ({
|
|
82
|
-
WarpDrive: {
|
|
83
|
-
debug: false,
|
|
84
|
-
env: {
|
|
85
|
-
DEBUG: false,
|
|
86
|
-
TESTING: false,
|
|
87
|
-
PRODUCTION: true
|
|
88
|
-
},
|
|
89
|
-
activeLogging: false,
|
|
90
|
-
compatWith: '99.0',
|
|
91
|
-
features: {},
|
|
92
|
-
deprecations: {},
|
|
93
|
-
polyfillUUID: false,
|
|
94
|
-
includeDataAdapter: false
|
|
95
|
-
}
|
|
96
|
-
}),
|
|
97
|
-
// Private
|
|
98
|
-
|
|
99
|
-
// @ts-ignore
|
|
100
|
-
importSync: x =>
|
|
101
|
-
// @ts-expect-error
|
|
102
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
103
|
-
window[Symbol.for('__repl-sdk__compiler__')].resolves[x],
|
|
104
|
-
moduleExists: () => false
|
|
105
|
-
})
|
|
106
|
-
};
|
|
107
|
-
const markdownCompilationModules = {
|
|
108
|
-
// Provided directly in repl-sdk, but could be overridden
|
|
109
|
-
// 'rehype-raw': () => import('rehype-raw'),
|
|
110
|
-
// 'rehype-stringify': () => import('rehype-stringify'),
|
|
111
|
-
// 'remark-gfm': () => import('remark-gfm'),
|
|
112
|
-
// 'remark-parse': () => import('remark-parse'),
|
|
113
|
-
// 'remark-rehype': () => import('remark-rehype'),
|
|
114
|
-
// unified: () => import('unified'),
|
|
115
|
-
// 'unist-util-visit': () => import('unist-util-visit'),
|
|
67
|
+
'babel-plugin-debug-macros': () => import('../index-D55gYNjO.js').then(function (n) { return n.i; })
|
|
116
68
|
};
|
|
117
69
|
|
|
118
70
|
/**
|
|
@@ -123,9 +75,69 @@ const modules = extraModules => ({
|
|
|
123
75
|
...coreLibraries,
|
|
124
76
|
...frameworkModules,
|
|
125
77
|
...extraModules,
|
|
126
|
-
...emberCompilationModules
|
|
127
|
-
...markdownCompilationModules
|
|
78
|
+
...emberCompilationModules
|
|
128
79
|
});
|
|
80
|
+
const EMBER_SOURCE = 'ember-source';
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Framework modules that are packages of their own.
|
|
84
|
+
* Every other framework module comes from ember-source.
|
|
85
|
+
*/
|
|
86
|
+
const ownPackages = new Set(['@glimmer/component', '@ember/test-helpers', '@ember/test-waiters']);
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The npm package of a bundled module.
|
|
90
|
+
*
|
|
91
|
+
* @ember/helper → ember-source
|
|
92
|
+
* @glimmer/component → @glimmer/component
|
|
93
|
+
* ember-primitives/x → ember-primitives
|
|
94
|
+
*/
|
|
95
|
+
function packageOf(specifier) {
|
|
96
|
+
if (specifier in frameworkModules && !ownPackages.has(specifier)) {
|
|
97
|
+
return EMBER_SOURCE;
|
|
98
|
+
}
|
|
99
|
+
if (specifier.startsWith('@ember/template-compiler') || specifier.startsWith('ember-source/')) {
|
|
100
|
+
return EMBER_SOURCE;
|
|
101
|
+
}
|
|
102
|
+
const parts = specifier.split('/');
|
|
103
|
+
return specifier.startsWith('@') ? `${parts[0]}/${parts[1]}` : parts[0] ?? specifier;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Compiler tools that work with any Ember, such as babel and content-tag.
|
|
108
|
+
* Every other bundled module is tied to the bundled Ember.
|
|
109
|
+
*/
|
|
110
|
+
function isEmberIndependent(specifier) {
|
|
111
|
+
return specifier in emberCompilationModules && packageOf(specifier) !== EMBER_SOURCE;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* What the bundled modules are, for repl-sdk's `packages` option.
|
|
116
|
+
*
|
|
117
|
+
* A compile that pins a package loads it from npm in place of these modules.
|
|
118
|
+
* Everything except the compiler tools imports the bundled Ember,
|
|
119
|
+
* so a pin of ember-source loads those from npm too.
|
|
120
|
+
*/
|
|
121
|
+
function packagesFor(specifiers) {
|
|
122
|
+
const emberSource = {
|
|
123
|
+
version: VERSION,
|
|
124
|
+
modules: []
|
|
125
|
+
};
|
|
126
|
+
const packages = {
|
|
127
|
+
[EMBER_SOURCE]: emberSource
|
|
128
|
+
};
|
|
129
|
+
for (const specifier of specifiers) {
|
|
130
|
+
const name = packageOf(specifier);
|
|
131
|
+
if (name === EMBER_SOURCE) {
|
|
132
|
+
emberSource.modules.push(specifier);
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
packages[name] ??= isEmberIndependent(specifier) ? {} : {
|
|
136
|
+
builtWith: [EMBER_SOURCE]
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
return packages;
|
|
140
|
+
}
|
|
129
141
|
|
|
130
|
-
export { modules };
|
|
142
|
+
export { modules, packagesFor };
|
|
131
143
|
//# sourceMappingURL=known-modules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"known-modules.js","sources":["../../src/services/known-modules.ts"],"sourcesContent":["import type { ModuleMap } from '../compile/types.ts';\n\nconst frameworkModules = {\n '@ember/application': () => import('@ember/application'),\n '@ember/application/instance': () => import('@ember/application/instance'),\n '@ember/array': () => import('@ember/array'),\n '@ember/component': () => import('@ember/component'),\n '@ember/component/helper': () => import('@ember/component/helper'),\n '@ember/component/template-only': () =>\n import('@ember/component/template-only'),\n '@ember/controller': () => import('@ember/controller'),\n '@ember/debug': () => import('@ember/debug'),\n '@ember/destroyable': () => import('@ember/destroyable'),\n '@ember/helper': () => import('@ember/helper'),\n '@ember/modifier': () => import('@ember/modifier'),\n '@ember/object': () => import('@ember/object'),\n '@ember/object/compat': () => import('@ember/object/compat'),\n '@ember/object/internals': () => import('@ember/object/internals'),\n '@ember/object/observers': () => import('@ember/object/observers'),\n '@ember/owner': () => import('@ember/owner'),\n '@ember/reactive': () => import('@ember/reactive'),\n '@ember/reactive/collections': () => import('@ember/reactive/collections'),\n '@ember/renderer': () => import('@ember/renderer'),\n '@ember/routing': () => import('@ember/routing'),\n '@ember/routing/route': () => import('@ember/routing/route'),\n '@ember/routing/router': () => import('@ember/routing/router'),\n '@ember/runloop': () => import('@ember/runloop'),\n '@ember/service': () => import('@ember/service'),\n '@ember/template': () => import('@ember/template'),\n '@ember/template-compilation': () => import('@ember/template-compilation'),\n '@ember/template-factory': () => import('@ember/template-factory'),\n '@ember/test-helpers': () => import('@ember/test-helpers'),\n '@ember/test-waiters': () => import('@ember/test-waiters'),\n '@ember/test': () => import('@ember/test'),\n '@ember/utils': () => import('@ember/utils'),\n '@ember/version': () => import('@ember/version'),\n // @ts-ignore\n '@glimmer/validator': () => import('@glimmer/validator'),\n '@glimmer/component': () => import('@glimmer/component'),\n '@glimmer/tracking': () => import('@glimmer/tracking'),\n '@glimmer/tracking/primitives/cache': () =>\n import('@glimmer/tracking/primitives/cache'),\n};\n\nconst coreLibraries = {\n 'ember-resolver': () => import('ember-resolver'),\n 'ember-resources': () => import('ember-resources'),\n 'ember-primitives': () => import('ember-primitives'),\n 'repl-sdk': () => import('repl-sdk'),\n};\n\nconst emberCompilationModules = {\n '@ember/template-compiler/runtime': () =>\n import('@ember/template-compiler/runtime'),\n '@ember/template-compiler': () => import('@ember/template-compiler/runtime'),\n 'ember-source/ember-template-compiler/index.js': () =>\n import(\n // @ts-ignore\n 'ember-source/ember-template-compiler/index.js'\n ),\n // Direct Dependencies\n '@babel/standalone': () => import('@babel/standalone'),\n 'content-tag': () => import('content-tag'),\n 'decorator-transforms': () => import('decorator-transforms'),\n 'decorator-transforms/runtime': () => import('decorator-transforms/runtime'),\n 'decorator-transforms/runtime-esm': () =>\n import('decorator-transforms/runtime-esm'),\n 'decorator-transforms/globals': () => import('decorator-transforms/globals'),\n 'babel-plugin-ember-template-compilation': () =>\n import('babel-plugin-ember-template-compilation'),\n // Dependencies of the above\n 'babel-import-util': () => import('babel-import-util'),\n\n // @ts-ignore\n 'babel-plugin-debug-macros': () => import('babel-plugin-debug-macros'),\n '@embroider/macros': () => ({\n // passthrough, we are not doing dead-code-elimination\n macroCondition: (x: boolean) => x,\n // I *could* actually implement this\n appEmberSatisfies: () => true,\n // I *could* actually implement this\n dependencySatisfies: () => true,\n isDevelopingApp: () => true,\n // Trying to use warp-drive in a REPL environment may be impossible, since they\n // encourage choosing your own adventure without a buildless recommended path.\n // The use of nested configs (specifically env) is also problematic for\n // \"falling back to false\" as what all other macros-using libraries use.\n // (many of us have seen \"Cannot access DEBUG on undefined\" in build errors)\n // Even with this config, I have not successfully been able to use warp-drive\n // in any of my REPL-based projects.\n //\n // (Its also perfectly fine for warp-drive to decide they don't care about the same things I do)\n getGlobalConfig: () => ({\n WarpDrive: {\n debug: false,\n env: {\n DEBUG: false,\n TESTING: false,\n PRODUCTION: true,\n },\n activeLogging: false,\n compatWith: '99.0',\n features: {},\n deprecations: {},\n polyfillUUID: false,\n includeDataAdapter: false,\n },\n }),\n // Private\n\n // @ts-ignore\n importSync: (x: string) =>\n // @ts-expect-error\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n window[Symbol.for('__repl-sdk__compiler__') as any]!.resolves[x],\n moduleExists: () => false,\n }),\n};\n\nconst markdownCompilationModules = {\n // Provided directly in repl-sdk, but could be overridden\n // 'rehype-raw': () => import('rehype-raw'),\n // 'rehype-stringify': () => import('rehype-stringify'),\n // 'remark-gfm': () => import('remark-gfm'),\n // 'remark-parse': () => import('remark-parse'),\n // 'remark-rehype': () => import('remark-rehype'),\n // unified: () => import('unified'),\n // 'unist-util-visit': () => import('unist-util-visit'),\n};\n\n/**\n * If any real packages are defined here, they would fallback to fetching from NPM\n * instead of loading from this pre-made bundle.\n */\nexport const modules = (extraModules: ModuleMap): ModuleMap => ({\n ...coreLibraries,\n ...frameworkModules,\n ...extraModules,\n ...emberCompilationModules,\n ...markdownCompilationModules,\n});\n"],"names":["frameworkModules","@ember/application","@ember/application/instance","@ember/array","@ember/component","@ember/component/helper","@ember/component/template-only","@ember/controller","@ember/debug","@ember/destroyable","@ember/helper","@ember/modifier","@ember/object","@ember/object/compat","@ember/object/internals","@ember/object/observers","@ember/owner","@ember/reactive","@ember/reactive/collections","@ember/renderer","@ember/routing","@ember/routing/route","@ember/routing/router","@ember/runloop","@ember/service","@ember/template","@ember/template-compilation","@ember/template-factory","@ember/test-helpers","@ember/test-waiters","@ember/test","@ember/utils","@ember/version","@glimmer/validator","@glimmer/component","@glimmer/tracking","@glimmer/tracking/primitives/cache","coreLibraries","ember-resolver","ember-resources","ember-primitives","repl-sdk","emberCompilationModules","@ember/template-compiler/runtime","@ember/template-compiler","ember-source/ember-template-compiler/index.js","@babel/standalone","content-tag","decorator-transforms","decorator-transforms/runtime","decorator-transforms/runtime-esm","decorator-transforms/globals","babel-plugin-ember-template-compilation","babel-import-util","babel-plugin-debug-macros","@embroider/macros","macroCondition","x","appEmberSatisfies","dependencySatisfies","isDevelopingApp","getGlobalConfig","WarpDrive","debug","env","DEBUG","TESTING","PRODUCTION","activeLogging","compatWith","features","deprecations","polyfillUUID","includeDataAdapter","importSync","window","Symbol","for","resolves","moduleExists","markdownCompilationModules","modules","extraModules"],"mappings":"AAEA,MAAMA,gBAAgB,GAAG;AACvB,EAAA,oBAAoB,EAAEC,MAAM,OAAO,oBAAoB,CAAC;AACxD,EAAA,6BAA6B,EAAEC,MAAM,OAAO,6BAA6B,CAAC;AAC1E,EAAA,cAAc,EAAEC,MAAM,OAAO,cAAc,CAAC;AAC5C,EAAA,kBAAkB,EAAEC,MAAM,OAAO,kBAAkB,CAAC;AACpD,EAAA,yBAAyB,EAAEC,MAAM,OAAO,yBAAyB,CAAC;AAClE,EAAA,gCAAgC,EAAEC,MAChC,OAAO,gCAAgC,CAAC;AAC1C,EAAA,mBAAmB,EAAEC,MAAM,OAAO,mBAAmB,CAAC;AACtD,EAAA,cAAc,EAAEC,MAAM,OAAO,cAAc,CAAC;AAC5C,EAAA,oBAAoB,EAAEC,MAAM,OAAO,oBAAoB,CAAC;AACxD,EAAA,eAAe,EAAEC,MAAM,OAAO,eAAe,CAAC;AAC9C,EAAA,iBAAiB,EAAEC,MAAM,OAAO,iBAAiB,CAAC;AAClD,EAAA,eAAe,EAAEC,MAAM,OAAO,eAAe,CAAC;AAC9C,EAAA,sBAAsB,EAAEC,MAAM,OAAO,sBAAsB,CAAC;AAC5D,EAAA,yBAAyB,EAAEC,MAAM,OAAO,yBAAyB,CAAC;AAClE,EAAA,yBAAyB,EAAEC,MAAM,OAAO,yBAAyB,CAAC;AAClE,EAAA,cAAc,EAAEC,MAAM,OAAO,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AAA,UAAU,EAAE;SACb;AACDC,QAAAA,aAAa,EAAE,KAAK;AACpBC,QAAAA,UAAU,EAAE,MAAM;QAClBC,QAAQ,EAAE,EAAE;QACZC,YAAY,EAAE,EAAE;AAChBC,QAAAA,YAAY,EAAE,KAAK;AACnBC,QAAAA,kBAAkB,EAAE;AACtB;AACF,KAAC,CAAC;AACF;;AAEA;AACAC,IAAAA,UAAU,EAAGjB,CAAS;AACpB;AACA;AACAkB,IAAAA,MAAM,CAACC,MAAM,CAACC,GAAG,CAAC,wBAAwB,CAAC,CAAQ,CAAEC,QAAQ,CAACrB,CAAC,CAAC;IAClEsB,YAAY,EAAEA,MAAM;GACrB;AACH,CAAC;AAED,MAAMC,0BAA0B,GAAG;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,CACD;;AAED;AACA;AACA;AACA;AACO,MAAMC,OAAO,GAAIC,YAAuB,KAAiB;AAC9D,EAAA,GAAG7C,aAAa;AAChB,EAAA,GAAGrC,gBAAgB;AACnB,EAAA,GAAGkF,YAAY;AACf,EAAA,GAAGxC,uBAAuB;EAC1B,GAAGsC;AACL,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"known-modules.js","sources":["../../src/services/known-modules.ts"],"sourcesContent":["import { VERSION } from '@ember/version';\n\nimport type { ModuleMap } from '../compile/types.ts';\nimport type { Options } from 'repl-sdk';\n\nconst frameworkModules = {\n '@ember/application': () => import('@ember/application'),\n '@ember/application/instance': () => import('@ember/application/instance'),\n '@ember/array': () => import('@ember/array'),\n '@ember/component': () => import('@ember/component'),\n '@ember/component/helper': () => import('@ember/component/helper'),\n '@ember/component/template-only': () =>\n import('@ember/component/template-only'),\n '@ember/controller': () => import('@ember/controller'),\n '@ember/debug': () => import('@ember/debug'),\n '@ember/destroyable': () => import('@ember/destroyable'),\n '@ember/helper': () => import('@ember/helper'),\n '@ember/modifier': () => import('@ember/modifier'),\n '@ember/object': () => import('@ember/object'),\n '@ember/object/compat': () => import('@ember/object/compat'),\n '@ember/object/internals': () => import('@ember/object/internals'),\n '@ember/object/observers': () => import('@ember/object/observers'),\n '@ember/owner': () => import('@ember/owner'),\n '@ember/reactive': () => import('@ember/reactive'),\n '@ember/reactive/collections': () => import('@ember/reactive/collections'),\n '@ember/renderer': () => import('@ember/renderer'),\n '@ember/routing': () => import('@ember/routing'),\n '@ember/routing/route': () => import('@ember/routing/route'),\n '@ember/routing/router': () => import('@ember/routing/router'),\n '@ember/runloop': () => import('@ember/runloop'),\n '@ember/service': () => import('@ember/service'),\n '@ember/template': () => import('@ember/template'),\n '@ember/template-compilation': () => import('@ember/template-compilation'),\n '@ember/template-factory': () => import('@ember/template-factory'),\n '@ember/test-helpers': () => import('@ember/test-helpers'),\n '@ember/test-waiters': () => import('@ember/test-waiters'),\n '@ember/test': () => import('@ember/test'),\n '@ember/utils': () => import('@ember/utils'),\n '@ember/version': () => import('@ember/version'),\n // @ts-ignore\n '@glimmer/validator': () => import('@glimmer/validator'),\n '@glimmer/component': () => import('@glimmer/component'),\n '@glimmer/tracking': () => import('@glimmer/tracking'),\n '@glimmer/tracking/primitives/cache': () =>\n import('@glimmer/tracking/primitives/cache'),\n};\n\nconst coreLibraries = {\n 'ember-resources': () => import('ember-resources'),\n 'ember-primitives': () => import('ember-primitives'),\n // The prebuilt entry has its dependencies inlined and loads each diagram type on demand.\n // @ts-ignore\n mermaid: () => import('mermaid/dist/mermaid.esm.min.mjs'),\n 'repl-sdk': () => import('repl-sdk'),\n};\n\nconst emberCompilationModules = {\n '@ember/template-compiler/runtime': () =>\n import('@ember/template-compiler/runtime'),\n '@ember/template-compiler': () => import('@ember/template-compiler/runtime'),\n 'ember-source/ember-template-compiler/index.js': () =>\n import(\n // @ts-ignore\n 'ember-source/ember-template-compiler/index.js'\n ),\n // Direct Dependencies\n '@glimdown/babel-8-lite': () => import('@glimdown/babel-8-lite'),\n 'content-tag': () => import('content-tag'),\n 'decorator-transforms': () => import('decorator-transforms'),\n 'decorator-transforms/runtime': () => import('decorator-transforms/runtime'),\n 'decorator-transforms/runtime-esm': () =>\n import('decorator-transforms/runtime-esm'),\n 'decorator-transforms/globals': () => import('decorator-transforms/globals'),\n 'babel-plugin-ember-template-compilation': () =>\n import('babel-plugin-ember-template-compilation'),\n // Dependencies of the above\n 'babel-import-util': () => import('babel-import-util'),\n\n // @ts-ignore\n 'babel-plugin-debug-macros': () => import('babel-plugin-debug-macros'),\n};\n\n/**\n * If any real packages are defined here, they would fallback to fetching from NPM\n * instead of loading from this pre-made bundle.\n */\nexport const modules = (extraModules: ModuleMap): ModuleMap => ({\n ...coreLibraries,\n ...frameworkModules,\n ...extraModules,\n ...emberCompilationModules,\n});\n\nconst EMBER_SOURCE = 'ember-source';\n\n/**\n * Framework modules that are packages of their own.\n * Every other framework module comes from ember-source.\n */\nconst ownPackages = new Set([\n '@glimmer/component',\n '@ember/test-helpers',\n '@ember/test-waiters',\n]);\n\n/**\n * The npm package of a bundled module.\n *\n * @ember/helper → ember-source\n * @glimmer/component → @glimmer/component\n * ember-primitives/x → ember-primitives\n */\nfunction packageOf(specifier: string): string {\n if (specifier in frameworkModules && !ownPackages.has(specifier)) {\n return EMBER_SOURCE;\n }\n\n if (\n specifier.startsWith('@ember/template-compiler') ||\n specifier.startsWith('ember-source/')\n ) {\n return EMBER_SOURCE;\n }\n\n const parts = specifier.split('/');\n\n return specifier.startsWith('@')\n ? `${parts[0]}/${parts[1]}`\n : (parts[0] ?? specifier);\n}\n\n/**\n * Compiler tools that work with any Ember, such as babel and content-tag.\n * Every other bundled module is tied to the bundled Ember.\n */\nfunction isEmberIndependent(specifier: string): boolean {\n return (\n specifier in emberCompilationModules &&\n packageOf(specifier) !== EMBER_SOURCE\n );\n}\n\n/**\n * What the bundled modules are, for repl-sdk's `packages` option.\n *\n * A compile that pins a package loads it from npm in place of these modules.\n * Everything except the compiler tools imports the bundled Ember,\n * so a pin of ember-source loads those from npm too.\n */\nexport function packagesFor(\n specifiers: string[]\n): NonNullable<Options['packages']> {\n const emberSource = { version: VERSION, modules: [] as string[] };\n const packages: NonNullable<Options['packages']> = {\n [EMBER_SOURCE]: emberSource,\n };\n\n for (const specifier of specifiers) {\n const name = packageOf(specifier);\n\n if (name === EMBER_SOURCE) {\n emberSource.modules.push(specifier);\n continue;\n }\n\n packages[name] ??= isEmberIndependent(specifier)\n ? {}\n : { builtWith: [EMBER_SOURCE] };\n }\n\n return packages;\n}\n"],"names":["@ember/application","@ember/application/instance","@ember/array","@ember/component","@ember/component/helper","@ember/component/template-only","@ember/controller","@ember/debug","@ember/destroyable","@ember/helper","@ember/modifier","@ember/object","@ember/object/compat","@ember/object/internals","@ember/object/observers","@ember/owner","@ember/reactive","@ember/reactive/collections","@ember/renderer","@ember/routing","@ember/routing/route","@ember/routing/router","@ember/runloop","@ember/service","@ember/template","@ember/template-compilation","@ember/template-factory","@ember/test-helpers","@ember/test-waiters","@ember/test","@ember/utils","@ember/version","@glimmer/validator","@glimmer/component","@glimmer/tracking","@glimmer/tracking/primitives/cache","ember-resources","ember-primitives","repl-sdk","@ember/template-compiler/runtime","@ember/template-compiler","ember-source/ember-template-compiler/index.js","@glimdown/babel-8-lite","content-tag","decorator-transforms","decorator-transforms/runtime","decorator-transforms/runtime-esm","decorator-transforms/globals","babel-plugin-ember-template-compilation","babel-import-util","babel-plugin-debug-macros"],"mappings":";;AAKA,MAAM,gBAAgB,GAAG;AACvB,EAAA,oBAAoB,EAAEA,MAAM,OAAO,oBAAoB,CAAC;AACxD,EAAA,6BAA6B,EAAEC,MAAM,OAAO,6BAA6B,CAAC;AAC1E,EAAA,cAAc,EAAEC,MAAM,OAAO,cAAc,CAAC;AAC5C,EAAA,kBAAkB,EAAEC,MAAM,OAAO,kBAAkB,CAAC;AACpD,EAAA,yBAAyB,EAAEC,MAAM,OAAO,yBAAyB,CAAC;AAClE,EAAA,gCAAgC,EAAEC,MAChC,OAAO,gCAAgC,CAAC;AAC1C,EAAA,mBAAmB,EAAEC,MAAM,OAAO,mBAAmB,CAAC;AACtD,EA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AAgB;AACjE,EAAA,MAAM,QAA0C,GAAG;AACjD,IAAA,CAAC,YAAY,GAAG;GACjB;AAED,EAAA,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;AAClC,IAAA,MAAM,IAAI,GAAG,SAAS,CAAC,SAAS,CAAC;IAEjC,IAAI,IAAI,KAAK,YAAY,EAAE;AACzB,MAAA,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC;AACnC,MAAA;AACF,IAAA;IAEA,QAAQ,CAAC,IAAI,CAAC,KAAK,kBAAkB,CAAC,SAAS,CAAC,GAC5C,EAAE,GACF;MAAE,SAAS,EAAE,CAAC,YAAY;KAAG;AACnC,EAAA;AAEA,EAAA,OAAO,QAAQ;AACjB;;;;"}
|
package/dist/setup.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { assert } from '@ember/debug';
|
|
2
2
|
import { getCompiler } from './services/compiler.js';
|
|
3
3
|
|
|
4
|
-
const NO_MODULES = Symbol.for('no custom modules configured');
|
|
5
4
|
function setup(context, options) {
|
|
6
5
|
const compiler = getCompiler(context);
|
|
7
6
|
assert(`Could not find the compiler service.`, compiler);
|
|
8
|
-
compiler.setup(options?.modules ?? {
|
|
9
|
-
[NO_MODULES]: true
|
|
10
|
-
}, options?.options);
|
|
7
|
+
compiler.setup(options?.modules ?? {}, options?.options);
|
|
11
8
|
return compiler;
|
|
12
9
|
}
|
|
13
10
|
|
package/dist/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sources":["../src/setup.ts"],"sourcesContent":["import { assert } from '@ember/debug';\n\nimport { getCompiler } from './services/compiler.ts';\n\nimport type { ModuleMap } from './compile/types.ts';\nimport type CompilerService from './services/compiler.ts';\n\
|
|
1
|
+
{"version":3,"file":"setup.js","sources":["../src/setup.ts"],"sourcesContent":["import { assert } from '@ember/debug';\n\nimport { getCompiler } from './services/compiler.ts';\n\nimport type { ModuleMap } from './compile/types.ts';\nimport type CompilerService from './services/compiler.ts';\n\nexport function setup(\n context: object,\n options?: { modules?: ModuleMap; options?: object }\n): CompilerService {\n const compiler = getCompiler(context);\n\n assert(`Could not find the compiler service.`, compiler);\n\n compiler.setup(options?.modules ?? {}, options?.options);\n\n return compiler;\n}\n"],"names":[],"mappings":";;;AAOO,SAAS,KAAK,CACnB,OAAe,EACf,OAAmD,EAClC;AACjB,EAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC;AAErC,EAAA,MAAM,CAAC,CAAA,oCAAA,CAAsC,EAAE,QAAQ,CAAC;AAExD,EAAA,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC;AAExD,EAAA,OAAO,QAAQ;AACjB;;;;"}
|
package/dist/test-support.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-support.js","sources":["../src/test-support.ts"],"sourcesContent":["import { Compiler } from 'repl-sdk';\n\nimport { CACHE } from './compile/compile.ts';\nimport { setup } from './setup.ts';\n\nimport type { ModuleMap } from './compile/types.ts';\nimport type { TestContext } from '@ember/test-helpers';\nimport type { Options } from 'repl-sdk';\n\nexport function clearCompileCache() {\n CACHE.clear();\n}\n\ntype Hooks = {\n beforeEach: (\n this: object,\n callback: (...args: unknown[]) => void | Promise<void>\n ) => void | Promise<void>;\n afterEach: (\n this: object,\n callback: (...args: unknown[]) => void | Promise<void>\n ) => void | Promise<void>;\n};\n\nexport function clearCache(hooks: Hooks) {\n hooks.beforeEach(function (this: TestContext) {\n Compiler.clearCache();\n });\n hooks.afterEach(function (this: TestContext) {\n Compiler.clearCache();\n });\n}\n\nexport function setupCompiler(\n hooks: Hooks,\n options?: {\n modules?: ModuleMap;\n /**\n * Clear all the compile caches between tests.\n * This is false by default, so that tests run faster, and\n * we thrash the network less.\n */\n clearCache?: true;\n options?: Options['options'];\n }\n) {\n hooks.beforeEach(function (this: TestContext) {\n Compiler.clearCache();\n\n if (options?.clearCache) {\n clearCompileCache();\n }\n\n setup(this, options);\n });\n\n hooks.afterEach(function (this: TestContext) {\n Compiler.clearCache();\n\n if (options?.clearCache) {\n clearCompileCache();\n }\n });\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"test-support.js","sources":["../src/test-support.ts"],"sourcesContent":["import { Compiler } from 'repl-sdk';\n\nimport { CACHE } from './compile/compile.ts';\nimport { setup } from './setup.ts';\n\nimport type { ModuleMap } from './compile/types.ts';\nimport type { TestContext } from '@ember/test-helpers';\nimport type { Options } from 'repl-sdk';\n\nexport function clearCompileCache() {\n CACHE.clear();\n}\n\ntype Hooks = {\n beforeEach: (\n this: object,\n callback: (...args: unknown[]) => void | Promise<void>\n ) => void | Promise<void>;\n afterEach: (\n this: object,\n callback: (...args: unknown[]) => void | Promise<void>\n ) => void | Promise<void>;\n};\n\nexport function clearCache(hooks: Hooks) {\n hooks.beforeEach(function (this: TestContext) {\n Compiler.clearCache();\n });\n hooks.afterEach(function (this: TestContext) {\n Compiler.clearCache();\n });\n}\n\nexport function setupCompiler(\n hooks: Hooks,\n options?: {\n modules?: ModuleMap;\n /**\n * Clear all the compile caches between tests.\n * This is false by default, so that tests run faster, and\n * we thrash the network less.\n */\n clearCache?: true;\n options?: Options['options'];\n }\n) {\n hooks.beforeEach(function (this: TestContext) {\n Compiler.clearCache();\n\n if (options?.clearCache) {\n clearCompileCache();\n }\n\n setup(this, options);\n });\n\n hooks.afterEach(function (this: TestContext) {\n Compiler.clearCache();\n\n if (options?.clearCache) {\n clearCompileCache();\n }\n });\n}\n"],"names":[],"mappings":";;;;AASO,SAAS,iBAAiB,GAAG;EAClC,KAAK,CAAC,KAAK,EAAE;AACf;AAaO,SAAS,UAAU,CAAC,KAAY,EAAE;EACvC,KAAK,CAAC,UAAU,CAAC,YAA6B;IAC5C,QAAQ,CAAC,UAAU,EAAE;AACvB,EAAA,CAAC,CAAC;EACF,KAAK,CAAC,SAAS,CAAC,YAA6B;IAC3C,QAAQ,CAAC,UAAU,EAAE;AACvB,EAAA,CAAC,CAAC;AACJ;AAEO,SAAS,aAAa,CAC3B,KAAY,EACZ,OASC,EACD;EACA,KAAK,CAAC,UAAU,CAAC,YAA6B;IAC5C,QAAQ,CAAC,UAAU,EAAE;IAErB,IAAI,OAAO,EAAE,UAAU,EAAE;AACvB,MAAA,iBAAiB,EAAE;AACrB,IAAA;AAEA,IAAA,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;AACtB,EAAA,CAAC,CAAC;EAEF,KAAK,CAAC,SAAS,CAAC,YAA6B;IAC3C,QAAQ,CAAC,UAAU,EAAE;IAErB,IAAI,OAAO,EAAE,UAAU,EAAE;AACvB,MAAA,iBAAiB,EAAE;AACrB,IAAA;AACF,EAAA,CAAC,CAAC;AACJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-repl",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Library for enabling REPL and Playground creation with Ember/Glimmer",
|
|
6
6
|
"keywords": [
|
|
@@ -19,60 +19,57 @@
|
|
|
19
19
|
"src"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@ember/test-helpers": "^5.
|
|
22
|
+
"@ember/test-helpers": "^5.5.0",
|
|
23
23
|
"@ember/test-waiters": "^4.1.0",
|
|
24
24
|
"codemirror": "^6.0.2",
|
|
25
25
|
"content-tag": "^4.0.0",
|
|
26
|
-
"decorator-transforms": "2.
|
|
27
|
-
"ember-primitives": "^0.
|
|
28
|
-
"ember-resolver": "^13.1.0",
|
|
26
|
+
"decorator-transforms": "2.4.0",
|
|
27
|
+
"ember-primitives": "^0.64.3",
|
|
29
28
|
"ember-resources": "^7.1.0",
|
|
30
|
-
"
|
|
29
|
+
"mermaid": "^11.16.1",
|
|
30
|
+
"repl-sdk": "^3.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
34
|
-
"@babel/core": "^
|
|
35
|
-
"@babel/eslint-parser": "^
|
|
36
|
-
"@babel/plugin-transform-typescript": "^
|
|
37
|
-
"@babel/runtime": "^
|
|
38
|
-
"@babel/standalone": "file:babel-standalone.tgz",
|
|
34
|
+
"@babel/core": "^8.1.3",
|
|
35
|
+
"@babel/eslint-parser": "^8.1.2",
|
|
36
|
+
"@babel/plugin-transform-typescript": "^8.1.3",
|
|
37
|
+
"@babel/runtime": "^8.1.3",
|
|
39
38
|
"@ember/app-tsconfig": "^2.0.0",
|
|
40
39
|
"@ember/library-tsconfig": "^2.0.0",
|
|
41
|
-
"@ember/test-helpers": "^5.
|
|
42
|
-
"@embroider/addon-dev": "^8.1
|
|
43
|
-
"@embroider/
|
|
44
|
-
"@embroider/
|
|
45
|
-
"@embroider/
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@glint/
|
|
50
|
-
"@
|
|
51
|
-
"@glint/tsserver-plugin": "^2.5.18",
|
|
52
|
-
"@rollup/plugin-babel": "^6.1.0",
|
|
40
|
+
"@ember/test-helpers": "^5.5.0",
|
|
41
|
+
"@embroider/addon-dev": "^8.3.1",
|
|
42
|
+
"@embroider/core": "^4.6.3",
|
|
43
|
+
"@embroider/macros": "^1.21.4",
|
|
44
|
+
"@embroider/vite": "^1.7.10",
|
|
45
|
+
"@eslint/js": "^10.0.1",
|
|
46
|
+
"@glimmer/component": "^2.2.1",
|
|
47
|
+
"@glint/ember-tsc": "^1.11.0",
|
|
48
|
+
"@glint/template": "1.8.0",
|
|
49
|
+
"@rollup/plugin-babel": "^7.1.0",
|
|
53
50
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
54
51
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
55
|
-
"@types/babel__standalone": "^7.1.9",
|
|
56
52
|
"@types/common-tags": "^1.8.4",
|
|
57
53
|
"@types/mdast": "^4.0.4",
|
|
58
54
|
"@types/qunit": "^2.19.12",
|
|
59
55
|
"@types/unist": "^3.0.3",
|
|
60
56
|
"babel-import-util": "^3.0.1",
|
|
61
57
|
"babel-plugin-debug-macros": "^2.0.0",
|
|
62
|
-
"babel-plugin-ember-template-compilation": "^4.0.
|
|
58
|
+
"babel-plugin-ember-template-compilation": "^4.0.2",
|
|
63
59
|
"change-case": "^5.4.4",
|
|
64
60
|
"common-tags": "^1.8.2",
|
|
65
61
|
"concurrently": "^9.2.1",
|
|
62
|
+
"ember-content-mapper": "^0.2.0",
|
|
66
63
|
"ember-qunit": "^9.0.4",
|
|
67
|
-
"ember-source": "7.
|
|
68
|
-
"eslint": "^
|
|
64
|
+
"ember-source": "7.5.0-alpha.3",
|
|
65
|
+
"eslint": "^10.0.0",
|
|
69
66
|
"eslint-config-prettier": "^10.1.8",
|
|
70
|
-
"eslint-plugin-ember": "^
|
|
67
|
+
"eslint-plugin-ember": "^13.6.1",
|
|
71
68
|
"eslint-plugin-import": "^2.31.0",
|
|
72
|
-
"eslint-plugin-n": "^
|
|
69
|
+
"eslint-plugin-n": "^18.0.1",
|
|
73
70
|
"globals": "^17.0.0",
|
|
74
|
-
"prettier": "^3.
|
|
75
|
-
"prettier-plugin-ember-template-tag": "
|
|
71
|
+
"prettier": "^3.9.6",
|
|
72
|
+
"prettier-plugin-ember-template-tag": "2.1.8",
|
|
76
73
|
"publint": "^0.3.16",
|
|
77
74
|
"qunit": "^2.25.0",
|
|
78
75
|
"qunit-dom": "^3.5.1",
|
|
@@ -84,16 +81,18 @@
|
|
|
84
81
|
"rollup": "^4.53.3",
|
|
85
82
|
"rollup-plugin-node-polyfills": "^0.2.1",
|
|
86
83
|
"testem": "^3.20.0",
|
|
87
|
-
"typescript": "
|
|
88
|
-
"typescript-
|
|
84
|
+
"typescript": "5.9.3",
|
|
85
|
+
"typescript-7": "npm:typescript@7.1.0-dev.20260825.1",
|
|
86
|
+
"typescript-eslint": "^8.59.3",
|
|
89
87
|
"unified": "^11.0.5",
|
|
90
88
|
"unist-util-visit": "^5.0.0",
|
|
91
89
|
"uuid": "^13.0.0",
|
|
92
90
|
"vite": "^8.0.8",
|
|
93
|
-
"vite-plugin-mkcert": "^1.17.9"
|
|
91
|
+
"vite-plugin-mkcert": "^1.17.9",
|
|
92
|
+
"@glimdown/babel-8-lite": "0.0.0"
|
|
94
93
|
},
|
|
95
94
|
"peerDependencies": {
|
|
96
|
-
"@glint/template": "1.
|
|
95
|
+
"@glint/template": "1.8.0"
|
|
97
96
|
},
|
|
98
97
|
"peerDependenciesMeta": {
|
|
99
98
|
"@glint/template": {
|
|
@@ -142,7 +141,7 @@
|
|
|
142
141
|
"lint:format": "prettier . --cache --check",
|
|
143
142
|
"lint:js": "eslint . --cache",
|
|
144
143
|
"lint:js:fix": "eslint . --fix",
|
|
145
|
-
"lint:types": "
|
|
144
|
+
"lint:types": "node node_modules/typescript-7/bin/tsc --noEmit --runExternalCode",
|
|
146
145
|
"start": "pnpm :vite dev",
|
|
147
146
|
"test:ci": "pnpm :testem ci",
|
|
148
147
|
"test:ember": "pnpm build:test && pnpm test:ci",
|
package/src/compile/Compiled.ts
CHANGED
|
@@ -23,6 +23,17 @@ export interface CompiledOptions {
|
|
|
23
23
|
* added later will not become reactive.
|
|
24
24
|
*/
|
|
25
25
|
args?: Record<string, unknown>;
|
|
26
|
+
/**
|
|
27
|
+
* Package versions for imports from npm, as name → version or range.
|
|
28
|
+
* A new object compiles again.
|
|
29
|
+
*/
|
|
30
|
+
versions?: Record<string, string>;
|
|
31
|
+
/**
|
|
32
|
+
* The other files of the project, as path → text.
|
|
33
|
+
* The text imports them with relative specifiers, like `./button.gjs`.
|
|
34
|
+
* A new object compiles again.
|
|
35
|
+
*/
|
|
36
|
+
files?: Record<string, string>;
|
|
26
37
|
}
|
|
27
38
|
|
|
28
39
|
export function Compiled(markdownText: Input | (() => Input)): CompileState;
|
|
@@ -64,6 +75,8 @@ export function Compiled(
|
|
|
64
75
|
let format: Format | undefined;
|
|
65
76
|
let flavor: string | undefined;
|
|
66
77
|
let args: Record<string, unknown> | undefined;
|
|
78
|
+
let versions: Record<string, string> | undefined;
|
|
79
|
+
let files: Record<string, string> | undefined;
|
|
67
80
|
|
|
68
81
|
if (typeof maybeFormatOrOptions === 'function') {
|
|
69
82
|
format = maybeFormatOrOptions();
|
|
@@ -73,6 +86,8 @@ export function Compiled(
|
|
|
73
86
|
format = maybeFormatOrOptions.format;
|
|
74
87
|
flavor = maybeFormatOrOptions.flavor;
|
|
75
88
|
args = maybeFormatOrOptions.args;
|
|
89
|
+
versions = maybeFormatOrOptions.versions;
|
|
90
|
+
files = maybeFormatOrOptions.files;
|
|
76
91
|
}
|
|
77
92
|
|
|
78
93
|
format ??= 'glimdown';
|
|
@@ -95,6 +110,8 @@ export function Compiled(
|
|
|
95
110
|
format,
|
|
96
111
|
flavor,
|
|
97
112
|
args,
|
|
113
|
+
versions,
|
|
114
|
+
files,
|
|
98
115
|
});
|
|
99
116
|
});
|
|
100
117
|
}
|
package/src/compile/compile.ts
CHANGED
|
@@ -21,6 +21,15 @@ interface Options {
|
|
|
21
21
|
* rendered component without recompiling.
|
|
22
22
|
*/
|
|
23
23
|
args?: Record<string, unknown>;
|
|
24
|
+
/**
|
|
25
|
+
* Package versions for imports from npm, as name → version or range.
|
|
26
|
+
*/
|
|
27
|
+
versions?: Record<string, string>;
|
|
28
|
+
/**
|
|
29
|
+
* The other files of the project, as path → text.
|
|
30
|
+
* The text imports them with relative specifiers, like `./button.gjs`.
|
|
31
|
+
*/
|
|
32
|
+
files?: Record<string, string>;
|
|
24
33
|
onSuccess?: (component: ComponentLike) => Promise<unknown> | unknown;
|
|
25
34
|
onError?: (error: string) => Promise<unknown> | unknown;
|
|
26
35
|
onCompileStart?: () => Promise<unknown> | unknown;
|
|
@@ -63,13 +72,6 @@ async function runTheCompiler({
|
|
|
63
72
|
await options?.onCompileStart?.();
|
|
64
73
|
await Promise.resolve();
|
|
65
74
|
|
|
66
|
-
if (!text) {
|
|
67
|
-
state[REJECT](new Error('No Input Document yet'));
|
|
68
|
-
await options?.onError?.('No Input Document yet');
|
|
69
|
-
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
75
|
let result: CompileResult;
|
|
74
76
|
|
|
75
77
|
// TODO: just use compile, eliminate all this branching
|
package/src/compile/state.ts
CHANGED
|
@@ -73,18 +73,3 @@ export class CompileState implements State {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
export class MissingTextState extends CompileState {}
|
|
76
|
-
|
|
77
|
-
export class CachedCompileState extends CompileState {
|
|
78
|
-
#resolvedPromise: Promise<ComponentLike>;
|
|
79
|
-
constructor(data: Data, component: ComponentLike) {
|
|
80
|
-
super(data);
|
|
81
|
-
|
|
82
|
-
this.component = component;
|
|
83
|
-
this.#resolvedPromise = Promise.resolve(component);
|
|
84
|
-
this.isReady = true;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
get promise() {
|
|
88
|
-
return this.#resolvedPromise;
|
|
89
|
-
}
|
|
90
|
-
}
|