ember-repl 3.0.0-beta.4 → 3.0.0-beta.5
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/browser/cjs/eval.d.ts +9 -0
- package/declarations/browser/cjs/eval.d.ts.map +1 -0
- package/declarations/browser/cjs/index.d.ts +7 -0
- package/declarations/browser/cjs/index.d.ts.map +1 -0
- package/declarations/browser/compile/formats.d.ts +16 -0
- package/declarations/browser/compile/formats.d.ts.map +1 -0
- package/{dist → declarations}/browser/compile/index.d.ts +14 -13
- package/declarations/browser/compile/index.d.ts.map +1 -0
- package/{dist → declarations}/browser/compile/markdown-to-ember.d.ts +5 -4
- package/declarations/browser/compile/markdown-to-ember.d.ts.map +1 -0
- package/declarations/browser/compile/types.d.ts +7 -0
- package/declarations/browser/compile/types.d.ts.map +1 -0
- package/declarations/browser/esm/index.d.ts +8 -0
- package/declarations/browser/esm/index.d.ts.map +1 -0
- package/{dist → declarations}/browser/eti/babel-plugin.d.ts +2 -2
- package/declarations/browser/eti/babel-plugin.d.ts.map +1 -0
- package/declarations/browser/eti/debug.d.ts +2 -0
- package/declarations/browser/eti/debug.d.ts.map +1 -0
- package/{dist → declarations}/browser/eti/parse-templates.d.ts +7 -7
- package/declarations/browser/eti/parse-templates.d.ts.map +1 -0
- package/{dist → declarations}/browser/eti/preprocess.d.ts +3 -2
- package/declarations/browser/eti/preprocess.d.ts.map +1 -0
- package/{dist → declarations}/browser/eti/template-tag-transform.d.ts +2 -2
- package/declarations/browser/eti/template-tag-transform.d.ts.map +1 -0
- package/declarations/browser/eti/util.d.ts +14 -0
- package/declarations/browser/eti/util.d.ts.map +1 -0
- package/declarations/browser/gjs.d.ts +4 -0
- package/declarations/browser/gjs.d.ts.map +1 -0
- package/{dist → declarations}/browser/hbs.d.ts +4 -3
- package/declarations/browser/hbs.d.ts.map +1 -0
- package/declarations/browser/index.d.ts +7 -0
- package/declarations/browser/index.d.ts.map +1 -0
- package/{dist → declarations}/browser/js.d.ts +3 -3
- package/declarations/browser/js.d.ts.map +1 -0
- package/{dist → declarations}/browser/known-modules.d.ts +6 -5
- package/declarations/browser/known-modules.d.ts.map +1 -0
- package/declarations/browser/types.d.ts +21 -0
- package/declarations/browser/types.d.ts.map +1 -0
- package/{dist → declarations}/browser/utils.d.ts +4 -4
- package/declarations/browser/utils.d.ts.map +1 -0
- package/declarations/test-support/index.d.ts +2 -0
- package/declarations/test-support/index.d.ts.map +1 -0
- package/dist/browser/cjs/eval.js.map +1 -1
- package/dist/browser/cjs/index.js.map +1 -1
- package/dist/browser/compile/formats.js.map +1 -1
- package/dist/browser/compile/index.js.map +1 -1
- package/dist/browser/compile/markdown-to-ember.js +2 -2
- package/dist/browser/compile/markdown-to-ember.js.map +1 -1
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/eti/babel-plugin.js.map +1 -1
- package/dist/browser/eti/parse-templates.js.map +1 -1
- package/dist/browser/eti/preprocess.js +2 -167
- package/dist/browser/eti/preprocess.js.map +1 -1
- package/dist/browser/eti/template-tag-transform.js.map +1 -1
- package/dist/browser/eti/util.js.map +1 -1
- package/dist/browser/gjs.js.map +1 -1
- package/dist/browser/hbs.js.map +1 -1
- package/dist/browser/js.js.map +1 -1
- package/dist/test-support/index.js.map +1 -1
- package/package.json +76 -56
- package/src/browser/cjs/eval.ts +2 -2
- package/src/browser/cjs/index.ts +4 -4
- package/src/browser/compile/formats.ts +14 -11
- package/src/browser/compile/index.ts +6 -6
- package/src/browser/compile/markdown-to-ember.ts +5 -5
- package/src/browser/esm/index.ts +4 -4
- package/src/browser/eti/babel-plugin.ts +2 -2
- package/src/browser/eti/parse-templates.ts +2 -2
- package/src/browser/eti/preprocess.ts +3 -3
- package/src/browser/eti/template-tag-transform.ts +1 -1
- package/src/browser/eti/util.ts +1 -1
- package/src/browser/gjs.ts +4 -4
- package/src/browser/hbs.ts +2 -2
- package/src/browser/index.ts +5 -5
- package/src/browser/js.ts +3 -3
- package/src/test-support/index.ts +1 -1
- package/dist/browser/cjs/eval.d.ts +0 -10
- package/dist/browser/cjs/eval.d.ts.map +0 -1
- package/dist/browser/cjs/index.d.ts +0 -7
- package/dist/browser/compile/formats.d.ts +0 -16
- package/dist/browser/compile/types.d.ts +0 -7
- package/dist/browser/esm/index.d.ts +0 -8
- package/dist/browser/eti/debug.d.ts +0 -2
- package/dist/browser/eti/util.d.ts +0 -14
- package/dist/browser/gjs.d.ts +0 -4
- package/dist/browser/index.d.ts +0 -6
- package/dist/browser/types.d.ts +0 -21
- package/dist/test-support/index.d.ts +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/test-support/index.ts"],"sourcesContent":["import { CACHE } from '../browser/compile/index';\n\nexport function clearCompileCache() {\n CACHE.clear();\n}\n"],"names":["clearCompileCache","CACHE","clear"],"mappings":";;AAEO,SAASA,iBAAiBA,GAAG;EAClCC,KAAK,CAACC,KAAK,EAAE,CAAA;AACf;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/test-support/index.ts"],"sourcesContent":["import { CACHE } from '../browser/compile/index.ts';\n\nexport function clearCompileCache() {\n CACHE.clear();\n}\n"],"names":["clearCompileCache","CACHE","clear"],"mappings":";;AAEO,SAASA,iBAAiBA,GAAG;EAClCC,KAAK,CAACC,KAAK,EAAE,CAAA;AACf;;;;"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-repl",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.5",
|
|
4
4
|
"description": "Addon for enabling REPL and Playground creation with Ember/Glimmer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
7
7
|
],
|
|
8
8
|
"repository": {
|
|
9
|
-
"type": "
|
|
10
|
-
"url": "https://github.com/NullVoxPopuli/limber",
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/NullVoxPopuli/limber.git",
|
|
11
11
|
"directory": "packages/ember-repl/addon"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
@@ -15,63 +15,76 @@
|
|
|
15
15
|
"typesVersions": {
|
|
16
16
|
"*": {
|
|
17
17
|
"test-support": [
|
|
18
|
-
"
|
|
18
|
+
"declarations/test-support/index.d.ts"
|
|
19
19
|
],
|
|
20
20
|
"markdown/parse": [
|
|
21
|
-
"./
|
|
21
|
+
"./declarations/browser/compile/markdown-to-ember.d.ts"
|
|
22
22
|
],
|
|
23
23
|
"*": [
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"declarations/browser/*",
|
|
25
|
+
"declarations/browser/*/index.d.ts"
|
|
26
26
|
]
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"exports": {
|
|
30
|
-
".":
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./declarations/browser/index.d.ts",
|
|
32
|
+
"default": "./dist/browser/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./esm": {
|
|
35
|
+
"types": "./declarations/browser/esm/index.d.ts",
|
|
36
|
+
"default": "./dist/browser/esm/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./markdown/parse": {
|
|
39
|
+
"types": "./declarations/browser/compile/markdown-to-ember.d.ts",
|
|
40
|
+
"default": "./dist/browser/compile/markdown-to-ember.js"
|
|
41
|
+
},
|
|
33
42
|
"./ember-cli": {
|
|
34
43
|
"require": "./src/build/ember-cli.cjs"
|
|
35
44
|
},
|
|
36
|
-
"./test-support":
|
|
45
|
+
"./test-support": {
|
|
46
|
+
"types": "./declarations/test-support/index.d.ts",
|
|
47
|
+
"default": "./dist/test-support/index.js"
|
|
48
|
+
},
|
|
37
49
|
"./addon-main.js": "./addon-main.cjs"
|
|
38
50
|
},
|
|
39
51
|
"files": [
|
|
40
52
|
"src",
|
|
41
53
|
"dist",
|
|
54
|
+
"declarations",
|
|
42
55
|
"addon-main.cjs"
|
|
43
56
|
],
|
|
44
57
|
"dependencies": {
|
|
45
58
|
"@babel/helper-plugin-utils": "^7.22.5",
|
|
46
|
-
"@babel/standalone": "^7.22.
|
|
47
|
-
"@embroider/addon-shim": "1.8.
|
|
48
|
-
"@embroider/macros": "1.
|
|
49
|
-
"babel-import-util": "^1.
|
|
50
|
-
"babel-plugin-ember-template-compilation": "^2.0
|
|
59
|
+
"@babel/standalone": "^7.22.10",
|
|
60
|
+
"@embroider/addon-shim": "1.8.6",
|
|
61
|
+
"@embroider/macros": "1.13.1",
|
|
62
|
+
"babel-import-util": "^1.4.1",
|
|
63
|
+
"babel-plugin-ember-template-compilation": "^2.2.0",
|
|
51
64
|
"broccoli-file-creator": "^2.1.1",
|
|
52
65
|
"change-case": "^4.1.2",
|
|
53
66
|
"common-tags": "^1.8.2",
|
|
54
67
|
"line-column": "^1.0.2",
|
|
55
|
-
"magic-string": "^0.30.
|
|
68
|
+
"magic-string": "^0.30.2",
|
|
56
69
|
"mdast": "^3.0.0",
|
|
57
70
|
"parse-static-imports": "^1.1.0",
|
|
58
71
|
"rehype-raw": "^6.1.1",
|
|
59
|
-
"rehype-stringify": "^9.0.
|
|
72
|
+
"rehype-stringify": "^9.0.4",
|
|
60
73
|
"remark-gfm": "^3.0.1",
|
|
61
74
|
"remark-parse": "^10.0.2",
|
|
62
75
|
"remark-rehype": "^10.1.0",
|
|
63
76
|
"unified": "^10.1.2",
|
|
64
|
-
"unist-util-visit": "^
|
|
77
|
+
"unist-util-visit": "^5.0.0",
|
|
65
78
|
"uuid": "^9.0.0",
|
|
66
|
-
"vfile": "^6.0.
|
|
79
|
+
"vfile": "^6.0.1"
|
|
67
80
|
},
|
|
68
81
|
"devDependencies": {
|
|
69
|
-
"@babel/core": "^7.22.
|
|
82
|
+
"@babel/core": "^7.22.10",
|
|
70
83
|
"@babel/preset-typescript": "^7.22.5",
|
|
71
|
-
"@babel/types": "^7.22.
|
|
72
|
-
"@ember/test-helpers": "^3.
|
|
84
|
+
"@babel/types": "^7.22.10",
|
|
85
|
+
"@ember/test-helpers": "^3.2.0",
|
|
73
86
|
"@ember/test-waiters": "^3.0.2",
|
|
74
|
-
"@embroider/addon-dev": "
|
|
87
|
+
"@embroider/addon-dev": "4.1.0",
|
|
75
88
|
"@glimmer/compiler": "^0.84.3",
|
|
76
89
|
"@glimmer/component": "^1.1.2",
|
|
77
90
|
"@glimmer/interfaces": "^0.84.3",
|
|
@@ -79,39 +92,39 @@
|
|
|
79
92
|
"@glimmer/syntax": "^0.84.3",
|
|
80
93
|
"@glimmer/tracking": "^1.1.2",
|
|
81
94
|
"@glimmer/util": "^0.84.3",
|
|
82
|
-
"@glint/core": "^1.0
|
|
83
|
-
"@glint/environment-ember-loose": "^1.0
|
|
84
|
-
"@glint/environment-ember-template-imports": "^1.0
|
|
85
|
-
"@glint/template": "^1.0
|
|
86
|
-
"@nullvoxpopuli/eslint-configs": "^3.
|
|
87
|
-
"@rollup/plugin-
|
|
88
|
-
"@
|
|
89
|
-
"@
|
|
95
|
+
"@glint/core": "^1.1.0",
|
|
96
|
+
"@glint/environment-ember-loose": "^1.1.0",
|
|
97
|
+
"@glint/environment-ember-template-imports": "^1.1.0",
|
|
98
|
+
"@glint/template": "^1.1.0",
|
|
99
|
+
"@nullvoxpopuli/eslint-configs": "^3.2.2",
|
|
100
|
+
"@rollup/plugin-babel": "^6.0.3",
|
|
101
|
+
"@rollup/plugin-commonjs": "^25.0.4",
|
|
102
|
+
"@tsconfig/ember": "^3.0.0",
|
|
103
|
+
"@types/babel__core": "^7.20.1",
|
|
90
104
|
"@types/babel__standalone": "^7.1.4",
|
|
91
|
-
"@types/babel__traverse": "^7.
|
|
92
|
-
"@types/hast": "^
|
|
93
|
-
"@types/mdast": "^
|
|
94
|
-
"@types/unist": "^
|
|
95
|
-
"@types/uuid": "^9.0.
|
|
96
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
97
|
-
"@typescript-eslint/parser": "^
|
|
105
|
+
"@types/babel__traverse": "^7.20.1",
|
|
106
|
+
"@types/hast": "^3.0.0",
|
|
107
|
+
"@types/mdast": "^4.0.0",
|
|
108
|
+
"@types/unist": "^3.0.0",
|
|
109
|
+
"@types/uuid": "^9.0.2",
|
|
110
|
+
"@typescript-eslint/eslint-plugin": "^6.4.0",
|
|
111
|
+
"@typescript-eslint/parser": "^6.4.0",
|
|
98
112
|
"concurrently": "^8.2.0",
|
|
99
|
-
"ember-resources": "^6.
|
|
100
|
-
"ember-source": "^5.
|
|
113
|
+
"ember-resources": "^6.4.0",
|
|
114
|
+
"ember-source": "^5.2.0",
|
|
101
115
|
"ember-template-imports": "^3.4.2",
|
|
102
|
-
"ember-template-lint": "^5.
|
|
103
|
-
"eslint": "^8.
|
|
104
|
-
"eslint-plugin-ember": "^11.
|
|
116
|
+
"ember-template-lint": "^5.11.2",
|
|
117
|
+
"eslint": "^8.47.0",
|
|
118
|
+
"eslint-plugin-ember": "^11.10.0",
|
|
105
119
|
"eslint-plugin-node": "^11.1.0",
|
|
106
|
-
"eslint-plugin-prettier": "^
|
|
107
|
-
"prettier": "^
|
|
108
|
-
"prettier-plugin-ember-template-tag": "^0.
|
|
109
|
-
"publint": "^0.1
|
|
110
|
-
"rollup": "~3.
|
|
120
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
121
|
+
"prettier": "^3.0.2",
|
|
122
|
+
"prettier-plugin-ember-template-tag": "^1.0.2",
|
|
123
|
+
"publint": "^0.2.1",
|
|
124
|
+
"rollup": "~3.28.0",
|
|
111
125
|
"rollup-plugin-copy": "^3.4.0",
|
|
112
126
|
"rollup-plugin-glimmer-template-tag": "^0.4.1",
|
|
113
|
-
"
|
|
114
|
-
"typescript": "^5.0.4",
|
|
127
|
+
"typescript": "^5.1.6",
|
|
115
128
|
"@nullvoxpopuli/limber-untyped": "0.0.0"
|
|
116
129
|
},
|
|
117
130
|
"volta": {
|
|
@@ -130,13 +143,20 @@
|
|
|
130
143
|
"@glimmer/compiler": "^0.84.3",
|
|
131
144
|
"@glimmer/component": "^1.1.2",
|
|
132
145
|
"@glimmer/syntax": "^0.84.3",
|
|
133
|
-
"@glint/template": "^1.0
|
|
134
|
-
"ember-resources": "^6.
|
|
135
|
-
"ember-source": "^5.
|
|
146
|
+
"@glint/template": "^1.1.0",
|
|
147
|
+
"ember-resources": "^6.4.0",
|
|
148
|
+
"ember-source": "^5.2.0"
|
|
149
|
+
},
|
|
150
|
+
"engines": {
|
|
151
|
+
"node": ">= v16",
|
|
152
|
+
"npm": "use pnpm",
|
|
153
|
+
"yarn": "use pnpm"
|
|
136
154
|
},
|
|
137
155
|
"scripts": {
|
|
138
|
-
"build": "
|
|
139
|
-
"
|
|
156
|
+
"build": "concurrently 'npm:build:*'",
|
|
157
|
+
"build:js": "rollup --config",
|
|
158
|
+
"build:types": "tsc --emitDeclarationOnly --noEmit false",
|
|
159
|
+
"lint:types": "tsc --noEmit",
|
|
140
160
|
"lint:fix": "pnpm -w exec lint fix",
|
|
141
161
|
"start": "rollup --config --watch",
|
|
142
162
|
"lint": "pnpm -w exec lint",
|
package/src/browser/cjs/eval.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
-
import { modules } from '../known-modules';
|
|
2
|
+
import { modules } from '../known-modules.ts';
|
|
3
3
|
|
|
4
|
-
import type { ExtraModules } from '../types';
|
|
4
|
+
import type { ExtraModules } from '../types.ts';
|
|
5
5
|
import type Component from '@glimmer/component';
|
|
6
6
|
|
|
7
7
|
export function evalSnippet(
|
package/src/browser/cjs/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { preprocess, transform } from '../gjs';
|
|
2
|
-
import { nameFor } from '../utils';
|
|
3
|
-
import { evalSnippet } from './eval';
|
|
1
|
+
import { preprocess, transform } from '../gjs.ts';
|
|
2
|
+
import { nameFor } from '../utils.ts';
|
|
3
|
+
import { evalSnippet } from './eval.ts';
|
|
4
4
|
|
|
5
|
-
import type { CompileResult, ExtraModules } from '../types';
|
|
5
|
+
import type { CompileResult, ExtraModules } from '../types.ts';
|
|
6
6
|
import type { ComponentLike } from '@glint/template';
|
|
7
7
|
|
|
8
8
|
export interface Info {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { invocationName } from '../utils';
|
|
1
|
+
import { invocationName } from '../utils.ts';
|
|
2
2
|
|
|
3
|
-
import type { CompileResult } from '../types';
|
|
4
|
-
import type { ExtractedCode } from './markdown-to-ember';
|
|
5
|
-
import type { EvalImportMap, ScopeMap } from './types';
|
|
3
|
+
import type { CompileResult } from '../types.ts';
|
|
4
|
+
import type { ExtractedCode } from './markdown-to-ember.ts';
|
|
5
|
+
import type { EvalImportMap, ScopeMap } from './types.ts';
|
|
6
6
|
|
|
7
7
|
async function compileAll(js: { code: string }[], importMap?: EvalImportMap) {
|
|
8
8
|
let modules = await Promise.all(
|
|
@@ -19,7 +19,7 @@ export async function compileGJS(
|
|
|
19
19
|
importMap?: EvalImportMap
|
|
20
20
|
): Promise<CompileResult> {
|
|
21
21
|
try {
|
|
22
|
-
let { compileJS } = await import('../js');
|
|
22
|
+
let { compileJS } = await import('../js.ts');
|
|
23
23
|
|
|
24
24
|
return await compileJS(gjsInput, importMap);
|
|
25
25
|
} catch (error) {
|
|
@@ -35,7 +35,7 @@ export async function compileHBS(
|
|
|
35
35
|
}
|
|
36
36
|
): Promise<CompileResult> {
|
|
37
37
|
try {
|
|
38
|
-
let { compileHBS } = await import('../hbs');
|
|
38
|
+
let { compileHBS } = await import('../hbs.ts');
|
|
39
39
|
|
|
40
40
|
return compileHBS(hbsInput, options);
|
|
41
41
|
} catch (error) {
|
|
@@ -106,7 +106,7 @@ export async function compileMD(
|
|
|
106
106
|
* compiled rootTemplate can invoke them
|
|
107
107
|
*/
|
|
108
108
|
try {
|
|
109
|
-
let { parseMarkdown } = await import('./markdown-to-ember');
|
|
109
|
+
let { parseMarkdown } = await import('./markdown-to-ember.ts');
|
|
110
110
|
let { templateOnlyGlimdown, blocks } = await parseMarkdown(glimdownInput, {
|
|
111
111
|
CopyComponent: options?.CopyComponent,
|
|
112
112
|
ShadowComponent: options?.ShadowComponent,
|
|
@@ -151,11 +151,14 @@ export async function compileMD(
|
|
|
151
151
|
* Step 4: Compile the Ember Template
|
|
152
152
|
*/
|
|
153
153
|
try {
|
|
154
|
-
let localScope = scope.reduce(
|
|
155
|
-
accum
|
|
154
|
+
let localScope = scope.reduce(
|
|
155
|
+
(accum, { component, name }) => {
|
|
156
|
+
accum[invocationName(name)] = component;
|
|
156
157
|
|
|
157
|
-
|
|
158
|
-
|
|
158
|
+
return accum;
|
|
159
|
+
},
|
|
160
|
+
{} as Record<string, unknown>
|
|
161
|
+
);
|
|
159
162
|
|
|
160
163
|
return await compileHBS(rootTemplate, {
|
|
161
164
|
moduleName: 'DynamicRootTemplate',
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { cell, resource, resourceFactory } from 'ember-resources';
|
|
2
2
|
|
|
3
|
-
import { nameFor } from '../utils';
|
|
3
|
+
import { nameFor } from '../utils.ts';
|
|
4
4
|
import {
|
|
5
5
|
compileGJS as processGJS,
|
|
6
6
|
compileHBS as processHBS,
|
|
7
7
|
compileMD as processMD,
|
|
8
|
-
} from './formats';
|
|
8
|
+
} from './formats.ts';
|
|
9
9
|
|
|
10
|
-
import type { CompileResult } from '../types';
|
|
11
|
-
import type { EvalImportMap, ScopeMap } from './types';
|
|
10
|
+
import type { CompileResult } from '../types.ts';
|
|
11
|
+
import type { EvalImportMap, ScopeMap } from './types.ts';
|
|
12
12
|
import type { ComponentLike } from '@glint/template';
|
|
13
13
|
type Format = 'glimdown' | 'gjs' | 'hbs';
|
|
14
14
|
|
|
@@ -114,7 +114,7 @@ type ExtraOptions =
|
|
|
114
114
|
*/
|
|
115
115
|
export interface Value {
|
|
116
116
|
isReady: boolean;
|
|
117
|
-
error:
|
|
117
|
+
error: string | null;
|
|
118
118
|
component: ComponentLike;
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -139,7 +139,7 @@ export function buildCompiler(
|
|
|
139
139
|
|
|
140
140
|
let input = typeof markdownText === 'function' ? markdownText() : markdownText;
|
|
141
141
|
let ready = cell(false);
|
|
142
|
-
let error = cell();
|
|
142
|
+
let error = cell<string | null>();
|
|
143
143
|
let result = cell<ComponentLike>();
|
|
144
144
|
|
|
145
145
|
if (input) {
|
|
@@ -6,7 +6,7 @@ import remarkRehype from 'remark-rehype';
|
|
|
6
6
|
import { unified } from 'unified';
|
|
7
7
|
import { visit } from 'unist-util-visit';
|
|
8
8
|
|
|
9
|
-
import { invocationOf, nameFor } from '../utils';
|
|
9
|
+
import { invocationOf, nameFor } from '../utils.ts';
|
|
10
10
|
|
|
11
11
|
import type { Node } from 'hast';
|
|
12
12
|
import type { Code, Text } from 'mdast';
|
|
@@ -114,9 +114,9 @@ function liveCodeExtraction(options: Options = {}) {
|
|
|
114
114
|
|
|
115
115
|
function enhance(code: Code) {
|
|
116
116
|
code.data ??= {};
|
|
117
|
-
code.data['hProperties'] ??= {};
|
|
117
|
+
(code.data as any)['hProperties'] ??= {};
|
|
118
118
|
// This is secret-to-us-only API, so we don't really care about the type
|
|
119
|
-
(code.data
|
|
119
|
+
(code.data as any)['hProperties'][GLIMDOWN_PREVIEW] = true;
|
|
120
120
|
|
|
121
121
|
return {
|
|
122
122
|
data: {
|
|
@@ -138,8 +138,8 @@ function liveCodeExtraction(options: Options = {}) {
|
|
|
138
138
|
|
|
139
139
|
return function transformer(tree: Parent, file: VFileWithMeta) {
|
|
140
140
|
visit(tree, ['code'], function (node, index, parent) {
|
|
141
|
-
if (parent === null) return;
|
|
142
|
-
if (index === null) return;
|
|
141
|
+
if (parent === null || parent === undefined) return;
|
|
142
|
+
if (index === null || index === undefined) return;
|
|
143
143
|
|
|
144
144
|
if (!isRelevantCode(node as Code)) {
|
|
145
145
|
let enhanced = enhance(node as Code);
|
package/src/browser/esm/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { preprocess, transform } from '../gjs';
|
|
2
|
-
import { modules } from '../known-modules';
|
|
3
|
-
import { nameFor } from '../utils';
|
|
1
|
+
import { preprocess, transform } from '../gjs.ts';
|
|
2
|
+
import { modules } from '../known-modules.ts';
|
|
3
|
+
import { nameFor } from '../utils.ts';
|
|
4
4
|
|
|
5
|
-
import type { CompileResult, ExtraModules } from '../types';
|
|
5
|
+
import type { CompileResult, ExtraModules } from '../types.ts';
|
|
6
6
|
import type Component from '@glimmer/component';
|
|
7
7
|
import type { ComponentLike } from '@glint/template';
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ImportUtil } from 'babel-import-util';
|
|
2
2
|
|
|
3
|
-
import { transformTemplateTag } from './template-tag-transform';
|
|
4
|
-
import * as util from './util';
|
|
3
|
+
import { transformTemplateTag } from './template-tag-transform.ts';
|
|
4
|
+
import * as util from './util.ts';
|
|
5
5
|
|
|
6
6
|
import type { NodePath } from '@babel/traverse';
|
|
7
7
|
import type { CallExpression, Class, Program } from '@babel/types';
|
|
@@ -7,10 +7,10 @@ import { getTemplateLocals } from '@glimmer/syntax';
|
|
|
7
7
|
import lineColumn from 'line-column';
|
|
8
8
|
import MagicString from 'magic-string';
|
|
9
9
|
|
|
10
|
-
import { expect } from './debug';
|
|
11
|
-
import { parseTemplates } from './parse-templates';
|
|
10
|
+
import { expect } from './debug.ts';
|
|
11
|
+
import { parseTemplates } from './parse-templates.ts';
|
|
12
12
|
|
|
13
|
-
import type { ParseTemplatesOptions, TemplateMatch } from './parse-templates';
|
|
13
|
+
import type { ParseTemplatesOptions, TemplateMatch } from './parse-templates.ts';
|
|
14
14
|
|
|
15
15
|
interface PreprocessOptionsEager {
|
|
16
16
|
importIdentifier?: string;
|
package/src/browser/eti/util.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TemplateMatch } from './parse-templates';
|
|
1
|
+
import type { TemplateMatch } from './parse-templates.ts';
|
|
2
2
|
import type { NodePath } from '@babel/traverse';
|
|
3
3
|
import type { CallExpression } from '@babel/types';
|
|
4
4
|
import type { ImportUtil } from 'babel-import-util';
|
package/src/browser/gjs.ts
CHANGED
|
@@ -3,11 +3,11 @@ import { importSync } from '@embroider/macros';
|
|
|
3
3
|
import babelPluginEmberTemplateCompilation from 'babel-plugin-ember-template-compilation';
|
|
4
4
|
|
|
5
5
|
// TODO: use real packages, and not these copied files from ember-template-imports
|
|
6
|
-
import babelPluginIntermediateGJS from './eti/babel-plugin';
|
|
7
|
-
import { preprocessEmbeddedTemplates } from './eti/preprocess';
|
|
8
|
-
import { TEMPLATE_TAG_NAME, TEMPLATE_TAG_PLACEHOLDER } from './eti/util';
|
|
6
|
+
import babelPluginIntermediateGJS from './eti/babel-plugin.ts';
|
|
7
|
+
import { preprocessEmbeddedTemplates } from './eti/preprocess.ts';
|
|
8
|
+
import { TEMPLATE_TAG_NAME, TEMPLATE_TAG_PLACEHOLDER } from './eti/util.ts';
|
|
9
9
|
|
|
10
|
-
import type { Babel } from './types';
|
|
10
|
+
import type { Babel } from './types.ts';
|
|
11
11
|
|
|
12
12
|
const compiler = importSync('ember-source/dist/ember-template-compiler.js');
|
|
13
13
|
|
package/src/browser/hbs.ts
CHANGED
|
@@ -11,9 +11,9 @@ import { on } from '@ember/modifier';
|
|
|
11
11
|
import { createTemplateFactory } from '@ember/template-factory';
|
|
12
12
|
import { importSync } from '@embroider/macros';
|
|
13
13
|
|
|
14
|
-
import { nameFor } from './utils';
|
|
14
|
+
import { nameFor } from './utils.ts';
|
|
15
15
|
|
|
16
|
-
import type { CompileResult } from './types';
|
|
16
|
+
import type { CompileResult } from './types.ts';
|
|
17
17
|
import type { ComponentLike } from '@glint/template';
|
|
18
18
|
|
|
19
19
|
// These things are pre-bundled in the old system.
|
package/src/browser/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { compile, Compiled } from './compile';
|
|
2
|
-
export { compileHBS } from './hbs';
|
|
3
|
-
export { compileJS } from './js';
|
|
4
|
-
export { modules as frameworkModules } from './known-modules';
|
|
5
|
-
export { invocationName, invocationOf, nameFor } from './utils';
|
|
1
|
+
export { compile, Compiled } from './compile/index.ts';
|
|
2
|
+
export { compileHBS } from './hbs.ts';
|
|
3
|
+
export { compileJS } from './js.ts';
|
|
4
|
+
export { modules as frameworkModules } from './known-modules.ts';
|
|
5
|
+
export { invocationName, invocationOf, nameFor } from './utils.ts';
|
|
6
6
|
|
|
7
7
|
// Public Types
|
|
8
8
|
export type { CompileResult } from './types';
|
package/src/browser/js.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { compileJS as compileAMD } from './cjs';
|
|
2
|
-
import { compileJS as compileESM } from './esm';
|
|
1
|
+
import { compileJS as compileAMD } from './cjs/index.ts';
|
|
2
|
+
import { compileJS as compileESM } from './esm/index.ts';
|
|
3
3
|
|
|
4
|
-
import type { CompileResult, ExtraModules, Options } from './types';
|
|
4
|
+
import type { CompileResult, ExtraModules, Options } from './types.ts';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @public
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ExtraModules } from "../types.js";
|
|
2
|
-
import Component from '@glimmer/component';
|
|
3
|
-
declare function evalSnippet(compiled: string, extraModules?: ExtraModules): {
|
|
4
|
-
default: Component;
|
|
5
|
-
services?: {
|
|
6
|
-
[key: string]: unknown;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
export { evalSnippet };
|
|
10
|
-
//# sourceMappingURL=browser/cjs/eval.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browser/cjs/eval.d.ts","sourceRoot":"","sources":["../src/browser/cjs/eval.ts"],"names":[],"mappings":"AAGA,OAAO,gBAAqB,oBAAiB;AAC7C,OAAO,SAAc,MAAM,oBAAoB,CAAC;AAEhD,iBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,YAAY,GAAE,YAAiB,GAC9B;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,QAAQ,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;CACvC,CAmBA"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { CompileResult } from "../types.js";
|
|
2
|
-
import { EvalImportMap, ScopeMap } from "./types.js";
|
|
3
|
-
declare function compileGJS(gjsInput: string, importMap?: EvalImportMap): Promise<CompileResult>;
|
|
4
|
-
declare function compileHBS(hbsInput: string, options?: {
|
|
5
|
-
moduleName?: string;
|
|
6
|
-
scope?: Record<string, unknown>;
|
|
7
|
-
}): Promise<CompileResult>;
|
|
8
|
-
declare function compileMD(glimdownInput: string, options?: {
|
|
9
|
-
importMap?: EvalImportMap;
|
|
10
|
-
topLevelScope?: ScopeMap;
|
|
11
|
-
CopyComponent?: string;
|
|
12
|
-
ShadowComponent?: string;
|
|
13
|
-
}): Promise<CompileResult & {
|
|
14
|
-
rootTemplate?: string;
|
|
15
|
-
}>;
|
|
16
|
-
export { compileGJS, compileHBS, compileMD };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CompileResult, ExtraModules } from "../types.js";
|
|
2
|
-
interface Info {
|
|
3
|
-
code: string;
|
|
4
|
-
name: string;
|
|
5
|
-
}
|
|
6
|
-
declare function compileJS(code: string, extraModules?: ExtraModules): Promise<CompileResult>;
|
|
7
|
-
declare function proxyToSkypack(code: string, extraModules?: ExtraModules): string;
|
|
8
|
-
export { Info, compileJS, proxyToSkypack };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TemplateMatch } from "./parse-templates.js";
|
|
2
|
-
import { NodePath } from '@babel/traverse';
|
|
3
|
-
import { CallExpression } from '@babel/types';
|
|
4
|
-
import { ImportUtil } from 'babel-import-util';
|
|
5
|
-
declare const TEMPLATE_TAG_NAME = "template";
|
|
6
|
-
declare const TEMPLATE_TAG_PLACEHOLDER = "__GLIMMER_TEMPLATE";
|
|
7
|
-
declare function isTemplateTag(callExpressionPath: NodePath<CallExpression>): boolean;
|
|
8
|
-
declare function buildPrecompileTemplateCall(t: any, callExpressionPath: NodePath<CallExpression>, state: {
|
|
9
|
-
importUtil: ImportUtil;
|
|
10
|
-
}): CallExpression;
|
|
11
|
-
declare function registerRefs(newPath: string | string[], getRefPaths: (path: string) => NodePath[]): void;
|
|
12
|
-
declare function isSupportedScriptFileExtension(filePath: string): boolean;
|
|
13
|
-
declare function isStrictMode(templateInfo: TemplateMatch): boolean;
|
|
14
|
-
export { TEMPLATE_TAG_NAME, TEMPLATE_TAG_PLACEHOLDER, isTemplateTag, buildPrecompileTemplateCall, registerRefs, isSupportedScriptFileExtension, isStrictMode };
|
package/dist/browser/gjs.d.ts
DELETED
package/dist/browser/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { compile, Compiled } from "./compile/index.js";
|
|
2
|
-
export { compileHBS } from "./hbs.js";
|
|
3
|
-
export { compileJS } from "./js.js";
|
|
4
|
-
export { modules as frameworkModules } from "./known-modules.js";
|
|
5
|
-
export { invocationName, invocationOf, nameFor } from "./utils.js";
|
|
6
|
-
export type { CompileResult } from "./types.js";
|
package/dist/browser/types.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { availablePlugins, availablePresets, transform } from '@babel/standalone';
|
|
2
|
-
import { ComponentLike } from '@glint/template';
|
|
3
|
-
interface CompileResult {
|
|
4
|
-
component?: ComponentLike;
|
|
5
|
-
error?: Error;
|
|
6
|
-
name: string;
|
|
7
|
-
}
|
|
8
|
-
interface Babel {
|
|
9
|
-
availablePlugins: typeof availablePlugins;
|
|
10
|
-
availablePresets: typeof availablePresets;
|
|
11
|
-
transform: typeof transform;
|
|
12
|
-
}
|
|
13
|
-
type Options = {
|
|
14
|
-
/**
|
|
15
|
-
* @internal
|
|
16
|
-
* @deprecated do not use - not under semver
|
|
17
|
-
*/
|
|
18
|
-
skypack?: boolean;
|
|
19
|
-
};
|
|
20
|
-
type ExtraModules = Record<string, unknown>;
|
|
21
|
-
export { CompileResult, Babel, Options, ExtraModules };
|