ember-repl 6.0.0 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +2 -404
  3. package/config/.try.mjs +87 -0
  4. package/config/addon-main.cjs +7 -0
  5. package/config/attw.json +7 -0
  6. package/config/babel.publish.config.cjs +29 -0
  7. package/config/ember-cli-update.json +21 -0
  8. package/config/rollup.config.mjs +44 -0
  9. package/config/testem.cjs +35 -0
  10. package/config/tsconfig.publish.json +15 -0
  11. package/config/vite.config.mjs +36 -0
  12. package/declarations/compile/Compiled.d.ts +7 -0
  13. package/declarations/compile/Compiled.d.ts.map +1 -0
  14. package/declarations/compile/compile.d.ts +17 -0
  15. package/declarations/compile/compile.d.ts.map +1 -0
  16. package/declarations/compile/state.d.ts +43 -0
  17. package/declarations/compile/state.d.ts.map +1 -0
  18. package/declarations/compile/types.d.ts +5 -12
  19. package/declarations/compile/types.d.ts.map +1 -1
  20. package/declarations/index.d.ts +6 -2
  21. package/declarations/index.d.ts.map +1 -1
  22. package/declarations/services/compiler.d.ts +94 -0
  23. package/declarations/services/compiler.d.ts.map +1 -0
  24. package/declarations/services/known-modules.d.ts +7 -0
  25. package/declarations/services/known-modules.d.ts.map +1 -0
  26. package/declarations/setup.d.ts +7 -0
  27. package/declarations/setup.d.ts.map +1 -0
  28. package/declarations/test-support.d.ts +20 -0
  29. package/declarations/test-support.d.ts.map +1 -0
  30. package/dist/_commonjsHelpers-BAGoDD49.js +37 -0
  31. package/dist/_commonjsHelpers-BAGoDD49.js.map +1 -0
  32. package/dist/babel-8wMrbxkT.js +110427 -0
  33. package/dist/babel-8wMrbxkT.js.map +1 -0
  34. package/dist/blank-line-Bzg2Qt4K.js +482 -0
  35. package/dist/blank-line-Bzg2Qt4K.js.map +1 -0
  36. package/dist/compile/Compiled.js +26 -0
  37. package/dist/compile/Compiled.js.map +1 -0
  38. package/dist/compile/compile.js +62 -0
  39. package/dist/compile/compile.js.map +1 -0
  40. package/dist/compile/state.js +75 -0
  41. package/dist/compile/state.js.map +1 -0
  42. package/dist/compile/utils.js +213 -2
  43. package/dist/compile/utils.js.map +1 -1
  44. package/dist/default-CoqAuVeH.js +4 -0
  45. package/dist/default-CoqAuVeH.js.map +1 -0
  46. package/dist/index-BTx1k6gT.js +323 -0
  47. package/dist/index-BTx1k6gT.js.map +1 -0
  48. package/dist/index-Bxzjtr16.js +87 -0
  49. package/dist/index-Bxzjtr16.js.map +1 -0
  50. package/dist/index-C371bO_b.js +1553 -0
  51. package/dist/index-C371bO_b.js.map +1 -0
  52. package/dist/index-C4AyeeIa.js +5721 -0
  53. package/dist/index-C4AyeeIa.js.map +1 -0
  54. package/dist/index-C8S2G0FH.js +1953 -0
  55. package/dist/index-C8S2G0FH.js.map +1 -0
  56. package/dist/index-CCcIVEUK.js +409 -0
  57. package/dist/index-CCcIVEUK.js.map +1 -0
  58. package/dist/index-CDSIcg03.js +9070 -0
  59. package/dist/index-CDSIcg03.js.map +1 -0
  60. package/dist/index-D8szzCn3.js +2 -0
  61. package/dist/index-D8szzCn3.js.map +1 -0
  62. package/dist/index-DBBNT106.js +2644 -0
  63. package/dist/index-DBBNT106.js.map +1 -0
  64. package/dist/index-DP_Su7Zc.js +362 -0
  65. package/dist/index-DP_Su7Zc.js.map +1 -0
  66. package/dist/index-DejgrVqh.js +11299 -0
  67. package/dist/index-DejgrVqh.js.map +1 -0
  68. package/dist/index-Dr5iYoKt.js +1551 -0
  69. package/dist/index-Dr5iYoKt.js.map +1 -0
  70. package/dist/index-DxolpiGq.js +3336 -0
  71. package/dist/index-DxolpiGq.js.map +1 -0
  72. package/dist/index-ZyJlPFQY.js +249 -0
  73. package/dist/index-ZyJlPFQY.js.map +1 -0
  74. package/dist/index-k6CfLgeq.js +26 -0
  75. package/dist/index-k6CfLgeq.js.map +1 -0
  76. package/dist/index.js +4 -1
  77. package/dist/index.js.map +1 -1
  78. package/dist/services/compiler.js +329 -0
  79. package/dist/services/compiler.js.map +1 -0
  80. package/dist/services/known-modules.js +123 -0
  81. package/dist/services/known-modules.js.map +1 -0
  82. package/dist/setup.js +15 -0
  83. package/dist/setup.js.map +1 -0
  84. package/dist/test-support.js +33 -0
  85. package/dist/test-support.js.map +1 -0
  86. package/package.json +117 -138
  87. package/src/compile/Compiled.ts +45 -0
  88. package/src/compile/compile.ts +89 -0
  89. package/src/compile/state.ts +88 -0
  90. package/src/compile/types.ts +14 -13
  91. package/src/index.ts +6 -2
  92. package/src/services/compiler.ts +401 -0
  93. package/src/services/known-modules.ts +130 -0
  94. package/src/setup.ts +26 -0
  95. package/src/test-support.ts +64 -0
  96. package/addon-main.cjs +0 -5
  97. package/declarations/__PRIVATE__.d.ts +0 -2
  98. package/declarations/__PRIVATE__.d.ts.map +0 -1
  99. package/declarations/compile/formats/gjs/babel.d.ts +0 -7
  100. package/declarations/compile/formats/gjs/babel.d.ts.map +0 -1
  101. package/declarations/compile/formats/gjs/eval.d.ts +0 -8
  102. package/declarations/compile/formats/gjs/eval.d.ts.map +0 -1
  103. package/declarations/compile/formats/gjs/index.d.ts +0 -24
  104. package/declarations/compile/formats/gjs/index.d.ts.map +0 -1
  105. package/declarations/compile/formats/gjs/known-modules.d.ts +0 -48
  106. package/declarations/compile/formats/gjs/known-modules.d.ts.map +0 -1
  107. package/declarations/compile/formats/hbs.d.ts +0 -17
  108. package/declarations/compile/formats/hbs.d.ts.map +0 -1
  109. package/declarations/compile/formats/markdown.d.ts +0 -22
  110. package/declarations/compile/formats/markdown.d.ts.map +0 -1
  111. package/declarations/compile/formats.d.ts +0 -17
  112. package/declarations/compile/formats.d.ts.map +0 -1
  113. package/declarations/compile/index.d.ts +0 -80
  114. package/declarations/compile/index.d.ts.map +0 -1
  115. package/declarations/test-support/index.d.ts +0 -2
  116. package/declarations/test-support/index.d.ts.map +0 -1
  117. package/dist/__PRIVATE__.js +0 -2
  118. package/dist/__PRIVATE__.js.map +0 -1
  119. package/dist/compile/formats/gjs/babel.js +0 -2
  120. package/dist/compile/formats/gjs/babel.js.map +0 -1
  121. package/dist/compile/formats/gjs/eval.js +0 -19
  122. package/dist/compile/formats/gjs/eval.js.map +0 -1
  123. package/dist/compile/formats/gjs/index.js +0 -122
  124. package/dist/compile/formats/gjs/index.js.map +0 -1
  125. package/dist/compile/formats/gjs/known-modules.js +0 -52
  126. package/dist/compile/formats/gjs/known-modules.js.map +0 -1
  127. package/dist/compile/formats/hbs.js +0 -93
  128. package/dist/compile/formats/hbs.js.map +0 -1
  129. package/dist/compile/formats/markdown.js +0 -266
  130. package/dist/compile/formats/markdown.js.map +0 -1
  131. package/dist/compile/formats.js +0 -173
  132. package/dist/compile/formats.js.map +0 -1
  133. package/dist/compile/index.js +0 -113
  134. package/dist/compile/index.js.map +0 -1
  135. package/dist/test-support/index.js +0 -8
  136. package/dist/test-support/index.js.map +0 -1
  137. package/src/__PRIVATE__.ts +0 -1
  138. package/src/compile/formats/gjs/babel.ts +0 -7
  139. package/src/compile/formats/gjs/eval.ts +0 -29
  140. package/src/compile/formats/gjs/index.ts +0 -153
  141. package/src/compile/formats/gjs/known-modules.ts +0 -49
  142. package/src/compile/formats/hbs.ts +0 -100
  143. package/src/compile/formats/markdown.ts +0 -345
  144. package/src/compile/formats.ts +0 -178
  145. package/src/compile/index.ts +0 -219
  146. package/src/test-support/index.ts +0 -5
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compiler.js","sources":["../../src/services/compiler.ts"],"sourcesContent":["/* eslint-disable getter-return */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\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":["getCompiler","context","owner","getOwner","assert","createStore","CompilerService","rendersElement","x","render","resource","on","cleanup","destroy","element","setComponentTemplate","precompileTemplate","strictMode","scope","templateOnly","standardScope","array","concat","fn","get","hash","globalThis","Atomics","JSON","Math","Reflect","localStorage","sessionStorage","URL","isNaN","isFinite","parseInt","parseFloat","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","postMessage","structuredClone","Array","BigInt","Boolean","Date","Number","Object","String","Infinity","NaN","isSecureContext","constructor","global","getGlobal","REPL","compiler","registerDestructor","g","prototype","tracked","i","void 0","lastInfo","m","messages","length","current","type","lastError","setup","extraModules","options","localModules","modules","Compiler","logging","location","search","includes","resolve","log","message","push","gjs","lookup","resolveRegistration","gmd","remarkPlugins","defaultHbsToEmber","transformer","tree","visit","node","lang","meta","hbs","ember","createEditor","#compile","ext","text","Promise","compile","name","nameFor","component","error","flavor","result","e","console","n","waitFor","compileGJS","code","compileHBS","source","compileMD"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAyBO,SAASA,WAAWA,CAACC,OAAe,EAAE;AAC3C,EAAA,MAAMC,KAAK,GAAGC,QAAQ,CAACF,OAAO,CAAC,IAAIA,OAAO;AAE1CG,EAAAA,MAAM,CAAC,CAAA,iEAAA,CAAmE,EAAEF,KAAK,CAAC;AAElF,EAAA,OAAOG,WAAW,CAACH,KAAK,EAAEI,eAAe,CAAC;AAC5C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,cAAcA,CAACC,CAA4C,EAAiB;AACnF,EAAA,MAAMC,MAAM,GAAGC,QAAQ,CAAC,CAAC;AAAEC,IAAAA;AAAG,GAAC,KAAK;IAClCA,EAAE,CAACC,OAAO,CAAC,MAAM;MACfJ,CAAC,CAACK,OAAO,EAAE;AACb,IAAA,CAAC,CAAC;IAEF,OAAOL,CAAC,CAACM,OAAO;AAClB,EAAA,CAAC,CAAC;AAEF,EAAA,OAAOC,oBAAoB,CACzBC,kBAAkB,CAAC,YAAY,EAAE;AAC/BC,IAAAA,UAAU,EAAE,IAAI;IAChBC,KAAK,EAAEA,OAAO;AAAET,MAAAA;KAAQ;AAC1B,GAAC,CAAC,EACFU,YAAY,EACd,CAAC;AACH;AAiBA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAG;AACpB;AACA;EACAC,KAAK;EACLC,MAAM;EACNC,EAAE;EACFC,GAAG;EACHC,IAAI;EACJd,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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SAAS,GAAGrG,cAAc,CAACwG,MAAM,CAAC;IACpC,CAAC,CAAC,OAAOC,CAAC,EAAE;AACV;AACA;AACAC,MAAAA,OAAO,CAACJ,KAAK,CAACG,CAAC,CAAC;AAChBH,MAAAA,KAAK,GAAGG,CAAsB;AAChC,IAAA;IAEA,OAAO;MAAEN,IAAI;MAAEE,SAAS;AAAEC,MAAAA;KAAO;AACnC,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AAPE,EAAA;IAAAK,CAAA,CAAA,IAAA,CAAArD,SAAA,EAAA,SAAA,EAAA,CA5BCsD,OAAO,CAAA,CAAA;AAAA;EAoCRC,UAAUA,CAACC,IAAY,EAA0B;AAC/C,IAAA,OAAO,IAAI,CAACZ,OAAO,CAAC,KAAK,EAAEY,IAAI,CAAC;AAClC,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACE,MACMC,UAAUA,CACdC,MAAc,EACd7C,OAUC,GAAG,EAAE,EACkB;IACxB,OAAO,IAAI,CAAC+B,OAAO,CAAC,KAAK,EAAEc,MAAM,EAAE7C,OAAO,CAAC;AAC7C,EAAA;AAAC,EAAA;IAAAwC,CAAA,CAAA,IAAA,CAAArD,SAAA,EAAA,YAAA,EAAA,CAhBAsD,OAAO,CAAA,CAAA;AAAA;AAmBRK,EAAAA,SAASA,CACPD,MAAc,EACd7C,OAGC,EACuB;IACxB,OAAO,IAAI,CAAC+B,OAAO,CAAC,IAAI,EAAEc,MAAM,EAAE7C,OAAO,CAAC;AAC5C,EAAA;AAAC,EAAA;IAAAwC,CAAA,CAAA,IAAA,CAAArD,SAAA,EAAA,WAAA,EAAA,CATAsD,OAAO,CAAA,CAAA;AAAA;AAUV;AAEA,SAAS3D,SAASA,GAAG;AACnB,EAAA,OAAO9B,UAAU;AAKnB;;;;"}
@@ -0,0 +1,123 @@
1
+ const frameworkModules = {
2
+ '@ember/application': () => import('@ember/application'),
3
+ '@ember/application/instance': () => import('@ember/application/instance'),
4
+ '@ember/array': () => import('@ember/array'),
5
+ '@ember/component': () => import('@ember/component'),
6
+ '@ember/component/helper': () => import('@ember/component/helper'),
7
+ '@ember/component/template-only': () => import('@ember/component/template-only'),
8
+ '@ember/debug': () => import('@ember/debug'),
9
+ '@ember/destroyable': () => import('@ember/destroyable'),
10
+ '@ember/helper': () => import('@ember/helper'),
11
+ '@ember/modifier': () => import('@ember/modifier'),
12
+ '@ember/object': () => import('@ember/object'),
13
+ '@ember/owner': () => import('@ember/owner'),
14
+ '@ember/reactive': () => import('@ember/reactive'),
15
+ '@ember/reactive/collections': () => import('@ember/reactive/collections'),
16
+ '@ember/renderer': () => import('@ember/renderer'),
17
+ '@ember/routing': () => import('@ember/routing'),
18
+ '@ember/routing/route': () => import('@ember/routing/route'),
19
+ '@ember/routing/router': () => import('@ember/routing/router'),
20
+ '@ember/runloop': () => import('@ember/runloop'),
21
+ '@ember/service': () => import('@ember/service'),
22
+ '@ember/template': () => import('@ember/template'),
23
+ '@ember/template-compilation': () => import('@ember/template-compilation'),
24
+ '@ember/template-factory': () => import('@ember/template-factory'),
25
+ '@ember/test-helpers': () => import('@ember/test-helpers'),
26
+ '@ember/test-waiters': () => import('@ember/test-waiters'),
27
+ '@ember/test': () => import('@ember/test'),
28
+ '@ember/utils': () => import('@ember/utils'),
29
+ '@ember/version': () => import('@ember/version'),
30
+ '@glimmer/component': () => import('@glimmer/component'),
31
+ '@glimmer/tracking': () => import('@glimmer/tracking'),
32
+ '@glimmer/tracking/primitives/cache': () => import('@glimmer/tracking/primitives/cache')
33
+ };
34
+ const coreLibraries = {
35
+ 'ember-resolver': () => import('ember-resolver'),
36
+ 'ember-resources': () => import('ember-resources'),
37
+ 'ember-primitives': () => import('ember-primitives'),
38
+ 'repl-sdk': () => import('repl-sdk')
39
+ };
40
+ const emberCompilationModules = {
41
+ '@ember/template-compiler/runtime': () => import('@ember/template-compiler/runtime'),
42
+ '@ember/template-compiler': () => import('@ember/template-compiler/runtime'),
43
+ 'ember-source/dist/ember-template-compiler': () => import(
44
+ // eslint-disable-next-line
45
+ // @ts-ignore
46
+ 'ember-source/dist/ember-template-compiler.js'),
47
+ 'ember-source/dist/ember-template-compiler.js': () => import(
48
+ // eslint-disable-next-line
49
+ // @ts-ignore
50
+ 'ember-source/dist/ember-template-compiler.js'),
51
+ // Direct Dependencies
52
+ '@babel/standalone': () => import('../babel-8wMrbxkT.js').then(function (n) { return n.b; }),
53
+ 'content-tag': () => import('content-tag'),
54
+ 'decorator-transforms': () => import('decorator-transforms'),
55
+ 'decorator-transforms/runtime': () => import('decorator-transforms/runtime'),
56
+ 'babel-plugin-ember-template-compilation': () => import('babel-plugin-ember-template-compilation'),
57
+ // Dependencies of the above
58
+ 'babel-import-util': () => import('../index-BTx1k6gT.js').then(function (n) { return n.i; }),
59
+ // eslint-disable-next-line
60
+ // @ts-ignore
61
+ 'babel-plugin-debug-macros': () => import('../index-DxolpiGq.js').then(function (n) { return n.i; }),
62
+ '@embroider/macros': () => ({
63
+ // passthrough, we are not doing dead-code-elimination
64
+ macroCondition: x => x,
65
+ // I *could* actually implement this
66
+ dependencySatisfies: () => true,
67
+ isDevelopingApp: () => true,
68
+ // Trying to use warp-drive in a REPL environment may be impossible, since they
69
+ // encourage choosing your own adventure without a buildless recommended path.
70
+ // The use of nested configs (specifically env) is also problematic for
71
+ // "falling back to false" as what all other macros-using libraries use.
72
+ // (many of us have seen "Cannot access DEBUG on undefined" in build errors)
73
+ // Even with this config, I have not successfully been able to use warp-drive
74
+ // in any of my REPL-based projects.
75
+ //
76
+ // (Its also perfectly fine for warp-drive to decide they don't care about the same things I do)
77
+ getGlobalConfig: () => ({
78
+ WarpDrive: {
79
+ debug: false,
80
+ env: {
81
+ DEBUG: false,
82
+ TESTING: false,
83
+ PRODUCTION: true
84
+ },
85
+ activeLogging: false,
86
+ compatWith: '99.0',
87
+ features: {},
88
+ deprecations: {},
89
+ polyfillUUID: false,
90
+ includeDataAdapter: false
91
+ }
92
+ }),
93
+ // Private
94
+ // eslint-disable-next-line
95
+ // @ts-ignore
96
+ importSync: x => window[Symbol.for('__repl-sdk__compiler__')].resolves[x],
97
+ moduleExists: () => false
98
+ })
99
+ };
100
+ const markdownCompilationModules = {
101
+ 'rehype-raw': () => import('../index-DejgrVqh.js'),
102
+ 'rehype-stringify': () => import('../index-C371bO_b.js'),
103
+ 'remark-gfm': () => import('../index-C4AyeeIa.js'),
104
+ 'remark-parse': () => import('../index-CDSIcg03.js'),
105
+ 'remark-rehype': () => import('../index-C8S2G0FH.js'),
106
+ unified: () => import('../index-DBBNT106.js'),
107
+ 'unist-util-visit': () => import('../index-D8szzCn3.js')
108
+ };
109
+
110
+ /**
111
+ * If any real packages are defined here, they would fallback to fetching from NPM
112
+ * instead of loading from this pre-made bundle.
113
+ */
114
+ const modules = extraModules => ({
115
+ ...coreLibraries,
116
+ ...frameworkModules,
117
+ ...extraModules,
118
+ ...emberCompilationModules,
119
+ ...markdownCompilationModules
120
+ });
121
+
122
+ export { modules };
123
+ //# sourceMappingURL=known-modules.js.map
@@ -0,0 +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/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 // eslint-disable-next-line\n // @ts-ignore\n 'ember-source/dist/ember-template-compiler.js'\n ),\n 'ember-source/dist/ember-template-compiler.js': () =>\n import(\n // eslint-disable-next-line\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 // eslint-disable-next-line\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 // eslint-disable-next-line\n // @ts-ignore\n importSync: (x: string) => window[Symbol.for('__repl-sdk__compiler__')].resolves[x],\n moduleExists: () => false,\n }),\n};\n\nconst markdownCompilationModules = {\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/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","rehype-raw","rehype-stringify","remark-gfm","remark-parse","remark-rehype","unified","unist-util-visit","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,cAAc,EAAEC,MAAM,OAAO,cAAc,CAAC;AAC5C,EAAA,iBAAiB,EAAEC,MAAM,OAAO,iBAAiB,CAAC;AAClD,EAAA,6BAA6B,EAAEC,MAAM,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A,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,EAAA,YAAY,EAAEC,MAAM,OAAO,sBAAY,CAAC;AACxC,EAAA,kBAAkB,EAAEC,MAAM,OAAO,sBAAkB,CAAC;AACpD,EAAA,YAAY,EAAEC,MAAM,OAAO,sBAAY,CAAC;AACxC,EAAA,cAAc,EAAEC,MAAM,OAAO,sBAAc,CAAC;AAC5C,EAAA,eAAe,EAAEC,MAAM,OAAO,sBAAe,CAAC;AAC9CC,EAAAA,OAAO,EAAEA,MAAM,OAAO,sBAAS,CAAC;AAChC,EAAA,kBAAkB,EAAEC,MAAM,OAAO,sBAAkB;AACrD,CAAC;;AAED;AACA;AACA;AACA;AACO,MAAMC,OAAO,GAAIC,YAAuB,KAAiB;AAC9D,EAAA,GAAGlD,aAAa;AAChB,EAAA,GAAGhC,gBAAgB;AACnB,EAAA,GAAGkF,YAAY;AACf,EAAA,GAAG7C,uBAAuB;EAC1B,GAAGoC;AACL,CAAC;;;;"}
package/dist/setup.js ADDED
@@ -0,0 +1,15 @@
1
+ import { assert } from '@ember/debug';
2
+ import { getCompiler } from './services/compiler.js';
3
+
4
+ const NO_MODULES = Symbol.for('no custom modules configured');
5
+ function setup(context, options) {
6
+ const compiler = getCompiler(context);
7
+ assert(`Could not find the compiler service.`, compiler);
8
+ compiler.setup(options?.modules ?? {
9
+ [NO_MODULES]: true
10
+ }, options?.options);
11
+ return compiler;
12
+ }
13
+
14
+ export { setup };
15
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.js","sources":["../src/setup.ts"],"sourcesContent":["import { assert } from '@ember/debug';\n\nimport { getCompiler } from './services/compiler.ts';\n\nimport type { ModuleMap } from './compile/types.ts';\nimport type CompilerService from './services/compiler.ts';\n\nconst NO_MODULES = Symbol.for('no custom modules configured');\n\nexport function setup(\n context: object,\n options?: { modules?: ModuleMap; options?: object }\n): CompilerService {\n const compiler = getCompiler(context);\n\n assert(`Could not find the compiler service.`, compiler);\n\n compiler.setup(\n options?.modules ?? {\n [NO_MODULES]: true,\n },\n options?.options\n );\n\n return compiler;\n}\n"],"names":["NO_MODULES","Symbol","for","setup","context","options","compiler","getCompiler","assert","modules"],"mappings":";;;AAOA,MAAMA,UAAU,GAAGC,MAAM,CAACC,GAAG,CAAC,8BAA8B,CAAC;AAEtD,SAASC,KAAKA,CACnBC,OAAe,EACfC,OAAmD,EAClC;AACjB,EAAA,MAAMC,QAAQ,GAAGC,WAAW,CAACH,OAAO,CAAC;AAErCI,EAAAA,MAAM,CAAC,CAAA,oCAAA,CAAsC,EAAEF,QAAQ,CAAC;AAExDA,EAAAA,QAAQ,CAACH,KAAK,CACZE,OAAO,EAAEI,OAAO,IAAI;AAClB,IAAA,CAACT,UAAU,GAAG;AAChB,GAAC,EACDK,OAAO,EAAEA,OACX,CAAC;AAED,EAAA,OAAOC,QAAQ;AACjB;;;;"}
@@ -0,0 +1,33 @@
1
+ import { Compiler } from 'repl-sdk';
2
+ import { CACHE } from './compile/compile.js';
3
+ import { setup } from './setup.js';
4
+
5
+ function clearCompileCache() {
6
+ CACHE.clear();
7
+ }
8
+ function clearCache(hooks) {
9
+ hooks.beforeEach(function () {
10
+ Compiler.clearCache();
11
+ });
12
+ hooks.afterEach(function () {
13
+ Compiler.clearCache();
14
+ });
15
+ }
16
+ function setupCompiler(hooks, options) {
17
+ hooks.beforeEach(function () {
18
+ Compiler.clearCache();
19
+ if (options?.clearCache) {
20
+ clearCompileCache();
21
+ }
22
+ setup(this, options);
23
+ });
24
+ hooks.afterEach(function () {
25
+ Compiler.clearCache();
26
+ if (options?.clearCache) {
27
+ clearCompileCache();
28
+ }
29
+ });
30
+ }
31
+
32
+ export { clearCache, clearCompileCache, setupCompiler };
33
+ //# sourceMappingURL=test-support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-support.js","sources":["../src/test-support.ts"],"sourcesContent":["import { Compiler } from 'repl-sdk';\n\nimport { CACHE } from './compile/compile.ts';\nimport { setup } from './setup.ts';\n\nimport type { ModuleMap } from './compile/types.ts';\nimport type { TestContext } from '@ember/test-helpers';\nimport type { Options } from 'repl-sdk';\n\nexport function clearCompileCache() {\n CACHE.clear();\n}\n\ntype Hooks = {\n beforeEach: (\n this: object,\n callback: (...args: unknown[]) => void | Promise<void>\n ) => void | Promise<void>;\n afterEach: (\n this: object,\n callback: (...args: unknown[]) => void | Promise<void>\n ) => void | Promise<void>;\n};\n\nexport function clearCache(hooks: Hooks) {\n hooks.beforeEach(function (this: TestContext) {\n Compiler.clearCache();\n });\n hooks.afterEach(function (this: TestContext) {\n Compiler.clearCache();\n });\n}\n\nexport function setupCompiler(\n hooks: Hooks,\n options?: {\n modules?: ModuleMap;\n /**\n * Clear all the compile caches between tests.\n * This is false by default, so that tests run faster, and\n * we thrash the network less.\n */\n clearCache?: true;\n options?: Options['options'];\n }\n) {\n hooks.beforeEach(function (this: TestContext) {\n Compiler.clearCache();\n\n if (options?.clearCache) {\n clearCompileCache();\n }\n\n setup(this, options);\n });\n\n hooks.afterEach(function (this: TestContext) {\n Compiler.clearCache();\n\n if (options?.clearCache) {\n clearCompileCache();\n }\n });\n}\n"],"names":["clearCompileCache","CACHE","clear","clearCache","hooks","beforeEach","Compiler","afterEach","setupCompiler","options","setup"],"mappings":";;;;AASO,SAASA,iBAAiBA,GAAG;EAClCC,KAAK,CAACC,KAAK,EAAE;AACf;AAaO,SAASC,UAAUA,CAACC,KAAY,EAAE;EACvCA,KAAK,CAACC,UAAU,CAAC,YAA6B;IAC5CC,QAAQ,CAACH,UAAU,EAAE;AACvB,EAAA,CAAC,CAAC;EACFC,KAAK,CAACG,SAAS,CAAC,YAA6B;IAC3CD,QAAQ,CAACH,UAAU,EAAE;AACvB,EAAA,CAAC,CAAC;AACJ;AAEO,SAASK,aAAaA,CAC3BJ,KAAY,EACZK,OASC,EACD;EACAL,KAAK,CAACC,UAAU,CAAC,YAA6B;IAC5CC,QAAQ,CAACH,UAAU,EAAE;IAErB,IAAIM,OAAO,EAAEN,UAAU,EAAE;AACvBH,MAAAA,iBAAiB,EAAE;AACrB,IAAA;AAEAU,IAAAA,KAAK,CAAC,IAAI,EAAED,OAAO,CAAC;AACtB,EAAA,CAAC,CAAC;EAEFL,KAAK,CAACG,SAAS,CAAC,YAA6B;IAC3CD,QAAQ,CAACH,UAAU,EAAE;IAErB,IAAIM,OAAO,EAAEN,UAAU,EAAE;AACvBH,MAAAA,iBAAiB,EAAE;AACrB,IAAA;AACF,EAAA,CAAC,CAAC;AACJ;;;;"}
package/package.json CHANGED
@@ -1,138 +1,109 @@
1
1
  {
2
2
  "name": "ember-repl",
3
- "version": "6.0.0",
4
- "description": "Addon for enabling REPL and Playground creation with Ember/Glimmer",
3
+ "version": "7.0.1",
4
+ "type": "module",
5
+ "description": "Library for enabling REPL and Playground creation with Ember/Glimmer",
5
6
  "keywords": [
6
7
  "ember-addon"
7
8
  ],
8
9
  "repository": {
9
- "type": "git",
10
+ "type": "https",
10
11
  "url": "https://github.com/NullVoxPopuli/limber.git",
11
- "directory": "packages/ember-repl/addon"
12
+ "directory": "packages/ember-repl"
12
13
  },
13
14
  "license": "MIT",
14
15
  "author": "NullVoxPopuli",
15
- "typesVersions": {
16
- "*": {
17
- "test-support": [
18
- "declarations/test-support/index.d.ts"
19
- ],
20
- "markdown/parse": [
21
- "./declarations/compile/markdown-to-ember.d.ts"
22
- ],
23
- "*": [
24
- "declarations/*",
25
- "declarations/*/index.d.ts"
26
- ]
27
- }
28
- },
29
- "exports": {
30
- ".": {
31
- "types": "./declarations/index.d.ts",
32
- "default": "./dist/index.js"
33
- },
34
- "./formats/markdown": {
35
- "types": "./declarations/compile/formats/markdown.d.ts",
36
- "default": "./dist/compile/formats/markdown.js"
37
- },
38
- "./formats/hbs": {
39
- "types": "./declarations/compile/formats/hbs.d.ts",
40
- "default": "./dist/compile/formats/hbs.js"
41
- },
42
- "./formats/gjs": {
43
- "types": "./declarations/compile/formats/gjs/index.d.ts",
44
- "default": "./dist/compile/formats/gjs/index.js"
45
- },
46
- "./test-support": {
47
- "types": "./declarations/test-support/index.d.ts",
48
- "default": "./dist/test-support/index.js"
49
- },
50
- "./__PRIVATE__DO_NOT_USE__": {
51
- "types": "./declarations/__PRIVATE__.d.ts",
52
- "default": "./dist/__PRIVATE__.js"
53
- },
54
- "./addon-main.js": "./addon-main.cjs"
55
- },
56
16
  "files": [
57
- "src",
58
- "dist",
17
+ "addon-main.cjs",
59
18
  "declarations",
60
- "addon-main.cjs"
19
+ "dist",
20
+ "src",
21
+ "config"
61
22
  ],
62
23
  "dependencies": {
63
- "@babel/helper-plugin-utils": "^7.26.5",
64
- "@babel/standalone": "^7.26.9",
65
- "@embroider/addon-shim": "1.8.9",
66
- "@embroider/macros": "1.16.9",
67
- "babel-import-util": "^3.0.0",
68
- "babel-plugin-ember-template-compilation": "^2.3.0",
69
- "broccoli-file-creator": "^2.1.1",
70
- "change-case": "^5.4.4",
71
- "common-tags": "^1.8.2",
72
- "content-tag": "^3.1.1",
24
+ "@ember/test-helpers": "^5.1.0",
25
+ "@ember/test-waiters": "^4.1.0",
26
+ "@embroider/addon-shim": "^1.8.9",
27
+ "babel-plugin-ember-template-compilation": "^2.4.1",
28
+ "codemirror": "^6.0.2",
29
+ "content-tag": "^3.0.0",
73
30
  "decorator-transforms": "^2.3.0",
74
- "ember-resources": "^7.0.3",
75
- "line-column": "^1.0.2",
76
- "magic-string": "^0.30.17",
77
- "mdast": "^3.0.0",
78
- "parse-static-imports": "^1.1.0",
79
- "rehype-raw": "^6.1.1",
80
- "rehype-stringify": "^9.0.4",
81
- "remark-gfm": "^3.0.1",
82
- "remark-parse": "^10.0.2",
83
- "remark-rehype": "^10.1.0",
84
- "unified": "^10.1.2",
85
- "unist-util-visit": "^5.0.0",
86
- "uuid": "^10.0.0",
87
- "vfile": "^6.0.3"
31
+ "ember-primitives": "^0.40.0",
32
+ "ember-resolver": "^13.1.0",
33
+ "ember-resources": "^7.0.7",
34
+ "repl-sdk": "1.0.0"
88
35
  },
89
36
  "devDependencies": {
90
- "@babel/core": "^7.26.9",
91
- "@babel/plugin-transform-typescript": "^7.26.8",
92
- "@babel/preset-typescript": "^7.26.0",
93
- "@babel/types": "^7.26.9",
94
- "@ember/test-helpers": "^5.1.0",
95
- "@ember/test-waiters": "^4.0.0",
96
- "@embroider/addon-dev": "^7.1.1",
97
- "@glimmer/compiler": "^0.92.4",
37
+ "@arethetypeswrong/cli": "^0.18.2",
38
+ "@babel/core": "^7.28.3",
39
+ "@babel/eslint-parser": "^7.28.0",
40
+ "@babel/plugin-transform-typescript": "^7.28.0",
41
+ "@babel/runtime": "^7.28.3",
42
+ "@babel/standalone": "^7.28.3",
43
+ "@ember/app-tsconfig": "^1.0.0",
44
+ "@ember/library-tsconfig": "^1.0.0",
45
+ "@ember/test-helpers": "^5.2.1",
46
+ "@embroider/addon-dev": "^8.1.0",
47
+ "@embroider/compat": "^4.1.3",
48
+ "@embroider/core": "^4.1.3",
49
+ "@embroider/macros": "^1.18.1",
50
+ "@embroider/vite": "^1.2.0",
51
+ "@eslint/js": "^9.31.0",
98
52
  "@glimmer/component": "^2.0.0",
99
- "@glimmer/interfaces": "^0.94.5",
100
- "@glimmer/reference": "^0.92.3",
101
- "@glimmer/syntax": "^0.94.7",
102
- "@glimmer/tracking": "^1.1.2",
103
- "@glimmer/util": "^0.94.6",
104
- "@glint/core": "1.4.1-unstable.0e0d936",
105
- "@glint/environment-ember-loose": "1.4.1-unstable.0e0d936",
106
- "@glint/environment-ember-template-imports": "1.4.1-unstable.0e0d936",
107
- "@glint/template": "1.4.1-unstable.0e0d936",
108
- "@nullvoxpopuli/eslint-configs": "^5.0.0",
53
+ "@glint/ember-tsc": "^1.0.3",
54
+ "@glint/template": "^1.6.1",
55
+ "@glint/tsserver-plugin": "^2.0.3",
109
56
  "@rollup/plugin-babel": "^6.0.4",
110
- "@rollup/plugin-commonjs": "^28.0.2",
111
- "@tsconfig/ember": "^3.0.9",
112
- "@types/babel__core": "^7.20.5",
57
+ "@rollup/plugin-commonjs": "^28.0.6",
58
+ "@rollup/plugin-node-resolve": "^16.0.1",
113
59
  "@types/babel__standalone": "^7.1.9",
114
- "@types/babel__traverse": "^7.20.6",
115
- "@types/hast": "^3.0.4",
60
+ "@types/common-tags": "^1.8.4",
116
61
  "@types/mdast": "^4.0.4",
62
+ "@types/qunit": "^2.19.12",
117
63
  "@types/unist": "^3.0.3",
118
- "@types/uuid": "^10.0.0",
119
- "concurrently": "^9.1.2",
120
- "ember-resources": "^7.0.0",
121
- "ember-source": ">= 6.4.0-alpha.3",
122
- "ember-template-imports": "^4.3.0",
123
- "ember-template-lint": "^6.1.0",
124
- "eslint": "^9.21.0",
125
- "execa": "^8.0.1",
126
- "prettier": "^3.5.2",
127
- "prettier-plugin-ember-template-tag": "2.0.4",
128
- "publint": "^0.2.12",
129
- "rollup": "~4.25.0",
130
- "rollup-plugin-copy": "^3.5.0",
131
- "typescript": "5.7.3",
132
- "webpack": "^5.98.0"
64
+ "babel-import-util": "^3.0.1",
65
+ "babel-plugin-debug-macros": "^1.0.2",
66
+ "babel-plugin-ember-template-compilation": "^2.4.1",
67
+ "change-case": "^5.4.4",
68
+ "common-tags": "^1.8.2",
69
+ "concurrently": "^9.2.1",
70
+ "ember-qunit": "^9.0.2",
71
+ "ember-resolver": "^13.1.0",
72
+ "ember-source": ">= 6.8.0-alpha.7",
73
+ "eslint": "^9.34.0",
74
+ "eslint-config-prettier": "^10.1.5",
75
+ "eslint-plugin-ember": "^12.6.0",
76
+ "eslint-plugin-import": "^2.31.0",
77
+ "eslint-plugin-n": "^17.21.0",
78
+ "globals": "^16.3.0",
79
+ "prettier": "^3.4.2",
80
+ "prettier-plugin-ember-template-tag": "^2.1.0",
81
+ "publint": "^0.3.12",
82
+ "qunit": "^2.24.1",
83
+ "qunit-dom": "^3.5.0",
84
+ "rehype-raw": "^7.0.0",
85
+ "rehype-stringify": "^10.0.1",
86
+ "remark-gfm": "^4.0.1",
87
+ "remark-parse": "^11.0.0",
88
+ "remark-rehype": "^11.1.2",
89
+ "rollup": "^4.50.0",
90
+ "rollup-plugin-node-polyfills": "^0.2.1",
91
+ "testem": "^3.16.0",
92
+ "typescript": "~5.8.3",
93
+ "typescript-eslint": "^8.36.0",
94
+ "unified": "^11.0.5",
95
+ "unist-util-visit": "^5.0.0",
96
+ "uuid": "^11.1.0",
97
+ "vite": "^6.2.4",
98
+ "vite-plugin-mkcert": "^1.17.8"
133
99
  },
134
- "volta": {
135
- "extends": "../../../package.json"
100
+ "peerDependencies": {
101
+ "@glint/template": ">= 1.5.2 || ^1.6.0-alpha.1"
102
+ },
103
+ "peerDependenciesMeta": {
104
+ "@glint/template": {
105
+ "optional": true
106
+ }
136
107
  },
137
108
  "ember": {
138
109
  "edition": "octane"
@@ -140,39 +111,47 @@
140
111
  "ember-addon": {
141
112
  "version": 2,
142
113
  "type": "addon",
143
- "main": "addon-main.cjs",
144
- "externals": [
145
- "ember-template-compiler"
146
- ],
147
- "app-js": {}
114
+ "main": "config/addon-main.cjs"
148
115
  },
149
- "peerDependencies": {
150
- "@glimmer/compiler": ">= 0.86.0",
151
- "@glimmer/syntax": ">= 0.86.0",
152
- "@glint/template": "1.4.1-unstable.0e0d936",
153
- "webpack": ">= 5.92.0"
116
+ "imports": {
117
+ "#src/*": "./src/*",
118
+ "#app/*": "./tests/app/*"
154
119
  },
155
- "peerDependenciesMeta": {
156
- "@glint/template": {
157
- "optional": true
120
+ "exports": {
121
+ ".": {
122
+ "types": "./declarations/index.d.ts",
123
+ "default": "./dist/index.js"
158
124
  },
159
- "@glimmer/compiler": {
160
- "optional": true
125
+ "./test-support": {
126
+ "types": "./declarations/test-support.d.ts",
127
+ "default": "./dist/test-support.js"
161
128
  },
162
- "@glimmer/syntax": {
163
- "optional": true
129
+ "./addon-main.js": "./config/addon-main.cjs"
130
+ },
131
+ "typesVersions": {
132
+ "*": {
133
+ "*": [
134
+ "declarations/*"
135
+ ]
164
136
  }
165
137
  },
166
138
  "scripts": {
167
- "build": "rollup --config",
168
- "lint:types": "tsc --noEmit",
169
- "lint:fix": "pnpm -w exec lint fix",
170
- "start": "rollup --config --watch",
171
- "lint": "pnpm -w exec lint",
139
+ ":vite": "vite --config ./config/vite.config.mjs",
140
+ ":testem": "testem --file ./config/testem.cjs",
141
+ ":rollup": "rollup --config ./config/rollup.config.mjs",
142
+ "build": "pnpm :rollup",
143
+ "build:tests": "pnpm :vite build --mode=development --out-dir dist-tests",
144
+ "format": "prettier . --cache --write",
145
+ "lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\" --prefixColors auto",
172
146
  "lint:package": "pnpm publint",
173
- "lint:js": "pnpm -w exec lint js",
174
- "lint:js:fix": "pnpm -w exec lint js:fix",
175
- "lint:prettier:fix": "pnpm -w exec lint prettier:fix",
176
- "lint:prettier": "pnpm -w exec lint prettier"
147
+ "lint:published-types": "attw --config-path ./config/attw.json",
148
+ "lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\" --prefixColors auto && pnpm run format",
149
+ "lint:format": "prettier . --cache --check",
150
+ "lint:js": "eslint . --cache",
151
+ "lint:js:fix": "eslint . --fix",
152
+ "lint:types": "ember-tsc --noEmit",
153
+ "start": "pnpm :vite dev",
154
+ "test:ci": "pnpm :testem ci",
155
+ "test:ember": "pnpm build:tests && pnpm test:ci"
177
156
  }
178
157
  }
@@ -0,0 +1,45 @@
1
+ import { resource, resourceFactory } from 'ember-resources';
2
+
3
+ import { getCompiler } from '../services/compiler.ts';
4
+ import { compile } from './compile.ts';
5
+
6
+ import type { CompileState } from './state.ts';
7
+ import type { Format, Input } from './types.ts';
8
+
9
+ export function Compiled(markdownText: Input | (() => Input)): CompileState;
10
+ export function Compiled(
11
+ markdownText: Input | (() => Input),
12
+ format?: Format,
13
+ flavor?: string
14
+ ): CompileState;
15
+ export function Compiled(markdownText: Input | (() => Input), format: () => Format): CompileState;
16
+ export function Compiled(
17
+ markdownText: Input | (() => Input),
18
+ format: () => Format,
19
+ flavor: () => string
20
+ ): CompileState;
21
+
22
+ /**
23
+ * By default, this compiles to `glimdown`. A Markdown format which
24
+ * extracts `live` tagged code snippets and compiles them to components.
25
+ */
26
+ export function Compiled(
27
+ markdownText: Input | (() => Input),
28
+ maybeFormat?: Format | (() => Format),
29
+ maybeFlavor?: string | (() => string)
30
+ ): CompileState {
31
+ return resource(({ owner }) => {
32
+ const input = typeof markdownText === 'function' ? markdownText() : markdownText;
33
+ const format = typeof maybeFormat === 'function' ? maybeFormat() : maybeFormat || 'glimdown';
34
+ const flavor = typeof maybeFlavor === 'function' ? maybeFlavor() : maybeFlavor;
35
+
36
+ const compiler = getCompiler(owner);
37
+
38
+ return compile(compiler, input, {
39
+ format,
40
+ flavor,
41
+ });
42
+ });
43
+ }
44
+
45
+ resourceFactory(Compiled);