ember-repl 7.1.2 → 7.2.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/services/compiler.d.ts +3 -0
- package/declarations/services/compiler.d.ts.map +1 -1
- package/declarations/services/known-modules.d.ts.map +1 -1
- package/dist/services/compiler.js +26 -6
- package/dist/services/compiler.js.map +1 -1
- package/dist/services/known-modules.js +5 -1
- package/dist/services/known-modules.js.map +1 -1
- package/package.json +2 -2
- package/src/services/compiler.ts +41 -9
- package/src/services/known-modules.ts +13 -8
|
@@ -1 +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,
|
|
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,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,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;;;;;IA4B1E;;;;;;;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"}
|
|
@@ -1 +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;
|
|
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;AA8HrD;;;GAGG;AACH,eAAO,MAAM,OAAO,GAAI,cAAc,SAAS,KAAG,SAMhD,CAAC"}
|
|
@@ -568,6 +568,27 @@ class CompilerService {
|
|
|
568
568
|
*/
|
|
569
569
|
setup = (extraModules = {}, options = {}) => {
|
|
570
570
|
const localModules = modules(extraModules);
|
|
571
|
+
const parentOwner = getOwner(this);
|
|
572
|
+
const owner = {
|
|
573
|
+
name: 'ember-repl owner',
|
|
574
|
+
parent: parentOwner,
|
|
575
|
+
/**
|
|
576
|
+
* @param {string} name
|
|
577
|
+
*/
|
|
578
|
+
lookup(name) {
|
|
579
|
+
if (!parentOwner) return;
|
|
580
|
+
return parentOwner.lookup(name);
|
|
581
|
+
},
|
|
582
|
+
/**
|
|
583
|
+
* @param {string} name
|
|
584
|
+
*/
|
|
585
|
+
resolveRegistration(name) {
|
|
586
|
+
if (!parentOwner) return;
|
|
587
|
+
|
|
588
|
+
// @ts-expect-error
|
|
589
|
+
return parentOwner.resolveRegistration(name);
|
|
590
|
+
}
|
|
591
|
+
};
|
|
571
592
|
this.#compiler = new Compiler({
|
|
572
593
|
logging: location.search.includes('debug'),
|
|
573
594
|
resolve: {
|
|
@@ -587,13 +608,11 @@ class CompilerService {
|
|
|
587
608
|
options: {
|
|
588
609
|
...options,
|
|
589
610
|
gjs: {
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
lookup: () => {},
|
|
593
|
-
resolveRegistration: () => {}
|
|
594
|
-
}
|
|
611
|
+
owner,
|
|
612
|
+
...(options.gjs ?? {})
|
|
595
613
|
},
|
|
596
614
|
gmd: {
|
|
615
|
+
owner,
|
|
597
616
|
...(options.gmd ?? {}),
|
|
598
617
|
scope: {
|
|
599
618
|
...standardScope,
|
|
@@ -617,6 +636,7 @@ class CompilerService {
|
|
|
617
636
|
},
|
|
618
637
|
hbs: {
|
|
619
638
|
ember: {
|
|
639
|
+
owner,
|
|
620
640
|
...(options.hbs ?? {}),
|
|
621
641
|
scope: {
|
|
622
642
|
...standardScope,
|
|
@@ -666,12 +686,12 @@ class CompilerService {
|
|
|
666
686
|
const name = nameFor(text);
|
|
667
687
|
let component;
|
|
668
688
|
let error;
|
|
689
|
+
options ||= {};
|
|
669
690
|
try {
|
|
670
691
|
if (ext === 'hbs') {
|
|
671
692
|
/**
|
|
672
693
|
* Are there other hbs-using frameworks?
|
|
673
694
|
*/
|
|
674
|
-
options ||= {};
|
|
675
695
|
options.flavor = 'ember';
|
|
676
696
|
}
|
|
677
697
|
const result = await this.#compile(ext, text, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compiler.js","sources":["../../../../node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/lib/index.js","../../../../node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/color.js","../../../../node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/index.js","../../../../node_modules/.pnpm/unist-util-visit@5.0.0/node_modules/unist-util-visit/lib/index.js","../../src/services/compiler.ts"],"sourcesContent":["/**\n * @import {Node, Parent} from 'unist'\n */\n\n/**\n * @template Fn\n * @template Fallback\n * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate\n */\n\n/**\n * @callback Check\n * Check that an arbitrary value is a node.\n * @param {unknown} this\n * The given context.\n * @param {unknown} [node]\n * Anything (typically a node).\n * @param {number | null | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | null | undefined} [parent]\n * The node’s parent.\n * @returns {boolean}\n * Whether this is a node and passes a test.\n *\n * @typedef {Record<string, unknown> | Node} Props\n * Object to check for equivalence.\n *\n * Note: `Node` is included as it is common but is not indexable.\n *\n * @typedef {Array<Props | TestFunction | string> | ReadonlyArray<Props | TestFunction | string> | Props | TestFunction | string | null | undefined} Test\n * Check for an arbitrary node.\n *\n * @callback TestFunction\n * Check if a node passes a test.\n * @param {unknown} this\n * The given context.\n * @param {Node} node\n * A node.\n * @param {number | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | undefined} [parent]\n * The node’s parent.\n * @returns {boolean | undefined | void}\n * Whether this node passes the test.\n *\n * Note: `void` is included until TS sees no return as `undefined`.\n */\n\n/**\n * Check if `node` is a `Node` and whether it passes the given test.\n *\n * @param {unknown} node\n * Thing to check, typically `Node`.\n * @param {Test} test\n * A check for a specific node.\n * @param {number | null | undefined} index\n * The node’s position in its parent.\n * @param {Parent | null | undefined} parent\n * The node’s parent.\n * @param {unknown} context\n * Context object (`this`) to pass to `test` functions.\n * @returns {boolean}\n * Whether `node` is a node and passes a test.\n */\nexport const is =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * (<Condition extends ReadonlyArray<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &\n * (<Condition extends Array<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &\n * (<Condition extends string>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * (<Condition extends Props>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * (<Condition extends TestFunction>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &\n * ((node?: null | undefined) => false) &\n * ((node: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((node: unknown, test?: Test, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => boolean)\n * )}\n */\n (\n /**\n * @param {unknown} [node]\n * @param {Test} [test]\n * @param {number | null | undefined} [index]\n * @param {Parent | null | undefined} [parent]\n * @param {unknown} [context]\n * @returns {boolean}\n */\n // eslint-disable-next-line max-params\n function (node, test, index, parent, context) {\n const check = convert(test)\n\n if (\n index !== undefined &&\n index !== null &&\n (typeof index !== 'number' ||\n index < 0 ||\n index === Number.POSITIVE_INFINITY)\n ) {\n throw new Error('Expected positive finite index')\n }\n\n if (\n parent !== undefined &&\n parent !== null &&\n (!is(parent) || !parent.children)\n ) {\n throw new Error('Expected parent node')\n }\n\n if (\n (parent === undefined || parent === null) !==\n (index === undefined || index === null)\n ) {\n throw new Error('Expected both parent and index')\n }\n\n return looksLikeANode(node)\n ? check.call(context, node, index, parent)\n : false\n }\n )\n\n/**\n * Generate an assertion from a test.\n *\n * Useful if you’re going to test many nodes, for example when creating a\n * utility where something else passes a compatible test.\n *\n * The created function is a bit faster because it expects valid input only:\n * a `node`, `index`, and `parent`.\n *\n * @param {Test} test\n * * when nullish, checks if `node` is a `Node`.\n * * when `string`, works like passing `(node) => node.type === test`.\n * * when `function` checks if function passed the node is true.\n * * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.\n * * when `array`, checks if any one of the subtests pass.\n * @returns {Check}\n * An assertion.\n */\nexport const convert =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &\n * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((test?: Test) => Check)\n * )}\n */\n (\n /**\n * @param {Test} [test]\n * @returns {Check}\n */\n function (test) {\n if (test === null || test === undefined) {\n return ok\n }\n\n if (typeof test === 'function') {\n return castFactory(test)\n }\n\n if (typeof test === 'object') {\n return Array.isArray(test)\n ? anyFactory(test)\n : // Cast because `ReadonlyArray` goes into the above but `isArray`\n // narrows to `Array`.\n propertiesFactory(/** @type {Props} */ (test))\n }\n\n if (typeof test === 'string') {\n return typeFactory(test)\n }\n\n throw new Error('Expected function, string, or object as test')\n }\n )\n\n/**\n * @param {Array<Props | TestFunction | string>} tests\n * @returns {Check}\n */\nfunction anyFactory(tests) {\n /** @type {Array<Check>} */\n const checks = []\n let index = -1\n\n while (++index < tests.length) {\n checks[index] = convert(tests[index])\n }\n\n return castFactory(any)\n\n /**\n * @this {unknown}\n * @type {TestFunction}\n */\n function any(...parameters) {\n let index = -1\n\n while (++index < checks.length) {\n if (checks[index].apply(this, parameters)) return true\n }\n\n return false\n }\n}\n\n/**\n * Turn an object into a test for a node with a certain fields.\n *\n * @param {Props} check\n * @returns {Check}\n */\nfunction propertiesFactory(check) {\n const checkAsRecord = /** @type {Record<string, unknown>} */ (check)\n\n return castFactory(all)\n\n /**\n * @param {Node} node\n * @returns {boolean}\n */\n function all(node) {\n const nodeAsRecord = /** @type {Record<string, unknown>} */ (\n /** @type {unknown} */ (node)\n )\n\n /** @type {string} */\n let key\n\n for (key in check) {\n if (nodeAsRecord[key] !== checkAsRecord[key]) return false\n }\n\n return true\n }\n}\n\n/**\n * Turn a string into a test for a node with a certain type.\n *\n * @param {string} check\n * @returns {Check}\n */\nfunction typeFactory(check) {\n return castFactory(type)\n\n /**\n * @param {Node} node\n */\n function type(node) {\n return node && node.type === check\n }\n}\n\n/**\n * Turn a custom test into a test for a node that passes that test.\n *\n * @param {TestFunction} testFunction\n * @returns {Check}\n */\nfunction castFactory(testFunction) {\n return check\n\n /**\n * @this {unknown}\n * @type {Check}\n */\n function check(value, index, parent) {\n return Boolean(\n looksLikeANode(value) &&\n testFunction.call(\n this,\n value,\n typeof index === 'number' ? index : undefined,\n parent || undefined\n )\n )\n }\n}\n\nfunction ok() {\n return true\n}\n\n/**\n * @param {unknown} value\n * @returns {value is Node}\n */\nfunction looksLikeANode(value) {\n return value !== null && typeof value === 'object' && 'type' in value\n}\n","/**\n * @param {string} d\n * @returns {string}\n */\nexport function color(d) {\n return d\n}\n","/**\n * @import {Node as UnistNode, Parent as UnistParent} from 'unist'\n */\n\n/**\n * @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test\n * Test from `unist-util-is`.\n *\n * Note: we have remove and add `undefined`, because otherwise when generating\n * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n * which doesn’t work when publishing on npm.\n */\n\n/**\n * @typedef {(\n * Fn extends (value: any) => value is infer Thing\n * ? Thing\n * : Fallback\n * )} Predicate\n * Get the value of a type guard `Fn`.\n * @template Fn\n * Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n * Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n * Check extends null | undefined // No test.\n * ? Value\n * : Value extends {type: Check} // String (type) test.\n * ? Value\n * : Value extends Check // Partial test.\n * ? Value\n * : Check extends Function // Function test.\n * ? Predicate<Check, Value> extends Value\n * ? Predicate<Check, Value>\n * : never\n * : never // Some other test?\n * )} MatchesOne\n * Check whether a node matches a primitive check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n * Check extends ReadonlyArray<infer T>\n * ? MatchesOne<Value, T>\n * : Check extends Array<infer T>\n * ? MatchesOne<Value, T>\n * : MatchesOne<Value, Check>\n * )} Matches\n * Check whether a node matches a check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint\n * Number; capped reasonably.\n */\n\n/**\n * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment\n * Increment a number in the type system.\n * @template {Uint} [I=0]\n * Index.\n */\n\n/**\n * @typedef {(\n * Node extends UnistParent\n * ? Node extends {children: Array<infer Children>}\n * ? Child extends Children ? Node : never\n * : never\n * : never\n * )} InternalParent\n * Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {InternalParent<InclusiveDescendant<Tree>, Child>} Parent\n * Collect nodes in `Tree` that can be parents of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Depth extends Max\n * ? never\n * :\n * | InternalParent<Node, Child>\n * | InternalAncestor<Node, InternalParent<Node, Child>, Max, Increment<Depth>>\n * )} InternalAncestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {InternalAncestor<InclusiveDescendant<Tree>, Child>} Ancestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Tree extends UnistParent\n * ? Depth extends Max\n * ? Tree\n * : Tree | InclusiveDescendant<Tree['children'][number], Max, Increment<Depth>>\n * : Tree\n * )} InclusiveDescendant\n * Collect all (inclusive) descendants of `Tree`.\n *\n * > 👉 **Note**: for performance reasons, this seems to be the fastest way to\n * > recurse without actually running into an infinite loop, which the\n * > previous version did.\n * >\n * > Practically, a max of `2` is typically enough assuming a `Root` is\n * > passed, but it doesn’t improve performance.\n * > It gets higher with `List > ListItem > Table > TableRow > TableCell`.\n * > Using up to `10` doesn’t hurt or help either.\n * @template {UnistNode} Tree\n * Tree type.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {'skip' | boolean} Action\n * Union of the action types.\n *\n * @typedef {number} Index\n * Move to the sibling at `index` next (after node itself is completely\n * traversed).\n *\n * Useful if mutating the tree, such as removing the node the visitor is\n * currently on, or any of its previous siblings.\n * Results less than 0 or greater than or equal to `children.length` stop\n * traversing the parent.\n *\n * @typedef {[(Action | null | undefined | void)?, (Index | null | undefined)?]} ActionTuple\n * List with one or two values, the first an action, the second an index.\n *\n * @typedef {Action | ActionTuple | Index | null | undefined | void} VisitorResult\n * Any value that can be returned from a visitor.\n */\n\n/**\n * @callback Visitor\n * Handle a node (matching `test`, if given).\n *\n * Visitors are free to transform `node`.\n * They can also transform the parent of node (the last of `ancestors`).\n *\n * Replacing `node` itself, if `SKIP` is not returned, still causes its\n * descendants to be walked (which is a bug).\n *\n * When adding or removing previous siblings of `node` (or next siblings, in\n * case of reverse), the `Visitor` should return a new `Index` to specify the\n * sibling to traverse after `node` is traversed.\n * Adding or removing next siblings of `node` (or previous siblings, in case\n * of reverse) is handled as expected without needing to return a new `Index`.\n *\n * Removing the children property of an ancestor still results in them being\n * traversed.\n * @param {Visited} node\n * Found node.\n * @param {Array<VisitedParents>} ancestors\n * Ancestors of `node`.\n * @returns {VisitorResult}\n * What to do next.\n *\n * An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n * An `Action` is treated as a tuple of `[Action]`.\n *\n * Passing a tuple back only makes sense if the `Action` is `SKIP`.\n * When the `Action` is `EXIT`, that action can be returned.\n * When the `Action` is `CONTINUE`, `Index` can be returned.\n * @template {UnistNode} [Visited=UnistNode]\n * Visited node type.\n * @template {UnistParent} [VisitedParents=UnistParent]\n * Ancestor type.\n */\n\n/**\n * @typedef {Visitor<Matches<InclusiveDescendant<Tree>, Check>, Ancestor<Tree, Matches<InclusiveDescendant<Tree>, Check>>>} BuildVisitor\n * Build a typed `Visitor` function from a tree and a test.\n *\n * It will infer which values are passed as `node` and which as `parents`.\n * @template {UnistNode} [Tree=UnistNode]\n * Tree type.\n * @template {Test} [Check=Test]\n * Test type.\n */\n\nimport {convert} from 'unist-util-is'\nimport {color} from 'unist-util-visit-parents/do-not-use-color'\n\n/** @type {Readonly<ActionTuple>} */\nconst empty = []\n\n/**\n * Continue traversing as normal.\n */\nexport const CONTINUE = true\n\n/**\n * Stop traversing immediately.\n */\nexport const EXIT = false\n\n/**\n * Do not traverse this node’s children.\n */\nexport const SKIP = 'skip'\n\n/**\n * Visit nodes, with ancestral information.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @overload\n * @param {Tree} tree\n * @param {Check} check\n * @param {BuildVisitor<Tree, Check>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @overload\n * @param {Tree} tree\n * @param {BuildVisitor<Tree>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @param {UnistNode} tree\n * Tree to traverse.\n * @param {Visitor | Test} test\n * `unist-util-is`-compatible test\n * @param {Visitor | boolean | null | undefined} [visitor]\n * Handle each node.\n * @param {boolean | null | undefined} [reverse]\n * Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns {undefined}\n * Nothing.\n *\n * @template {UnistNode} Tree\n * Node type.\n * @template {Test} Check\n * `unist-util-is`-compatible test.\n */\nexport function visitParents(tree, test, visitor, reverse) {\n /** @type {Test} */\n let check\n\n if (typeof test === 'function' && typeof visitor !== 'function') {\n reverse = visitor\n // @ts-expect-error no visitor given, so `visitor` is test.\n visitor = test\n } else {\n // @ts-expect-error visitor given, so `test` isn’t a visitor.\n check = test\n }\n\n const is = convert(check)\n const step = reverse ? -1 : 1\n\n factory(tree, undefined, [])()\n\n /**\n * @param {UnistNode} node\n * @param {number | undefined} index\n * @param {Array<UnistParent>} parents\n */\n function factory(node, index, parents) {\n const value = /** @type {Record<string, unknown>} */ (\n node && typeof node === 'object' ? node : {}\n )\n\n if (typeof value.type === 'string') {\n const name =\n // `hast`\n typeof value.tagName === 'string'\n ? value.tagName\n : // `xast`\n typeof value.name === 'string'\n ? value.name\n : undefined\n\n Object.defineProperty(visit, 'name', {\n value:\n 'node (' + color(node.type + (name ? '<' + name + '>' : '')) + ')'\n })\n }\n\n return visit\n\n function visit() {\n /** @type {Readonly<ActionTuple>} */\n let result = empty\n /** @type {Readonly<ActionTuple>} */\n let subresult\n /** @type {number} */\n let offset\n /** @type {Array<UnistParent>} */\n let grandparents\n\n if (!test || is(node, index, parents[parents.length - 1] || undefined)) {\n // @ts-expect-error: `visitor` is now a visitor.\n result = toResult(visitor(node, parents))\n\n if (result[0] === EXIT) {\n return result\n }\n }\n\n if ('children' in node && node.children) {\n const nodeAsParent = /** @type {UnistParent} */ (node)\n\n if (nodeAsParent.children && result[0] !== SKIP) {\n offset = (reverse ? nodeAsParent.children.length : -1) + step\n grandparents = parents.concat(nodeAsParent)\n\n while (offset > -1 && offset < nodeAsParent.children.length) {\n const child = nodeAsParent.children[offset]\n\n subresult = factory(child, offset, grandparents)()\n\n if (subresult[0] === EXIT) {\n return subresult\n }\n\n offset =\n typeof subresult[1] === 'number' ? subresult[1] : offset + step\n }\n }\n }\n\n return result\n }\n }\n}\n\n/**\n * Turn a return value into a clean result.\n *\n * @param {VisitorResult} value\n * Valid return values from visitors.\n * @returns {Readonly<ActionTuple>}\n * Clean result.\n */\nfunction toResult(value) {\n if (Array.isArray(value)) {\n return value\n }\n\n if (typeof value === 'number') {\n return [CONTINUE, value]\n }\n\n return value === null || value === undefined ? empty : [value]\n}\n","/**\n * @typedef {import('unist').Node} UnistNode\n * @typedef {import('unist').Parent} UnistParent\n * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult\n */\n\n/**\n * @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test\n * Test from `unist-util-is`.\n *\n * Note: we have remove and add `undefined`, because otherwise when generating\n * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n * which doesn’t work when publishing on npm.\n */\n\n// To do: use types from `unist-util-visit-parents` when it’s released.\n\n/**\n * @typedef {(\n * Fn extends (value: any) => value is infer Thing\n * ? Thing\n * : Fallback\n * )} Predicate\n * Get the value of a type guard `Fn`.\n * @template Fn\n * Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n * Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n * Check extends null | undefined // No test.\n * ? Value\n * : Value extends {type: Check} // String (type) test.\n * ? Value\n * : Value extends Check // Partial test.\n * ? Value\n * : Check extends Function // Function test.\n * ? Predicate<Check, Value> extends Value\n * ? Predicate<Check, Value>\n * : never\n * : never // Some other test?\n * )} MatchesOne\n * Check whether a node matches a primitive check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n * Check extends Array<any>\n * ? MatchesOne<Value, Check[keyof Check]>\n * : MatchesOne<Value, Check>\n * )} Matches\n * Check whether a node matches a check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint\n * Number; capped reasonably.\n */\n\n/**\n * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment\n * Increment a number in the type system.\n * @template {Uint} [I=0]\n * Index.\n */\n\n/**\n * @typedef {(\n * Node extends UnistParent\n * ? Node extends {children: Array<infer Children>}\n * ? Child extends Children ? Node : never\n * : never\n * : never\n * )} InternalParent\n * Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {InternalParent<InclusiveDescendant<Tree>, Child>} Parent\n * Collect nodes in `Tree` that can be parents of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Depth extends Max\n * ? never\n * :\n * | InternalParent<Node, Child>\n * | InternalAncestor<Node, InternalParent<Node, Child>, Max, Increment<Depth>>\n * )} InternalAncestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {(\n * Tree extends UnistParent\n * ? Depth extends Max\n * ? Tree\n * : Tree | InclusiveDescendant<Tree['children'][number], Max, Increment<Depth>>\n * : Tree\n * )} InclusiveDescendant\n * Collect all (inclusive) descendants of `Tree`.\n *\n * > 👉 **Note**: for performance reasons, this seems to be the fastest way to\n * > recurse without actually running into an infinite loop, which the\n * > previous version did.\n * >\n * > Practically, a max of `2` is typically enough assuming a `Root` is\n * > passed, but it doesn’t improve performance.\n * > It gets higher with `List > ListItem > Table > TableRow > TableCell`.\n * > Using up to `10` doesn’t hurt or help either.\n * @template {UnistNode} Tree\n * Tree type.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @callback Visitor\n * Handle a node (matching `test`, if given).\n *\n * Visitors are free to transform `node`.\n * They can also transform `parent`.\n *\n * Replacing `node` itself, if `SKIP` is not returned, still causes its\n * descendants to be walked (which is a bug).\n *\n * When adding or removing previous siblings of `node` (or next siblings, in\n * case of reverse), the `Visitor` should return a new `Index` to specify the\n * sibling to traverse after `node` is traversed.\n * Adding or removing next siblings of `node` (or previous siblings, in case\n * of reverse) is handled as expected without needing to return a new `Index`.\n *\n * Removing the children property of `parent` still results in them being\n * traversed.\n * @param {Visited} node\n * Found node.\n * @param {Visited extends UnistNode ? number | undefined : never} index\n * Index of `node` in `parent`.\n * @param {Ancestor extends UnistParent ? Ancestor | undefined : never} parent\n * Parent of `node`.\n * @returns {VisitorResult}\n * What to do next.\n *\n * An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n * An `Action` is treated as a tuple of `[Action]`.\n *\n * Passing a tuple back only makes sense if the `Action` is `SKIP`.\n * When the `Action` is `EXIT`, that action can be returned.\n * When the `Action` is `CONTINUE`, `Index` can be returned.\n * @template {UnistNode} [Visited=UnistNode]\n * Visited node type.\n * @template {UnistParent} [Ancestor=UnistParent]\n * Ancestor type.\n */\n\n/**\n * @typedef {Visitor<Visited, Parent<Ancestor, Visited>>} BuildVisitorFromMatch\n * Build a typed `Visitor` function from a node and all possible parents.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} Visited\n * Node type.\n * @template {UnistParent} Ancestor\n * Parent type.\n */\n\n/**\n * @typedef {(\n * BuildVisitorFromMatch<\n * Matches<Descendant, Check>,\n * Extract<Descendant, UnistParent>\n * >\n * )} BuildVisitorFromDescendants\n * Build a typed `Visitor` function from a list of descendants and a test.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} Descendant\n * Node type.\n * @template {Test} Check\n * Test type.\n */\n\n/**\n * @typedef {(\n * BuildVisitorFromDescendants<\n * InclusiveDescendant<Tree>,\n * Check\n * >\n * )} BuildVisitor\n * Build a typed `Visitor` function from a tree and a test.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} [Tree=UnistNode]\n * Node type.\n * @template {Test} [Check=Test]\n * Test type.\n */\n\nimport {visitParents} from 'unist-util-visit-parents'\n\nexport {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'\n\n/**\n * Visit nodes.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @overload\n * @param {Tree} tree\n * @param {Check} check\n * @param {BuildVisitor<Tree, Check>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @overload\n * @param {Tree} tree\n * @param {BuildVisitor<Tree>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @param {UnistNode} tree\n * Tree to traverse.\n * @param {Visitor | Test} testOrVisitor\n * `unist-util-is`-compatible test (optional, omit to pass a visitor).\n * @param {Visitor | boolean | null | undefined} [visitorOrReverse]\n * Handle each node (when test is omitted, pass `reverse`).\n * @param {boolean | null | undefined} [maybeReverse=false]\n * Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns {undefined}\n * Nothing.\n *\n * @template {UnistNode} Tree\n * Node type.\n * @template {Test} Check\n * `unist-util-is`-compatible test.\n */\nexport function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {\n /** @type {boolean | null | undefined} */\n let reverse\n /** @type {Test} */\n let test\n /** @type {Visitor} */\n let visitor\n\n if (\n typeof testOrVisitor === 'function' &&\n typeof visitorOrReverse !== 'function'\n ) {\n test = undefined\n visitor = testOrVisitor\n reverse = visitorOrReverse\n } else {\n // @ts-expect-error: assume the overload with test was given.\n test = testOrVisitor\n // @ts-expect-error: assume the overload with test was given.\n visitor = visitorOrReverse\n reverse = maybeReverse\n }\n\n visitParents(tree, test, overload, reverse)\n\n /**\n * @param {UnistNode} node\n * @param {Array<UnistParent>} parents\n */\n function overload(node, parents) {\n const parent = parents[parents.length - 1]\n const index = parent ? parent.children.indexOf(node) : undefined\n return visitor(node, index, parent)\n }\n}\n","/* eslint-disable getter-return */\n \n// @ts-ignore\nimport { tracked } from '@glimmer/tracking';\nimport { setComponentTemplate } from '@ember/component';\nimport templateOnly from '@ember/component/template-only';\nimport { assert } from '@ember/debug';\nimport { registerDestructor } from '@ember/destroyable';\nimport { array, concat, fn, get, hash } from '@ember/helper';\nimport { on } from '@ember/modifier';\nimport { getOwner } from '@ember/owner';\nimport { precompileTemplate } from '@ember/template-compilation';\nimport { waitFor } from '@ember/test-waiters';\n\nimport { createStore } from 'ember-primitives/store';\nimport { resource } from 'ember-resources';\nimport { Compiler } from 'repl-sdk';\nimport { visit } from 'unist-util-visit';\n\nimport { nameFor } from '../compile/utils.ts';\nimport { modules } from './known-modules.ts';\n\nimport type { CompileResult, ModuleMap } from '../compile/types.ts';\nimport type { ComponentLike } from '@glint/template';\nimport type { EditorView } from 'codemirror';\nimport type { ErrorMessage, InfoMessage, Message } from 'repl-sdk';\n\nexport function getCompiler(context: object) {\n const owner = getOwner(context) ?? context;\n\n assert(`Missing owner. Cannot use ember-repl's compiler without an owner.`, owner);\n\n return createStore(owner, CompilerService);\n}\n\n/**\n * Old way to make static components, because\n * https://github.com/emberjs/ember.js/issues/20913\n *\n * The runtime compiler doesn't allow you to catch compiler errors.\n * This particular component doesn't need to be runtime anyway.\n */\nfunction rendersElement(x: { element: Element; destroy: () => void }): ComponentLike {\n const render = resource(({ on }) => {\n on.cleanup(() => {\n x.destroy();\n });\n\n return x.element;\n });\n\n return setComponentTemplate(\n precompileTemplate(`{{render}}`, {\n strictMode: true,\n scope: () => ({ render }),\n }),\n templateOnly()\n ) as ComponentLike;\n}\n\ninterface CompilerOptions {\n hbs?: {\n scope?: Record<string, unknown>;\n };\n md?: {\n remarkPlugins?: unknown[];\n rehypePlugins?: unknown[];\n };\n gmd?: {\n scope?: Record<string, unknown>;\n remarkPlugins?: unknown[];\n rehypePlugins?: unknown[];\n };\n}\n\n/**\n * Standard for the REPL, not real apps.\n * HBS isn't used in real apps (that are fully up to date)\n */\nconst standardScope = {\n // These are only added here because it's convenient for hbs\n // to have them\n array,\n concat,\n fn,\n get,\n hash,\n on,\n // The default available scope for gjs:\n //\n // We don't use gjs transpilation here, because hbs transpilation\n // doesn't need to go through the babel infra, so it's faster this way,\n // even though it's more \"verbose\" and could get out of sync from the\n // implementations / source-of-truth.\n //\n // https://github.com/emberjs/babel-plugin-ember-template-compilation/blob/main/src/scope-locals.ts#L16\n //\n // ////////////////\n // namespaces\n // ////////////////\n // TC39\n globalThis,\n Atomics,\n JSON,\n Math,\n Reflect,\n // WHATWG\n localStorage,\n sessionStorage,\n URL,\n // ////////////////\n // functions / utilities\n // ////////////////\n // TC39\n isNaN,\n isFinite,\n parseInt,\n parseFloat,\n decodeURI,\n decodeURIComponent,\n encodeURI,\n encodeURIComponent,\n // WHATWG\n postMessage,\n structuredClone,\n // ////////////////\n // new-less Constructors (still functions)\n // ////////////////\n // TC39\n Array, // different behavior from (array)\n BigInt,\n Boolean,\n Date,\n Number,\n Object, // different behavior from (hash)\n String,\n // ////////////////\n // Values\n // ////////////////\n // TC39\n Infinity,\n NaN,\n // WHATWG\n isSecureContext,\n};\n\nexport default class CompilerService {\n #compiler: Compiler | undefined;\n\n constructor() {\n const global = getGlobal();\n\n global.REPL ||= {};\n\n if (global.REPL.compiler) {\n return global.REPL.compiler;\n }\n\n global.REPL.compiler = this;\n\n registerDestructor(this, () => {\n delete global.REPL?.compiler;\n });\n }\n\n @tracked messages: Message[] = [];\n\n get lastInfo(): InfoMessage | undefined {\n const m = this.messages;\n\n for (let i = m.length - 1; i >= 0; i--) {\n const current = m[i];\n\n if (current?.type === 'info') return current;\n }\n }\n\n get lastError(): ErrorMessage | undefined {\n const m = this.messages;\n\n for (let i = m.length - 1; i >= 0; i--) {\n const current = m[i];\n\n if (current?.type === 'error') return current;\n }\n }\n\n /**\n * @param {ModuleMap} [ extraModules ]: map of import paths to modules.\n * These modules are useful if you need to document a library or a any design system or a styleguide or\n * if there are additional modules that could be imported in the passed `code`.\n * @param {object} [options] optional compiler options for each format/flavor\n *\n * Later on, imports that are not present by default (ember/glimmer) or that\n * are not provided by extraModules will be searched on npm to see if a package\n * needs to be downloaded before running the `code` / invoking the component\n */\n setup = (extraModules: ModuleMap = {}, options: CompilerOptions = {}) => {\n const localModules = modules(extraModules);\n\n this.#compiler = new Compiler({\n logging: location.search.includes('debug'),\n resolve: {\n ...localModules,\n },\n on: {\n log: (type: Message['type'], message: string) => {\n this.messages.push({ type, message });\n // Waiting on better array primitive\n // eslint-disable-next-line no-self-assign\n this.messages = this.messages;\n },\n },\n options: {\n ...options,\n gjs: {\n // owner: getOwner(this),\n owner: {\n lookup: () => {},\n resolveRegistration: () => {},\n },\n },\n gmd: {\n ...(options.gmd ?? {}),\n scope: {\n ...standardScope,\n ...(options.gmd?.scope ?? {}),\n },\n remarkPlugins: [\n function defaultHbsToEmber() {\n return function transformer(tree: any) {\n visit(tree, 'code', (node) => {\n if (node.lang === 'hbs') {\n if (!node.meta) {\n node.meta = 'ember';\n } else {\n node.meta += ' ember';\n }\n\n return node;\n }\n });\n\n return tree;\n };\n },\n ...(options.gmd?.remarkPlugins ?? []),\n ],\n },\n hbs: {\n ember: {\n ...(options.hbs ?? {}),\n scope: {\n ...standardScope,\n ...(options.hbs?.scope ?? {}),\n },\n },\n },\n },\n });\n };\n\n get compiler(): Compiler {\n /**\n * This is useful for our own testing.\n * not sure if this would be a footgun for consumers' usage\n */\n if (!this.#compiler) {\n this.setup();\n }\n\n assert(\n `Expected a compiled to be setup on the compiler service. Use \\`compiler.setup()\\` first.`,\n this.#compiler\n );\n\n return this.#compiler;\n }\n\n async createEditor(\n element: HTMLElement,\n options: {\n text: string | null | undefined;\n format: string;\n handleUpdate: (text: string) => void;\n extensions?: unknown[];\n }\n ): Promise<{\n view: EditorView;\n setText: (text: string, format: string) => Promise<void>;\n setFormat: (format: string) => Promise<void>;\n }> {\n return this.compiler.createEditor(element, options);\n }\n\n async #compile(ext: string, text: string, options?: Record<string, unknown>) {\n /**\n * Protect from accidental backtracking-render assertions\n * (infinite loop protection)\n *\n * This function doesn't ready any tracked data, so we don't need to\n * worry about invalidation or anything.\n */\n await Promise.resolve();\n\n this.messages = [];\n\n return this.compiler.compile(ext, text, options ?? {});\n }\n\n /**\n * @public\n *\n * Defers to the underlying repl-SDK and gives us a component we can render.\n *\n * @param {string} ext the ext/format to be compiled\n * @param {string} text the code to be compiled using the configured compiler for the ext\n */\n @waitFor\n async compile(ext: string, text: string, options?: Record<string, unknown>) {\n const name = nameFor(text);\n let component: undefined | ComponentLike;\n let error: undefined | Error;\n\n try {\n if (ext === 'hbs') {\n /**\n * Are there other hbs-using frameworks?\n */\n options ||= {};\n options.flavor = 'ember';\n }\n\n const result = await this.#compile(ext, text, options);\n\n component = rendersElement(result);\n } catch (e) {\n // Put a breakpoint here to debug\n // debugger;\n console.error(e);\n error = e as Error | undefined;\n }\n\n return { name, component, error };\n }\n\n /**\n * @public\n *\n * Transpiles GlimmerJS (*.gjs) formatted text into and evaluates as a JS Module.\n * The returned component can be invoked explicitly in the consuming project.\n *\n * @param {string} code the code to be compiled\n */\n compileGJS(code: string): Promise<CompileResult> {\n return this.compile('gjs', code);\n }\n\n /**\n * compile a template with an empty scope\n * to use components, helpers, etc, you will need to compile with JS\n *\n * (templates alone do not have a way to import / define complex structures)\n */\n @waitFor\n async compileHBS(\n source: string,\n options: {\n /**\n * Used for debug viewing\n */\n moduleName?: string;\n /**\n * Additional values to include in hbs scope.\n * This is a _strict mode_ hbs component.\n */\n scope?: Record<string, unknown>;\n } = {}\n ): Promise<CompileResult> {\n return this.compile('hbs', source, options);\n }\n\n @waitFor\n compileMD(\n source: string,\n options?: {\n remarkPlugins?: unknown[];\n rehypePlugins?: unknown[];\n }\n ): Promise<CompileResult> {\n return this.compile('md', source, options);\n }\n}\n\nfunction getGlobal() {\n return globalThis as {\n REPL?: {\n compiler?: CompilerService;\n };\n };\n}\n"],"names":["convert","test","undefined","ok","castFactory","Array","isArray","anyFactory","propertiesFactory","typeFactory","Error","tests","checks","index","length","any","parameters","apply","check","checkAsRecord","all","node","nodeAsRecord","key","type","testFunction","value","parent","Boolean","looksLikeANode","call","color","d","empty","CONTINUE","EXIT","SKIP","visitParents","tree","visitor","reverse","is","step","factory","parents","name","tagName","Object","defineProperty","visit","result","subresult","offset","grandparents","toResult","children","nodeAsParent","concat","child","testOrVisitor","visitorOrReverse","maybeReverse","overload","indexOf","getCompiler","context","owner","getOwner","assert","createStore","CompilerService","rendersElement","x","render","resource","on","cleanup","destroy","element","setComponentTemplate","precompileTemplate","strictMode","scope","templateOnly","standardScope","array","fn","get","hash","globalThis","Atomics","JSON","Math","Reflect","localStorage","sessionStorage","URL","isNaN","isFinite","parseInt","parseFloat","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","postMessage","structuredClone","BigInt","Date","Number","String","Infinity","NaN","isSecureContext","constructor","global","getGlobal","REPL","compiler","registerDestructor","g","prototype","tracked","i","lastInfo","m","messages","current","lastError","setup","extraModules","options","localModules","modules","Compiler","logging","location","search","includes","resolve","log","message","push","gjs","lookup","resolveRegistration","gmd","remarkPlugins","defaultHbsToEmber","transformer","lang","meta","hbs","ember","createEditor","#compile","ext","text","Promise","compile","nameFor","component","error","flavor","e","console","n","waitFor","compileGJS","code","compileHBS","source","compileMD"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA;AACA;;;AAwHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,OAAO;AAClB;AACA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEI;AACJ;AACA;AACA;AACI,UAAUC,IAAI,EAAE;AACd,EAAA,IAAIA,IAAI,KAAK,IAAI,IAAIA,IAAI,KAAKC,SAAS,EAAE;AACvC,IAAA,OAAOC,EAAE;AACX,EAAA;AAEA,EAAA,IAAI,OAAOF,IAAI,KAAK,UAAU,EAAE;IAC9B,OAAOG,WAAW,CAACH,IAAI,CAAC;AAC1B,EAAA;AAEA,EAAA,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAOI,KAAK,CAACC,OAAO,CAACL,IAAI,CAAC,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MAAc,EACdxC,OAGC,EACuB;IACxB,OAAO,IAAI,CAAC4B,OAAO,CAAC,IAAI,EAAEY,MAAM,EAAExC,OAAO,CAAC;AAC5C,EAAA;AAAC,EAAA;IAAAmC,CAAA,CAAA,IAAA,CAAA7C,SAAA,EAAA,WAAA,EAAA,CATA8C,OAAO,CAAA,CAAA;AAAA;AAUV;AAEA,SAASnD,SAASA,GAAG;AACnB,EAAA,OAAO3B,UAAU;AAKnB;;;;","x_google_ignoreList":[0,1,2,3]}
|
|
1
|
+
{"version":3,"file":"compiler.js","sources":["../../../../node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/lib/index.js","../../../../node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/color.js","../../../../node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/lib/index.js","../../../../node_modules/.pnpm/unist-util-visit@5.0.0/node_modules/unist-util-visit/lib/index.js","../../src/services/compiler.ts"],"sourcesContent":["/**\n * @import {Node, Parent} from 'unist'\n */\n\n/**\n * @template Fn\n * @template Fallback\n * @typedef {Fn extends (value: any) => value is infer Thing ? Thing : Fallback} Predicate\n */\n\n/**\n * @callback Check\n * Check that an arbitrary value is a node.\n * @param {unknown} this\n * The given context.\n * @param {unknown} [node]\n * Anything (typically a node).\n * @param {number | null | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | null | undefined} [parent]\n * The node’s parent.\n * @returns {boolean}\n * Whether this is a node and passes a test.\n *\n * @typedef {Record<string, unknown> | Node} Props\n * Object to check for equivalence.\n *\n * Note: `Node` is included as it is common but is not indexable.\n *\n * @typedef {Array<Props | TestFunction | string> | ReadonlyArray<Props | TestFunction | string> | Props | TestFunction | string | null | undefined} Test\n * Check for an arbitrary node.\n *\n * @callback TestFunction\n * Check if a node passes a test.\n * @param {unknown} this\n * The given context.\n * @param {Node} node\n * A node.\n * @param {number | undefined} [index]\n * The node’s position in its parent.\n * @param {Parent | undefined} [parent]\n * The node’s parent.\n * @returns {boolean | undefined | void}\n * Whether this node passes the test.\n *\n * Note: `void` is included until TS sees no return as `undefined`.\n */\n\n/**\n * Check if `node` is a `Node` and whether it passes the given test.\n *\n * @param {unknown} node\n * Thing to check, typically `Node`.\n * @param {Test} test\n * A check for a specific node.\n * @param {number | null | undefined} index\n * The node’s position in its parent.\n * @param {Parent | null | undefined} parent\n * The node’s parent.\n * @param {unknown} context\n * Context object (`this`) to pass to `test` functions.\n * @returns {boolean}\n * Whether `node` is a node and passes a test.\n */\nexport const is =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * (<Condition extends ReadonlyArray<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &\n * (<Condition extends Array<string>>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition[number]}) &\n * (<Condition extends string>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * (<Condition extends Props>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * (<Condition extends TestFunction>(node: unknown, test: Condition, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &\n * ((node?: null | undefined) => false) &\n * ((node: unknown, test?: null | undefined, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((node: unknown, test?: Test, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => boolean)\n * )}\n */\n (\n /**\n * @param {unknown} [node]\n * @param {Test} [test]\n * @param {number | null | undefined} [index]\n * @param {Parent | null | undefined} [parent]\n * @param {unknown} [context]\n * @returns {boolean}\n */\n // eslint-disable-next-line max-params\n function (node, test, index, parent, context) {\n const check = convert(test)\n\n if (\n index !== undefined &&\n index !== null &&\n (typeof index !== 'number' ||\n index < 0 ||\n index === Number.POSITIVE_INFINITY)\n ) {\n throw new Error('Expected positive finite index')\n }\n\n if (\n parent !== undefined &&\n parent !== null &&\n (!is(parent) || !parent.children)\n ) {\n throw new Error('Expected parent node')\n }\n\n if (\n (parent === undefined || parent === null) !==\n (index === undefined || index === null)\n ) {\n throw new Error('Expected both parent and index')\n }\n\n return looksLikeANode(node)\n ? check.call(context, node, index, parent)\n : false\n }\n )\n\n/**\n * Generate an assertion from a test.\n *\n * Useful if you’re going to test many nodes, for example when creating a\n * utility where something else passes a compatible test.\n *\n * The created function is a bit faster because it expects valid input only:\n * a `node`, `index`, and `parent`.\n *\n * @param {Test} test\n * * when nullish, checks if `node` is a `Node`.\n * * when `string`, works like passing `(node) => node.type === test`.\n * * when `function` checks if function passed the node is true.\n * * when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.\n * * when `array`, checks if any one of the subtests pass.\n * @returns {Check}\n * An assertion.\n */\nexport const convert =\n // Note: overloads in JSDoc can’t yet use different `@template`s.\n /**\n * @type {(\n * (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &\n * (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &\n * (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &\n * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &\n * ((test?: Test) => Check)\n * )}\n */\n (\n /**\n * @param {Test} [test]\n * @returns {Check}\n */\n function (test) {\n if (test === null || test === undefined) {\n return ok\n }\n\n if (typeof test === 'function') {\n return castFactory(test)\n }\n\n if (typeof test === 'object') {\n return Array.isArray(test)\n ? anyFactory(test)\n : // Cast because `ReadonlyArray` goes into the above but `isArray`\n // narrows to `Array`.\n propertiesFactory(/** @type {Props} */ (test))\n }\n\n if (typeof test === 'string') {\n return typeFactory(test)\n }\n\n throw new Error('Expected function, string, or object as test')\n }\n )\n\n/**\n * @param {Array<Props | TestFunction | string>} tests\n * @returns {Check}\n */\nfunction anyFactory(tests) {\n /** @type {Array<Check>} */\n const checks = []\n let index = -1\n\n while (++index < tests.length) {\n checks[index] = convert(tests[index])\n }\n\n return castFactory(any)\n\n /**\n * @this {unknown}\n * @type {TestFunction}\n */\n function any(...parameters) {\n let index = -1\n\n while (++index < checks.length) {\n if (checks[index].apply(this, parameters)) return true\n }\n\n return false\n }\n}\n\n/**\n * Turn an object into a test for a node with a certain fields.\n *\n * @param {Props} check\n * @returns {Check}\n */\nfunction propertiesFactory(check) {\n const checkAsRecord = /** @type {Record<string, unknown>} */ (check)\n\n return castFactory(all)\n\n /**\n * @param {Node} node\n * @returns {boolean}\n */\n function all(node) {\n const nodeAsRecord = /** @type {Record<string, unknown>} */ (\n /** @type {unknown} */ (node)\n )\n\n /** @type {string} */\n let key\n\n for (key in check) {\n if (nodeAsRecord[key] !== checkAsRecord[key]) return false\n }\n\n return true\n }\n}\n\n/**\n * Turn a string into a test for a node with a certain type.\n *\n * @param {string} check\n * @returns {Check}\n */\nfunction typeFactory(check) {\n return castFactory(type)\n\n /**\n * @param {Node} node\n */\n function type(node) {\n return node && node.type === check\n }\n}\n\n/**\n * Turn a custom test into a test for a node that passes that test.\n *\n * @param {TestFunction} testFunction\n * @returns {Check}\n */\nfunction castFactory(testFunction) {\n return check\n\n /**\n * @this {unknown}\n * @type {Check}\n */\n function check(value, index, parent) {\n return Boolean(\n looksLikeANode(value) &&\n testFunction.call(\n this,\n value,\n typeof index === 'number' ? index : undefined,\n parent || undefined\n )\n )\n }\n}\n\nfunction ok() {\n return true\n}\n\n/**\n * @param {unknown} value\n * @returns {value is Node}\n */\nfunction looksLikeANode(value) {\n return value !== null && typeof value === 'object' && 'type' in value\n}\n","/**\n * @param {string} d\n * @returns {string}\n */\nexport function color(d) {\n return d\n}\n","/**\n * @import {Node as UnistNode, Parent as UnistParent} from 'unist'\n */\n\n/**\n * @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test\n * Test from `unist-util-is`.\n *\n * Note: we have remove and add `undefined`, because otherwise when generating\n * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n * which doesn’t work when publishing on npm.\n */\n\n/**\n * @typedef {(\n * Fn extends (value: any) => value is infer Thing\n * ? Thing\n * : Fallback\n * )} Predicate\n * Get the value of a type guard `Fn`.\n * @template Fn\n * Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n * Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n * Check extends null | undefined // No test.\n * ? Value\n * : Value extends {type: Check} // String (type) test.\n * ? Value\n * : Value extends Check // Partial test.\n * ? Value\n * : Check extends Function // Function test.\n * ? Predicate<Check, Value> extends Value\n * ? Predicate<Check, Value>\n * : never\n * : never // Some other test?\n * )} MatchesOne\n * Check whether a node matches a primitive check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n * Check extends ReadonlyArray<infer T>\n * ? MatchesOne<Value, T>\n * : Check extends Array<infer T>\n * ? MatchesOne<Value, T>\n * : MatchesOne<Value, Check>\n * )} Matches\n * Check whether a node matches a check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint\n * Number; capped reasonably.\n */\n\n/**\n * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment\n * Increment a number in the type system.\n * @template {Uint} [I=0]\n * Index.\n */\n\n/**\n * @typedef {(\n * Node extends UnistParent\n * ? Node extends {children: Array<infer Children>}\n * ? Child extends Children ? Node : never\n * : never\n * : never\n * )} InternalParent\n * Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {InternalParent<InclusiveDescendant<Tree>, Child>} Parent\n * Collect nodes in `Tree` that can be parents of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Depth extends Max\n * ? never\n * :\n * | InternalParent<Node, Child>\n * | InternalAncestor<Node, InternalParent<Node, Child>, Max, Increment<Depth>>\n * )} InternalAncestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {InternalAncestor<InclusiveDescendant<Tree>, Child>} Ancestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Tree extends UnistParent\n * ? Depth extends Max\n * ? Tree\n * : Tree | InclusiveDescendant<Tree['children'][number], Max, Increment<Depth>>\n * : Tree\n * )} InclusiveDescendant\n * Collect all (inclusive) descendants of `Tree`.\n *\n * > 👉 **Note**: for performance reasons, this seems to be the fastest way to\n * > recurse without actually running into an infinite loop, which the\n * > previous version did.\n * >\n * > Practically, a max of `2` is typically enough assuming a `Root` is\n * > passed, but it doesn’t improve performance.\n * > It gets higher with `List > ListItem > Table > TableRow > TableCell`.\n * > Using up to `10` doesn’t hurt or help either.\n * @template {UnistNode} Tree\n * Tree type.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {'skip' | boolean} Action\n * Union of the action types.\n *\n * @typedef {number} Index\n * Move to the sibling at `index` next (after node itself is completely\n * traversed).\n *\n * Useful if mutating the tree, such as removing the node the visitor is\n * currently on, or any of its previous siblings.\n * Results less than 0 or greater than or equal to `children.length` stop\n * traversing the parent.\n *\n * @typedef {[(Action | null | undefined | void)?, (Index | null | undefined)?]} ActionTuple\n * List with one or two values, the first an action, the second an index.\n *\n * @typedef {Action | ActionTuple | Index | null | undefined | void} VisitorResult\n * Any value that can be returned from a visitor.\n */\n\n/**\n * @callback Visitor\n * Handle a node (matching `test`, if given).\n *\n * Visitors are free to transform `node`.\n * They can also transform the parent of node (the last of `ancestors`).\n *\n * Replacing `node` itself, if `SKIP` is not returned, still causes its\n * descendants to be walked (which is a bug).\n *\n * When adding or removing previous siblings of `node` (or next siblings, in\n * case of reverse), the `Visitor` should return a new `Index` to specify the\n * sibling to traverse after `node` is traversed.\n * Adding or removing next siblings of `node` (or previous siblings, in case\n * of reverse) is handled as expected without needing to return a new `Index`.\n *\n * Removing the children property of an ancestor still results in them being\n * traversed.\n * @param {Visited} node\n * Found node.\n * @param {Array<VisitedParents>} ancestors\n * Ancestors of `node`.\n * @returns {VisitorResult}\n * What to do next.\n *\n * An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n * An `Action` is treated as a tuple of `[Action]`.\n *\n * Passing a tuple back only makes sense if the `Action` is `SKIP`.\n * When the `Action` is `EXIT`, that action can be returned.\n * When the `Action` is `CONTINUE`, `Index` can be returned.\n * @template {UnistNode} [Visited=UnistNode]\n * Visited node type.\n * @template {UnistParent} [VisitedParents=UnistParent]\n * Ancestor type.\n */\n\n/**\n * @typedef {Visitor<Matches<InclusiveDescendant<Tree>, Check>, Ancestor<Tree, Matches<InclusiveDescendant<Tree>, Check>>>} BuildVisitor\n * Build a typed `Visitor` function from a tree and a test.\n *\n * It will infer which values are passed as `node` and which as `parents`.\n * @template {UnistNode} [Tree=UnistNode]\n * Tree type.\n * @template {Test} [Check=Test]\n * Test type.\n */\n\nimport {convert} from 'unist-util-is'\nimport {color} from 'unist-util-visit-parents/do-not-use-color'\n\n/** @type {Readonly<ActionTuple>} */\nconst empty = []\n\n/**\n * Continue traversing as normal.\n */\nexport const CONTINUE = true\n\n/**\n * Stop traversing immediately.\n */\nexport const EXIT = false\n\n/**\n * Do not traverse this node’s children.\n */\nexport const SKIP = 'skip'\n\n/**\n * Visit nodes, with ancestral information.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @overload\n * @param {Tree} tree\n * @param {Check} check\n * @param {BuildVisitor<Tree, Check>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @overload\n * @param {Tree} tree\n * @param {BuildVisitor<Tree>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @param {UnistNode} tree\n * Tree to traverse.\n * @param {Visitor | Test} test\n * `unist-util-is`-compatible test\n * @param {Visitor | boolean | null | undefined} [visitor]\n * Handle each node.\n * @param {boolean | null | undefined} [reverse]\n * Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns {undefined}\n * Nothing.\n *\n * @template {UnistNode} Tree\n * Node type.\n * @template {Test} Check\n * `unist-util-is`-compatible test.\n */\nexport function visitParents(tree, test, visitor, reverse) {\n /** @type {Test} */\n let check\n\n if (typeof test === 'function' && typeof visitor !== 'function') {\n reverse = visitor\n // @ts-expect-error no visitor given, so `visitor` is test.\n visitor = test\n } else {\n // @ts-expect-error visitor given, so `test` isn’t a visitor.\n check = test\n }\n\n const is = convert(check)\n const step = reverse ? -1 : 1\n\n factory(tree, undefined, [])()\n\n /**\n * @param {UnistNode} node\n * @param {number | undefined} index\n * @param {Array<UnistParent>} parents\n */\n function factory(node, index, parents) {\n const value = /** @type {Record<string, unknown>} */ (\n node && typeof node === 'object' ? node : {}\n )\n\n if (typeof value.type === 'string') {\n const name =\n // `hast`\n typeof value.tagName === 'string'\n ? value.tagName\n : // `xast`\n typeof value.name === 'string'\n ? value.name\n : undefined\n\n Object.defineProperty(visit, 'name', {\n value:\n 'node (' + color(node.type + (name ? '<' + name + '>' : '')) + ')'\n })\n }\n\n return visit\n\n function visit() {\n /** @type {Readonly<ActionTuple>} */\n let result = empty\n /** @type {Readonly<ActionTuple>} */\n let subresult\n /** @type {number} */\n let offset\n /** @type {Array<UnistParent>} */\n let grandparents\n\n if (!test || is(node, index, parents[parents.length - 1] || undefined)) {\n // @ts-expect-error: `visitor` is now a visitor.\n result = toResult(visitor(node, parents))\n\n if (result[0] === EXIT) {\n return result\n }\n }\n\n if ('children' in node && node.children) {\n const nodeAsParent = /** @type {UnistParent} */ (node)\n\n if (nodeAsParent.children && result[0] !== SKIP) {\n offset = (reverse ? nodeAsParent.children.length : -1) + step\n grandparents = parents.concat(nodeAsParent)\n\n while (offset > -1 && offset < nodeAsParent.children.length) {\n const child = nodeAsParent.children[offset]\n\n subresult = factory(child, offset, grandparents)()\n\n if (subresult[0] === EXIT) {\n return subresult\n }\n\n offset =\n typeof subresult[1] === 'number' ? subresult[1] : offset + step\n }\n }\n }\n\n return result\n }\n }\n}\n\n/**\n * Turn a return value into a clean result.\n *\n * @param {VisitorResult} value\n * Valid return values from visitors.\n * @returns {Readonly<ActionTuple>}\n * Clean result.\n */\nfunction toResult(value) {\n if (Array.isArray(value)) {\n return value\n }\n\n if (typeof value === 'number') {\n return [CONTINUE, value]\n }\n\n return value === null || value === undefined ? empty : [value]\n}\n","/**\n * @typedef {import('unist').Node} UnistNode\n * @typedef {import('unist').Parent} UnistParent\n * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult\n */\n\n/**\n * @typedef {Exclude<import('unist-util-is').Test, undefined> | undefined} Test\n * Test from `unist-util-is`.\n *\n * Note: we have remove and add `undefined`, because otherwise when generating\n * automatic `.d.ts` files, TS tries to flatten paths from a local perspective,\n * which doesn’t work when publishing on npm.\n */\n\n// To do: use types from `unist-util-visit-parents` when it’s released.\n\n/**\n * @typedef {(\n * Fn extends (value: any) => value is infer Thing\n * ? Thing\n * : Fallback\n * )} Predicate\n * Get the value of a type guard `Fn`.\n * @template Fn\n * Value; typically function that is a type guard (such as `(x): x is Y`).\n * @template Fallback\n * Value to yield if `Fn` is not a type guard.\n */\n\n/**\n * @typedef {(\n * Check extends null | undefined // No test.\n * ? Value\n * : Value extends {type: Check} // String (type) test.\n * ? Value\n * : Value extends Check // Partial test.\n * ? Value\n * : Check extends Function // Function test.\n * ? Predicate<Check, Value> extends Value\n * ? Predicate<Check, Value>\n * : never\n * : never // Some other test?\n * )} MatchesOne\n * Check whether a node matches a primitive check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test, but not arrays.\n */\n\n/**\n * @typedef {(\n * Check extends Array<any>\n * ? MatchesOne<Value, Check[keyof Check]>\n * : MatchesOne<Value, Check>\n * )} Matches\n * Check whether a node matches a check in the type system.\n * @template Value\n * Value; typically unist `Node`.\n * @template Check\n * Value; typically `unist-util-is`-compatible test.\n */\n\n/**\n * @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint\n * Number; capped reasonably.\n */\n\n/**\n * @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment\n * Increment a number in the type system.\n * @template {Uint} [I=0]\n * Index.\n */\n\n/**\n * @typedef {(\n * Node extends UnistParent\n * ? Node extends {children: Array<infer Children>}\n * ? Child extends Children ? Node : never\n * : never\n * : never\n * )} InternalParent\n * Collect nodes that can be parents of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {InternalParent<InclusiveDescendant<Tree>, Child>} Parent\n * Collect nodes in `Tree` that can be parents of `Child`.\n * @template {UnistNode} Tree\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n */\n\n/**\n * @typedef {(\n * Depth extends Max\n * ? never\n * :\n * | InternalParent<Node, Child>\n * | InternalAncestor<Node, InternalParent<Node, Child>, Max, Increment<Depth>>\n * )} InternalAncestor\n * Collect nodes in `Tree` that can be ancestors of `Child`.\n * @template {UnistNode} Node\n * All node types in a tree.\n * @template {UnistNode} Child\n * Node to search for.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @typedef {(\n * Tree extends UnistParent\n * ? Depth extends Max\n * ? Tree\n * : Tree | InclusiveDescendant<Tree['children'][number], Max, Increment<Depth>>\n * : Tree\n * )} InclusiveDescendant\n * Collect all (inclusive) descendants of `Tree`.\n *\n * > 👉 **Note**: for performance reasons, this seems to be the fastest way to\n * > recurse without actually running into an infinite loop, which the\n * > previous version did.\n * >\n * > Practically, a max of `2` is typically enough assuming a `Root` is\n * > passed, but it doesn’t improve performance.\n * > It gets higher with `List > ListItem > Table > TableRow > TableCell`.\n * > Using up to `10` doesn’t hurt or help either.\n * @template {UnistNode} Tree\n * Tree type.\n * @template {Uint} [Max=10]\n * Max; searches up to this depth.\n * @template {Uint} [Depth=0]\n * Current depth.\n */\n\n/**\n * @callback Visitor\n * Handle a node (matching `test`, if given).\n *\n * Visitors are free to transform `node`.\n * They can also transform `parent`.\n *\n * Replacing `node` itself, if `SKIP` is not returned, still causes its\n * descendants to be walked (which is a bug).\n *\n * When adding or removing previous siblings of `node` (or next siblings, in\n * case of reverse), the `Visitor` should return a new `Index` to specify the\n * sibling to traverse after `node` is traversed.\n * Adding or removing next siblings of `node` (or previous siblings, in case\n * of reverse) is handled as expected without needing to return a new `Index`.\n *\n * Removing the children property of `parent` still results in them being\n * traversed.\n * @param {Visited} node\n * Found node.\n * @param {Visited extends UnistNode ? number | undefined : never} index\n * Index of `node` in `parent`.\n * @param {Ancestor extends UnistParent ? Ancestor | undefined : never} parent\n * Parent of `node`.\n * @returns {VisitorResult}\n * What to do next.\n *\n * An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n * An `Action` is treated as a tuple of `[Action]`.\n *\n * Passing a tuple back only makes sense if the `Action` is `SKIP`.\n * When the `Action` is `EXIT`, that action can be returned.\n * When the `Action` is `CONTINUE`, `Index` can be returned.\n * @template {UnistNode} [Visited=UnistNode]\n * Visited node type.\n * @template {UnistParent} [Ancestor=UnistParent]\n * Ancestor type.\n */\n\n/**\n * @typedef {Visitor<Visited, Parent<Ancestor, Visited>>} BuildVisitorFromMatch\n * Build a typed `Visitor` function from a node and all possible parents.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} Visited\n * Node type.\n * @template {UnistParent} Ancestor\n * Parent type.\n */\n\n/**\n * @typedef {(\n * BuildVisitorFromMatch<\n * Matches<Descendant, Check>,\n * Extract<Descendant, UnistParent>\n * >\n * )} BuildVisitorFromDescendants\n * Build a typed `Visitor` function from a list of descendants and a test.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} Descendant\n * Node type.\n * @template {Test} Check\n * Test type.\n */\n\n/**\n * @typedef {(\n * BuildVisitorFromDescendants<\n * InclusiveDescendant<Tree>,\n * Check\n * >\n * )} BuildVisitor\n * Build a typed `Visitor` function from a tree and a test.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n * @template {UnistNode} [Tree=UnistNode]\n * Node type.\n * @template {Test} [Check=Test]\n * Test type.\n */\n\nimport {visitParents} from 'unist-util-visit-parents'\n\nexport {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'\n\n/**\n * Visit nodes.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @overload\n * @param {Tree} tree\n * @param {Check} check\n * @param {BuildVisitor<Tree, Check>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @overload\n * @param {Tree} tree\n * @param {BuildVisitor<Tree>} visitor\n * @param {boolean | null | undefined} [reverse]\n * @returns {undefined}\n *\n * @param {UnistNode} tree\n * Tree to traverse.\n * @param {Visitor | Test} testOrVisitor\n * `unist-util-is`-compatible test (optional, omit to pass a visitor).\n * @param {Visitor | boolean | null | undefined} [visitorOrReverse]\n * Handle each node (when test is omitted, pass `reverse`).\n * @param {boolean | null | undefined} [maybeReverse=false]\n * Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns {undefined}\n * Nothing.\n *\n * @template {UnistNode} Tree\n * Node type.\n * @template {Test} Check\n * `unist-util-is`-compatible test.\n */\nexport function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {\n /** @type {boolean | null | undefined} */\n let reverse\n /** @type {Test} */\n let test\n /** @type {Visitor} */\n let visitor\n\n if (\n typeof testOrVisitor === 'function' &&\n typeof visitorOrReverse !== 'function'\n ) {\n test = undefined\n visitor = testOrVisitor\n reverse = visitorOrReverse\n } else {\n // @ts-expect-error: assume the overload with test was given.\n test = testOrVisitor\n // @ts-expect-error: assume the overload with test was given.\n visitor = visitorOrReverse\n reverse = maybeReverse\n }\n\n visitParents(tree, test, overload, reverse)\n\n /**\n * @param {UnistNode} node\n * @param {Array<UnistParent>} parents\n */\n function overload(node, parents) {\n const parent = parents[parents.length - 1]\n const index = parent ? parent.children.indexOf(node) : undefined\n return visitor(node, index, parent)\n }\n}\n","/* eslint-disable getter-return */\n\n// @ts-ignore\nimport { tracked } from '@glimmer/tracking';\nimport { setComponentTemplate } from '@ember/component';\nimport templateOnly from '@ember/component/template-only';\nimport { assert } from '@ember/debug';\nimport { registerDestructor } from '@ember/destroyable';\nimport { array, concat, fn, get, hash } from '@ember/helper';\nimport { on } from '@ember/modifier';\nimport { getOwner } from '@ember/owner';\nimport { precompileTemplate } from '@ember/template-compilation';\nimport { waitFor } from '@ember/test-waiters';\n\nimport { createStore } from 'ember-primitives/store';\nimport { resource } from 'ember-resources';\nimport { Compiler } from 'repl-sdk';\nimport { visit } from 'unist-util-visit';\n\nimport { nameFor } from '../compile/utils.ts';\nimport { modules } from './known-modules.ts';\n\nimport type { CompileResult, ModuleMap } from '../compile/types.ts';\nimport type { ComponentLike } from '@glint/template';\nimport type { EditorView } from 'codemirror';\nimport type { ErrorMessage, InfoMessage, Message } from 'repl-sdk';\n\nexport function getCompiler(context: object) {\n const owner = getOwner(context) ?? context;\n\n assert(\n `Missing owner. Cannot use ember-repl's compiler without an owner.`,\n owner\n );\n\n return createStore(owner, CompilerService);\n}\n\n/**\n * Old way to make static components, because\n * https://github.com/emberjs/ember.js/issues/20913\n *\n * The runtime compiler doesn't allow you to catch compiler errors.\n * This particular component doesn't need to be runtime anyway.\n */\nfunction rendersElement(x: {\n element: Element;\n destroy: () => void;\n}): ComponentLike {\n const render = resource(({ on }) => {\n on.cleanup(() => {\n x.destroy();\n });\n\n return x.element;\n });\n\n return setComponentTemplate(\n precompileTemplate(`{{render}}`, {\n strictMode: true,\n scope: () => ({ render }),\n }),\n templateOnly()\n ) as ComponentLike;\n}\n\ninterface CompilerOptions {\n hbs?: {\n scope?: Record<string, unknown>;\n };\n md?: {\n remarkPlugins?: unknown[];\n rehypePlugins?: unknown[];\n };\n gjs?: {\n owner?: unknown;\n };\n gmd?: {\n scope?: Record<string, unknown>;\n remarkPlugins?: unknown[];\n rehypePlugins?: unknown[];\n };\n}\n\n/**\n * Standard for the REPL, not real apps.\n * HBS isn't used in real apps (that are fully up to date)\n */\nconst standardScope = {\n // These are only added here because it's convenient for hbs\n // to have them\n array,\n concat,\n fn,\n get,\n hash,\n on,\n // The default available scope for gjs:\n //\n // We don't use gjs transpilation here, because hbs transpilation\n // doesn't need to go through the babel infra, so it's faster this way,\n // even though it's more \"verbose\" and could get out of sync from the\n // implementations / source-of-truth.\n //\n // https://github.com/emberjs/babel-plugin-ember-template-compilation/blob/main/src/scope-locals.ts#L16\n //\n // ////////////////\n // namespaces\n // ////////////////\n // TC39\n globalThis,\n Atomics,\n JSON,\n Math,\n Reflect,\n // WHATWG\n localStorage,\n sessionStorage,\n URL,\n // ////////////////\n // functions / utilities\n // ////////////////\n // TC39\n isNaN,\n isFinite,\n parseInt,\n parseFloat,\n decodeURI,\n decodeURIComponent,\n encodeURI,\n encodeURIComponent,\n // WHATWG\n postMessage,\n structuredClone,\n // ////////////////\n // new-less Constructors (still functions)\n // ////////////////\n // TC39\n Array, // different behavior from (array)\n BigInt,\n Boolean,\n Date,\n Number,\n Object, // different behavior from (hash)\n String,\n // ////////////////\n // Values\n // ////////////////\n // TC39\n Infinity,\n NaN,\n // WHATWG\n isSecureContext,\n};\n\nexport default class CompilerService {\n #compiler: Compiler | undefined;\n\n constructor() {\n const global = getGlobal();\n\n global.REPL ||= {};\n\n if (global.REPL.compiler) {\n return global.REPL.compiler;\n }\n\n global.REPL.compiler = this;\n\n registerDestructor(this, () => {\n delete global.REPL?.compiler;\n });\n }\n\n @tracked messages: Message[] = [];\n\n get lastInfo(): InfoMessage | undefined {\n const m = this.messages;\n\n for (let i = m.length - 1; i >= 0; i--) {\n const current = m[i];\n\n if (current?.type === 'info') return current;\n }\n }\n\n get lastError(): ErrorMessage | undefined {\n const m = this.messages;\n\n for (let i = m.length - 1; i >= 0; i--) {\n const current = m[i];\n\n if (current?.type === 'error') return current;\n }\n }\n\n /**\n * @param {ModuleMap} [ extraModules ]: map of import paths to modules.\n * These modules are useful if you need to document a library or a any design system or a styleguide or\n * if there are additional modules that could be imported in the passed `code`.\n * @param {object} [options] optional compiler options for each format/flavor\n *\n * Later on, imports that are not present by default (ember/glimmer) or that\n * are not provided by extraModules will be searched on npm to see if a package\n * needs to be downloaded before running the `code` / invoking the component\n */\n setup = (extraModules: ModuleMap = {}, options: CompilerOptions = {}) => {\n const localModules = modules(extraModules);\n\n const parentOwner = getOwner(this);\n const owner = {\n name: 'ember-repl owner',\n parent: parentOwner,\n /**\n * @param {string} name\n */\n lookup(name: `${string}:${string}`): unknown {\n if (!parentOwner) return;\n\n return parentOwner.lookup(name);\n },\n /**\n * @param {string} name\n */\n resolveRegistration(name: string): unknown {\n if (!parentOwner) return;\n\n // @ts-expect-error\n return parentOwner.resolveRegistration(name);\n },\n };\n\n this.#compiler = new Compiler({\n logging: location.search.includes('debug'),\n resolve: {\n ...localModules,\n },\n on: {\n log: (type: Message['type'], message: string) => {\n this.messages.push({ type, message });\n // Waiting on better array primitive\n // eslint-disable-next-line no-self-assign\n this.messages = this.messages;\n },\n },\n options: {\n ...options,\n gjs: {\n owner,\n ...(options.gjs ?? {}),\n },\n gmd: {\n owner,\n ...(options.gmd ?? {}),\n scope: {\n ...standardScope,\n ...(options.gmd?.scope ?? {}),\n },\n remarkPlugins: [\n function defaultHbsToEmber() {\n return function transformer(tree: any) {\n visit(tree, 'code', (node) => {\n if (node.lang === 'hbs') {\n if (!node.meta) {\n node.meta = 'ember';\n } else {\n node.meta += ' ember';\n }\n\n return node;\n }\n });\n\n return tree;\n };\n },\n ...(options.gmd?.remarkPlugins ?? []),\n ],\n },\n hbs: {\n ember: {\n owner,\n ...(options.hbs ?? {}),\n scope: {\n ...standardScope,\n ...(options.hbs?.scope ?? {}),\n },\n },\n },\n },\n });\n };\n\n get compiler(): Compiler {\n /**\n * This is useful for our own testing.\n * not sure if this would be a footgun for consumers' usage\n */\n if (!this.#compiler) {\n this.setup();\n }\n\n assert(\n `Expected a compiled to be setup on the compiler service. Use \\`compiler.setup()\\` first.`,\n this.#compiler\n );\n\n return this.#compiler;\n }\n\n async createEditor(\n element: HTMLElement,\n options: {\n text: string | null | undefined;\n format: string;\n handleUpdate: (text: string) => void;\n extensions?: unknown[];\n }\n ): Promise<{\n view: EditorView;\n setText: (text: string, format: string) => Promise<void>;\n setFormat: (format: string) => Promise<void>;\n }> {\n return this.compiler.createEditor(element, options);\n }\n\n async #compile(ext: string, text: string, options?: Record<string, unknown>) {\n /**\n * Protect from accidental backtracking-render assertions\n * (infinite loop protection)\n *\n * This function doesn't ready any tracked data, so we don't need to\n * worry about invalidation or anything.\n */\n await Promise.resolve();\n\n this.messages = [];\n\n return this.compiler.compile(ext, text, options ?? {});\n }\n\n /**\n * @public\n *\n * Defers to the underlying repl-SDK and gives us a component we can render.\n *\n * @param {string} ext the ext/format to be compiled\n * @param {string} text the code to be compiled using the configured compiler for the ext\n */\n @waitFor\n async compile(ext: string, text: string, options?: Record<string, unknown>) {\n const name = nameFor(text);\n let component: undefined | ComponentLike;\n let error: undefined | Error;\n\n options ||= {};\n\n try {\n if (ext === 'hbs') {\n /**\n * Are there other hbs-using frameworks?\n */\n options.flavor = 'ember';\n }\n\n const result = await this.#compile(ext, text, options);\n\n component = rendersElement(result);\n } catch (e) {\n // Put a breakpoint here to debug\n // debugger;\n console.error(e);\n error = e as Error | undefined;\n }\n\n return { name, component, error };\n }\n\n /**\n * @public\n *\n * Transpiles GlimmerJS (*.gjs) formatted text into and evaluates as a JS Module.\n * The returned component can be invoked explicitly in the consuming project.\n *\n * @param {string} code the code to be compiled\n */\n compileGJS(code: string): Promise<CompileResult> {\n return this.compile('gjs', code);\n }\n\n /**\n * compile a template with an empty scope\n * to use components, helpers, etc, you will need to compile with JS\n *\n * (templates alone do not have a way to import / define complex structures)\n */\n @waitFor\n async compileHBS(\n source: string,\n options: {\n /**\n * Used for debug viewing\n */\n moduleName?: string;\n /**\n * Additional values to include in hbs scope.\n * This is a _strict mode_ hbs component.\n */\n scope?: Record<string, unknown>;\n } = {}\n ): Promise<CompileResult> {\n return this.compile('hbs', source, options);\n }\n\n @waitFor\n compileMD(\n source: string,\n options?: {\n remarkPlugins?: unknown[];\n rehypePlugins?: unknown[];\n }\n ): Promise<CompileResult> {\n return this.compile('md', source, options);\n }\n}\n\nfunction getGlobal() {\n return globalThis as {\n REPL?: {\n compiler?: CompilerService;\n };\n };\n}\n"],"names":["convert","test","undefined","ok","castFactory","Array","isArray","anyFactory","propertiesFactory","typeFactory","Error","tests","checks","index","length","any","parameters","apply","check","checkAsRecord","all","node","nodeAsRecord","key","type","testFunction","value","parent","Boolean","looksLikeANode","call","color","d","empty","CONTINUE","EXIT","SKIP","visitParents","tree","visitor","reverse","is","step","factory","parents","name","tagName","Object","defineProperty","visit","result","subresult","offset","grandparents","toResult","children","nodeAsParent","concat","child","testOrVisitor","visitorOrReverse","maybeReverse","overload","indexOf","getCompiler","context","owner","getOwner","assert","createStore","CompilerService","rendersElement","x","render","resource","on","cleanup","destroy","element","setComponentTemplate","precompileTemplate","strictMode","scope","templateOnly","standardScope","array","fn","get","hash","globalThis","Atomics","JSON","Math","Reflect","localStorage","sessionStorage","URL","isNaN","isFinite","parseInt","parseFloat","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","postMessage","structuredClone","BigInt","Date","Number","String","Infinity","NaN","isSecureContext","constructor","global","getGlobal","REPL","compiler","registerDestructor","g","prototype","tracked","i","lastInfo","m","messages","current","lastError","setup","extraModules","options","localModules","modules","parentOwner","lookup","resolveRegistration","Compiler","logging","location","search","includes","resolve","log","message","push","gjs","gmd","remarkPlugins","defaultHbsToEmber","transformer","lang","meta","hbs","ember","createEditor","#compile","ext","text","Promise","compile","nameFor","component","error","flavor","e","console","n","waitFor","compileGJS","code","compileHBS","source","compileMD"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA;AACA;;;AAwHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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|
|
@@ -10,6 +10,7 @@ const frameworkModules = {
|
|
|
10
10
|
'@ember/helper': () => import('@ember/helper'),
|
|
11
11
|
'@ember/modifier': () => import('@ember/modifier'),
|
|
12
12
|
'@ember/object': () => import('@ember/object'),
|
|
13
|
+
'@ember/object/internals': () => import('@ember/object/internals'),
|
|
13
14
|
'@ember/object/observers': () => import('@ember/object/observers'),
|
|
14
15
|
'@ember/owner': () => import('@ember/owner'),
|
|
15
16
|
'@ember/reactive': () => import('@ember/reactive'),
|
|
@@ -91,7 +92,10 @@ const emberCompilationModules = {
|
|
|
91
92
|
// Private
|
|
92
93
|
|
|
93
94
|
// @ts-ignore
|
|
94
|
-
importSync: x =>
|
|
95
|
+
importSync: x =>
|
|
96
|
+
// @ts-expect-error
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
98
|
+
window[Symbol.for('__repl-sdk__compiler__')].resolves[x],
|
|
95
99
|
moduleExists: () => false
|
|
96
100
|
})
|
|
97
101
|
};
|
|
@@ -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': () => import('@ember/component/template-only'),\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/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 '@glimmer/component': () => import('@glimmer/component'),\n '@glimmer/tracking': () => import('@glimmer/tracking'),\n '@glimmer/tracking/primitives/cache': () => 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': () => import('@ember/template-compiler/runtime'),\n '@ember/template-compiler': () => import('@ember/template-compiler/runtime'),\n 'ember-source/dist/ember-template-compiler': () =>\n import(\n \n // @ts-ignore\n 'ember-source/dist/ember-template-compiler.js'\n ),\n 'ember-source/dist/ember-template-compiler.js': () =>\n import(\n \n // @ts-ignore\n 'ember-source/dist/ember-template-compiler.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 '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 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) => window[Symbol.for('__repl-sdk__compiler__')].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/debug","@ember/destroyable","@ember/helper","@ember/modifier","@ember/object","@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/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/dist/ember-template-compiler","ember-source/dist/ember-template-compiler.js","@babel/standalone","content-tag","decorator-transforms","decorator-transforms/runtime","babel-plugin-ember-template-compilation","babel-import-util","babel-plugin-debug-macros","@embroider/macros","macroCondition","x","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,MAAM,OAAO,gCAAgC,CAAC;AAChF,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,yBAAyB,EAAEC,MAAM,OAAO,yBAAyB,CAAC;AAClE,EAAA,cAAc,EAAEC,MAAM,OAAO,cAAc,CAAC;AAC5C,EAAA,iBAAiB,EAAEC,MAAM,OAAO,iBAAiB,CAAC;AAClD,EAA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AACAC,IAAAA,UAAU,EAAGhB,CAAS,IAAKiB,MAAM,CAACC,MAAM,CAACC,GAAG,CAAC,wBAAwB,CAAC,CAAC,CAACC,QAAQ,CAACpB,CAAC,CAAC;IACnFqB,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,GAAG3C,aAAa;AAChB,EAAA,GAAGjC,gBAAgB;AACnB,EAAA,GAAG4E,YAAY;AACf,EAAA,GAAGtC,uBAAuB;EAC1B,GAAGoC;AACL,CAAC;;;;"}
|
|
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/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/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 '@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/dist/ember-template-compiler': () =>\n import(\n // @ts-ignore\n 'ember-source/dist/ember-template-compiler.js'\n ),\n 'ember-source/dist/ember-template-compiler.js': () =>\n import(\n // @ts-ignore\n 'ember-source/dist/ember-template-compiler.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 '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 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/debug","@ember/destroyable","@ember/helper","@ember/modifier","@ember/object","@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/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/dist/ember-template-compiler","ember-source/dist/ember-template-compiler.js","@babel/standalone","content-tag","decorator-transforms","decorator-transforms/runtime","babel-plugin-ember-template-compilation","babel-import-util","babel-plugin-debug-macros","@embroider/macros","macroCondition","x","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,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,yBAAyB,EAAEC,MAAM,OAAO,yBAAyB,CAAC;AAClE,EAAA,yBAAyB,EAAEC,MAAM,OAAO,yBAAyB,CAAC;AAClE,EAAA,cAAc,EAAEC,MAAM,OAAO,cAAc,CAAC;AAC5C,EAAA,iBAAiB,EAAEC,MAAM,OAAO,iBAAiB,CAAC;AAClD,EAAA,6BAA6B,EAAEC,MAAM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GhB,CAAS;AACpB;AACA;AACAiB,IAAAA,MAAM,CAACC,MAAM,CAACC,GAAG,CAAC,wBAAwB,CAAC,CAAQ,CAAEC,QAAQ,CAACpB,CAAC,CAAC;IAClEqB,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,GAAG3C,aAAa;AAChB,EAAA,GAAGlC,gBAAgB;AACnB,EAAA,GAAG6E,YAAY;AACf,EAAA,GAAGtC,uBAAuB;EAC1B,GAAGoC;AACL,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-repl",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Library for enabling REPL and Playground creation with Ember/Glimmer",
|
|
6
6
|
"keywords": [
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"ember-primitives": "^0.48.1",
|
|
31
31
|
"ember-resolver": "^13.1.0",
|
|
32
32
|
"ember-resources": "^7.0.7",
|
|
33
|
-
"repl-sdk": "1.0
|
|
33
|
+
"repl-sdk": "1.1.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@arethetypeswrong/cli": "^0.18.2",
|
package/src/services/compiler.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable getter-return */
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
// @ts-ignore
|
|
4
4
|
import { tracked } from '@glimmer/tracking';
|
|
5
5
|
import { setComponentTemplate } from '@ember/component';
|
|
@@ -28,7 +28,10 @@ import type { ErrorMessage, InfoMessage, Message } from 'repl-sdk';
|
|
|
28
28
|
export function getCompiler(context: object) {
|
|
29
29
|
const owner = getOwner(context) ?? context;
|
|
30
30
|
|
|
31
|
-
assert(
|
|
31
|
+
assert(
|
|
32
|
+
`Missing owner. Cannot use ember-repl's compiler without an owner.`,
|
|
33
|
+
owner
|
|
34
|
+
);
|
|
32
35
|
|
|
33
36
|
return createStore(owner, CompilerService);
|
|
34
37
|
}
|
|
@@ -40,7 +43,10 @@ export function getCompiler(context: object) {
|
|
|
40
43
|
* The runtime compiler doesn't allow you to catch compiler errors.
|
|
41
44
|
* This particular component doesn't need to be runtime anyway.
|
|
42
45
|
*/
|
|
43
|
-
function rendersElement(x: {
|
|
46
|
+
function rendersElement(x: {
|
|
47
|
+
element: Element;
|
|
48
|
+
destroy: () => void;
|
|
49
|
+
}): ComponentLike {
|
|
44
50
|
const render = resource(({ on }) => {
|
|
45
51
|
on.cleanup(() => {
|
|
46
52
|
x.destroy();
|
|
@@ -66,6 +72,9 @@ interface CompilerOptions {
|
|
|
66
72
|
remarkPlugins?: unknown[];
|
|
67
73
|
rehypePlugins?: unknown[];
|
|
68
74
|
};
|
|
75
|
+
gjs?: {
|
|
76
|
+
owner?: unknown;
|
|
77
|
+
};
|
|
69
78
|
gmd?: {
|
|
70
79
|
scope?: Record<string, unknown>;
|
|
71
80
|
remarkPlugins?: unknown[];
|
|
@@ -198,6 +207,29 @@ export default class CompilerService {
|
|
|
198
207
|
setup = (extraModules: ModuleMap = {}, options: CompilerOptions = {}) => {
|
|
199
208
|
const localModules = modules(extraModules);
|
|
200
209
|
|
|
210
|
+
const parentOwner = getOwner(this);
|
|
211
|
+
const owner = {
|
|
212
|
+
name: 'ember-repl owner',
|
|
213
|
+
parent: parentOwner,
|
|
214
|
+
/**
|
|
215
|
+
* @param {string} name
|
|
216
|
+
*/
|
|
217
|
+
lookup(name: `${string}:${string}`): unknown {
|
|
218
|
+
if (!parentOwner) return;
|
|
219
|
+
|
|
220
|
+
return parentOwner.lookup(name);
|
|
221
|
+
},
|
|
222
|
+
/**
|
|
223
|
+
* @param {string} name
|
|
224
|
+
*/
|
|
225
|
+
resolveRegistration(name: string): unknown {
|
|
226
|
+
if (!parentOwner) return;
|
|
227
|
+
|
|
228
|
+
// @ts-expect-error
|
|
229
|
+
return parentOwner.resolveRegistration(name);
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
|
|
201
233
|
this.#compiler = new Compiler({
|
|
202
234
|
logging: location.search.includes('debug'),
|
|
203
235
|
resolve: {
|
|
@@ -214,13 +246,11 @@ export default class CompilerService {
|
|
|
214
246
|
options: {
|
|
215
247
|
...options,
|
|
216
248
|
gjs: {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
lookup: () => {},
|
|
220
|
-
resolveRegistration: () => {},
|
|
221
|
-
},
|
|
249
|
+
owner,
|
|
250
|
+
...(options.gjs ?? {}),
|
|
222
251
|
},
|
|
223
252
|
gmd: {
|
|
253
|
+
owner,
|
|
224
254
|
...(options.gmd ?? {}),
|
|
225
255
|
scope: {
|
|
226
256
|
...standardScope,
|
|
@@ -249,6 +279,7 @@ export default class CompilerService {
|
|
|
249
279
|
},
|
|
250
280
|
hbs: {
|
|
251
281
|
ember: {
|
|
282
|
+
owner,
|
|
252
283
|
...(options.hbs ?? {}),
|
|
253
284
|
scope: {
|
|
254
285
|
...standardScope,
|
|
@@ -322,12 +353,13 @@ export default class CompilerService {
|
|
|
322
353
|
let component: undefined | ComponentLike;
|
|
323
354
|
let error: undefined | Error;
|
|
324
355
|
|
|
356
|
+
options ||= {};
|
|
357
|
+
|
|
325
358
|
try {
|
|
326
359
|
if (ext === 'hbs') {
|
|
327
360
|
/**
|
|
328
361
|
* Are there other hbs-using frameworks?
|
|
329
362
|
*/
|
|
330
|
-
options ||= {};
|
|
331
363
|
options.flavor = 'ember';
|
|
332
364
|
}
|
|
333
365
|
|
|
@@ -6,12 +6,14 @@ const frameworkModules = {
|
|
|
6
6
|
'@ember/array': () => import('@ember/array'),
|
|
7
7
|
'@ember/component': () => import('@ember/component'),
|
|
8
8
|
'@ember/component/helper': () => import('@ember/component/helper'),
|
|
9
|
-
'@ember/component/template-only': () =>
|
|
9
|
+
'@ember/component/template-only': () =>
|
|
10
|
+
import('@ember/component/template-only'),
|
|
10
11
|
'@ember/debug': () => import('@ember/debug'),
|
|
11
12
|
'@ember/destroyable': () => import('@ember/destroyable'),
|
|
12
13
|
'@ember/helper': () => import('@ember/helper'),
|
|
13
14
|
'@ember/modifier': () => import('@ember/modifier'),
|
|
14
15
|
'@ember/object': () => import('@ember/object'),
|
|
16
|
+
'@ember/object/internals': () => import('@ember/object/internals'),
|
|
15
17
|
'@ember/object/observers': () => import('@ember/object/observers'),
|
|
16
18
|
'@ember/owner': () => import('@ember/owner'),
|
|
17
19
|
'@ember/reactive': () => import('@ember/reactive'),
|
|
@@ -32,7 +34,8 @@ const frameworkModules = {
|
|
|
32
34
|
'@ember/version': () => import('@ember/version'),
|
|
33
35
|
'@glimmer/component': () => import('@glimmer/component'),
|
|
34
36
|
'@glimmer/tracking': () => import('@glimmer/tracking'),
|
|
35
|
-
'@glimmer/tracking/primitives/cache': () =>
|
|
37
|
+
'@glimmer/tracking/primitives/cache': () =>
|
|
38
|
+
import('@glimmer/tracking/primitives/cache'),
|
|
36
39
|
};
|
|
37
40
|
|
|
38
41
|
const coreLibraries = {
|
|
@@ -43,17 +46,16 @@ const coreLibraries = {
|
|
|
43
46
|
};
|
|
44
47
|
|
|
45
48
|
const emberCompilationModules = {
|
|
46
|
-
'@ember/template-compiler/runtime': () =>
|
|
49
|
+
'@ember/template-compiler/runtime': () =>
|
|
50
|
+
import('@ember/template-compiler/runtime'),
|
|
47
51
|
'@ember/template-compiler': () => import('@ember/template-compiler/runtime'),
|
|
48
52
|
'ember-source/dist/ember-template-compiler': () =>
|
|
49
53
|
import(
|
|
50
|
-
|
|
51
54
|
// @ts-ignore
|
|
52
55
|
'ember-source/dist/ember-template-compiler.js'
|
|
53
56
|
),
|
|
54
57
|
'ember-source/dist/ember-template-compiler.js': () =>
|
|
55
58
|
import(
|
|
56
|
-
|
|
57
59
|
// @ts-ignore
|
|
58
60
|
'ember-source/dist/ember-template-compiler.js'
|
|
59
61
|
),
|
|
@@ -66,7 +68,7 @@ const emberCompilationModules = {
|
|
|
66
68
|
import('babel-plugin-ember-template-compilation'),
|
|
67
69
|
// Dependencies of the above
|
|
68
70
|
'babel-import-util': () => import('babel-import-util'),
|
|
69
|
-
|
|
71
|
+
|
|
70
72
|
// @ts-ignore
|
|
71
73
|
'babel-plugin-debug-macros': () => import('babel-plugin-debug-macros'),
|
|
72
74
|
'@embroider/macros': () => ({
|
|
@@ -101,9 +103,12 @@ const emberCompilationModules = {
|
|
|
101
103
|
},
|
|
102
104
|
}),
|
|
103
105
|
// Private
|
|
104
|
-
|
|
106
|
+
|
|
105
107
|
// @ts-ignore
|
|
106
|
-
importSync: (x: string) =>
|
|
108
|
+
importSync: (x: string) =>
|
|
109
|
+
// @ts-expect-error
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
111
|
+
window[Symbol.for('__repl-sdk__compiler__') as any]!.resolves[x],
|
|
107
112
|
moduleExists: () => false,
|
|
108
113
|
}),
|
|
109
114
|
};
|