repl-sdk 1.0.3 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repl-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"resolve.imports": "^2.0.3",
|
|
86
86
|
"tarparser": "^0.0.5",
|
|
87
87
|
"codemirror-lang-glimdown": "2.0.1",
|
|
88
|
-
"codemirror-lang-glimmer
|
|
89
|
-
"codemirror-lang-glimmer": "2.0.1"
|
|
88
|
+
"codemirror-lang-glimmer": "2.0.1",
|
|
89
|
+
"codemirror-lang-glimmer-js": "2.0.1"
|
|
90
90
|
},
|
|
91
91
|
"volta": {
|
|
92
92
|
"extends": "../../package.json"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
// import { makeOwner } from './owner.js';
|
|
2
2
|
import { renderApp } from './render-app-island.js';
|
|
3
3
|
|
|
4
4
|
let elementId = 0;
|
|
@@ -168,6 +168,17 @@ export async function compiler(config, api) {
|
|
|
168
168
|
|
|
169
169
|
element.setAttribute(attribute, '');
|
|
170
170
|
|
|
171
|
+
// ------------------------------------------------
|
|
172
|
+
// https://github.com/emberjs/ember.js/issues/21023
|
|
173
|
+
// ------------------------------------------------
|
|
174
|
+
//
|
|
175
|
+
// const { renderComponent } = await compiler.tryResolve('@ember/renderer');
|
|
176
|
+
//
|
|
177
|
+
// const owner = makeOwner(config.owner);
|
|
178
|
+
// const result = renderComponent(compiled, { into: element, owner });
|
|
179
|
+
//
|
|
180
|
+
// return () => result.destroy();
|
|
181
|
+
|
|
171
182
|
const [application, destroyable, resolver, router, route, testWaiters, runloop] =
|
|
172
183
|
await compiler.tryResolveAll([
|
|
173
184
|
'@ember/application',
|
|
@@ -179,9 +190,6 @@ export async function compiler(config, api) {
|
|
|
179
190
|
'@ember/runloop',
|
|
180
191
|
]);
|
|
181
192
|
|
|
182
|
-
// We don't want to await here, because we need to early
|
|
183
|
-
// return the element so that the app can render in to it.
|
|
184
|
-
// (Ember will only render in to an element if it's present in the DOM)
|
|
185
193
|
return renderApp({
|
|
186
194
|
element,
|
|
187
195
|
selector: `[${attribute}]`,
|
|
@@ -15,6 +15,7 @@ let elementId = 0;
|
|
|
15
15
|
* rehypePlugins: Plugin[],
|
|
16
16
|
* ShadowComponent: string | undefined,
|
|
17
17
|
* CopyComponent: string | undefined
|
|
18
|
+
* owner?: unknown | undefined
|
|
18
19
|
* }}
|
|
19
20
|
*/
|
|
20
21
|
export function filterOptions(options) {
|
|
@@ -29,6 +30,7 @@ export function filterOptions(options) {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
return {
|
|
33
|
+
owner: options?.owner,
|
|
32
34
|
scope: /** @type {Record<string, unknown>}*/ (options?.scope || {}),
|
|
33
35
|
remarkPlugins: /** @type {Plugin[]}*/ (options?.remarkPlugins || []),
|
|
34
36
|
rehypePlugins: /** @type {Plugin[]}*/ (options?.rehypePlugins || []),
|
|
@@ -95,6 +97,18 @@ export async function compiler(config, api) {
|
|
|
95
97
|
|
|
96
98
|
element.setAttribute(attribute, '');
|
|
97
99
|
|
|
100
|
+
// ------------------------------------------------
|
|
101
|
+
// https://github.com/emberjs/ember.js/issues/21023
|
|
102
|
+
// ------------------------------------------------
|
|
103
|
+
//
|
|
104
|
+
// const { renderComponent } = await compiler.tryResolve('@ember/renderer');
|
|
105
|
+
//
|
|
106
|
+
// const result = renderComponent(compiled, {
|
|
107
|
+
// into: element,
|
|
108
|
+
// owner: userOptions.owner,
|
|
109
|
+
// });
|
|
110
|
+
//
|
|
111
|
+
// const destroy = () => result.destroy();
|
|
98
112
|
const [application, destroyable, resolver, router, route, testWaiters, runloop] =
|
|
99
113
|
await compiler.tryResolveAll([
|
|
100
114
|
'@ember/application',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isRecord } from '../../utils.js';
|
|
2
|
+
// import { makeOwner } from './owner.js';
|
|
2
3
|
import { renderApp } from './render-app-island.js';
|
|
3
4
|
|
|
4
5
|
let elementId = 0;
|
|
@@ -65,6 +66,15 @@ export async function compiler(config, api) {
|
|
|
65
66
|
|
|
66
67
|
element.setAttribute(attribute, '');
|
|
67
68
|
|
|
69
|
+
// ------------------------------------------------
|
|
70
|
+
// https://github.com/emberjs/ember.js/issues/21023
|
|
71
|
+
// ------------------------------------------------
|
|
72
|
+
//
|
|
73
|
+
// const { renderComponent } = await compiler.tryResolve('@ember/renderer');
|
|
74
|
+
// const owner = makeOwner(config.owner);
|
|
75
|
+
// const result = renderComponent(compiled, { into: element, owner });
|
|
76
|
+
//
|
|
77
|
+
// return () => result.destroy();
|
|
68
78
|
const [application, destroyable, resolver, router, route, testWaiters, runloop] =
|
|
69
79
|
await compiler.tryResolveAll([
|
|
70
80
|
'@ember/application',
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {unknown} [owner]
|
|
3
|
+
*/
|
|
4
|
+
export function makeOwner(owner) {
|
|
5
|
+
return {
|
|
6
|
+
name: 'inner owner',
|
|
7
|
+
/**
|
|
8
|
+
* @param {string} name
|
|
9
|
+
*/
|
|
10
|
+
lookup(name) {
|
|
11
|
+
if (typeof owner !== 'object') return;
|
|
12
|
+
if (!owner) return;
|
|
13
|
+
if (!('lookup' in owner)) return;
|
|
14
|
+
if (typeof owner.lookup !== 'function') return;
|
|
15
|
+
|
|
16
|
+
return owner.lookup(name);
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* @param {string} name
|
|
20
|
+
*/
|
|
21
|
+
resolveRegistration(name) {
|
|
22
|
+
if (typeof owner !== 'object') return;
|
|
23
|
+
if (!owner) return;
|
|
24
|
+
if (!('resolveRegistration' in owner)) return;
|
|
25
|
+
if (typeof owner.resolveRegistration !== 'function') return;
|
|
26
|
+
|
|
27
|
+
return owner.resolveRegistration(name);
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|