repl-sdk 1.5.2 → 1.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repl-sdk",
3
- "version": "1.5.2",
3
+ "version": "1.6.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -50,7 +50,7 @@
50
50
  "prettier": "^3.7.4",
51
51
  "publint": "^0.3.16",
52
52
  "typescript": "^5.9.3",
53
- "vite": "^7.3.1",
53
+ "vite": "^8.0.8",
54
54
  "vite-plugin-dts": "4.5.4",
55
55
  "vitest": "^4.0.18"
56
56
  },
@@ -96,9 +96,9 @@
96
96
  "unified": "^11.0.5",
97
97
  "unist-util-visit": "^5.0.0",
98
98
  "vfile": "^6.0.3",
99
- "codemirror-lang-glimdown": "^2.0.3",
100
- "codemirror-lang-glimmer": "^2.0.3",
101
- "codemirror-lang-glimmer-js": "^2.0.3"
99
+ "codemirror-lang-glimdown": "^2.0.4",
100
+ "codemirror-lang-glimmer": "^2.0.4",
101
+ "codemirror-lang-glimmer-js": "^2.0.4"
102
102
  },
103
103
  "volta": {
104
104
  "extends": "../../package.json"
@@ -170,7 +170,18 @@ export async function compiler(config, api) {
170
170
  const { renderComponent } = await compiler.tryResolve('@ember/renderer');
171
171
 
172
172
  const owner = makeOwner(config.owner);
173
- const result = renderComponent(compiled, { into: element, owner });
173
+ const args = /** @type {Record<string, unknown> | undefined} */ (
174
+ extra && typeof extra === 'object' && 'args' in extra
175
+ ? /** @type {Record<string, unknown>} */ (extra).args
176
+ : undefined
177
+ );
178
+ const result = renderComponent(compiled, {
179
+ into: element,
180
+ owner,
181
+ ...(args ? { args } : {}),
182
+ });
183
+
184
+ compiler.announce('info', 'Ember Island Rendered');
174
185
 
175
186
  return () => result.destroy();
176
187
  },
@@ -98,9 +98,16 @@ export async function compiler(config, api) {
98
98
 
99
99
  const { renderComponent } = await compiler.tryResolve('@ember/renderer');
100
100
 
101
+ const args = /** @type {Record<string, unknown> | undefined} */ (
102
+ extra && typeof extra === 'object' && 'args' in extra
103
+ ? /** @type {Record<string, unknown>} */ (extra).args
104
+ : undefined
105
+ );
106
+
101
107
  const result = renderComponent(compiled, {
102
108
  into: element,
103
109
  owner: userOptions.owner,
110
+ ...(args ? { args } : {}),
104
111
  });
105
112
 
106
113
  const destroy = () => result.destroy();
@@ -67,7 +67,18 @@ export async function compiler(config, api) {
67
67
 
68
68
  const { renderComponent } = await compiler.tryResolve('@ember/renderer');
69
69
  const owner = makeOwner(config.owner);
70
- const result = renderComponent(compiled, { into: element, owner });
70
+ const args = /** @type {Record<string, unknown> | undefined} */ (
71
+ extra && typeof extra === 'object' && 'args' in extra
72
+ ? /** @type {Record<string, unknown>} */ (extra).args
73
+ : undefined
74
+ );
75
+ const result = renderComponent(compiled, {
76
+ into: element,
77
+ owner,
78
+ ...(args ? { args } : {}),
79
+ });
80
+
81
+ compiler.announce('info', 'Ember Island Rendered');
71
82
 
72
83
  return () => result.destroy();
73
84
  },
package/src/index.js CHANGED
@@ -345,7 +345,7 @@ export class Compiler {
345
345
  /**
346
346
  * @param {string} format
347
347
  * @param {string} text
348
- * @param {{ fileName?: string, flavor?: string, [key: string]: unknown }} [ options ]
348
+ * @param {{ fileName?: string, flavor?: string, args?: Record<string, unknown>, [key: string]: unknown }} [ options ]
349
349
  * @returns {Promise<{ element: HTMLElement, destroy: () => void }>}
350
350
  */
351
351
  async compile(format, text, options = {}) {
@@ -411,6 +411,7 @@ export class Compiler {
411
411
  return this.#render(compiler, value, {
412
412
  ...extras,
413
413
  compiled: value,
414
+ ...(opts.args ? { args: opts.args } : {}),
414
415
  });
415
416
  }
416
417
 
@@ -421,7 +422,10 @@ export class Compiler {
421
422
 
422
423
  this.#log('[compile] preparing to render', defaultExport, extras);
423
424
 
424
- return this.#render(compiler, defaultExport, extras);
425
+ return this.#render(compiler, defaultExport, {
426
+ ...extras,
427
+ ...(opts.args ? { args: opts.args } : {}),
428
+ });
425
429
  }
426
430
 
427
431
  #compilerCache = new WeakMap();