@vesk/compiler 0.2.36 → 0.2.38
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/dist/client-codegen.d.ts +2 -0
- package/dist/client-codegen.d.ts.map +1 -1
- package/dist/client-codegen.js +318 -53
- package/dist/ir-generator.d.ts.map +1 -1
- package/dist/ir-generator.js +10 -0
- package/dist/parser.js +2 -2
- package/dist/scan.d.ts +23 -0
- package/dist/scan.d.ts.map +1 -1
- package/dist/scan.js +80 -0
- package/dist/server-codegen.d.ts +1 -1
- package/dist/server-codegen.d.ts.map +1 -1
- package/dist/server-codegen.js +1 -1
- package/dist/server-head.d.ts.map +1 -1
- package/dist/server-head.js +15 -5
- package/dist/server-jsgen.d.ts.map +1 -1
- package/dist/server-jsgen.js +20 -4
- package/dist/server-render.js +5 -5
- package/dist/server-utils.d.ts +3 -1
- package/dist/server-utils.d.ts.map +1 -1
- package/dist/server-utils.js +18 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ir-generator.d.ts","sourceRoot":"","sources":["../src/ir-generator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EAsBP,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"ir-generator.d.ts","sourceRoot":"","sources":["../src/ir-generator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EAsBP,MAAM,uBAAuB,CAAC;AAmT/B,wBAAgB,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAC;IAAC,cAAc,CAAC,EAAE,GAAG,CAAC;IAAC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAA;CAAE,CAAC,GAAG,SAAS,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkCnL;AA48BD,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAwN9E"}
|
package/dist/ir-generator.js
CHANGED
|
@@ -303,6 +303,16 @@ function extractKeyExpr(nodes) {
|
|
|
303
303
|
for (const n of nodes) {
|
|
304
304
|
if (n instanceof StaticNode && n.keyExpr)
|
|
305
305
|
return n.keyExpr;
|
|
306
|
+
// `<ItemRow key={item.id} …/>` carries the key as a regular prop on the
|
|
307
|
+
// component call. Honor it so component-rooted maps get the same keyed
|
|
308
|
+
// (claim-by-key / reconcile) treatment as element-rooted maps instead of
|
|
309
|
+
// falling back to the positional `__place` region — which stranding fresh
|
|
310
|
+
// surplus items and cannot reorder adopted ones.
|
|
311
|
+
if (n instanceof ComponentCall) {
|
|
312
|
+
const k = n.props.find((p) => p.name === 'key');
|
|
313
|
+
if (k)
|
|
314
|
+
return k.value;
|
|
315
|
+
}
|
|
306
316
|
}
|
|
307
317
|
return null;
|
|
308
318
|
}
|
package/dist/parser.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as acorn from 'acorn';
|
|
2
2
|
import { tsPlugin } from './acorn-ts-plugin/index.js';
|
|
3
3
|
import { VeskParserPlugin } from '@vesk/compiler/src/vesk-plugin';
|
|
4
|
-
import { containsForOfIn } from '@vesk/compiler/src/scan';
|
|
4
|
+
import { blankComments, containsForOfIn } from '@vesk/compiler/src/scan';
|
|
5
5
|
import { VeskError, codeFrame } from '@vesk/compiler/src/errors';
|
|
6
6
|
function isIdentChar(code) {
|
|
7
7
|
return ((code >= 97 && code <= 122) || (code >= 65 && code <= 90) || (code >= 48 && code <= 57) || code === 95 || code === 36);
|
|
@@ -257,7 +257,7 @@ export function createBaseParser() {
|
|
|
257
257
|
}
|
|
258
258
|
export function parse(source, options = {}) {
|
|
259
259
|
const ParserClass = createBaseParser();
|
|
260
|
-
const { code, annotations } = preprocessForClauses(source);
|
|
260
|
+
const { code, annotations } = preprocessForClauses(blankComments(source));
|
|
261
261
|
try {
|
|
262
262
|
const ast = ParserClass.parse(code, {
|
|
263
263
|
ecmaVersion: 'latest',
|
package/dist/scan.d.ts
CHANGED
|
@@ -43,6 +43,29 @@ export declare function skipString(text: string, i: number): number;
|
|
|
43
43
|
* comment starts here.
|
|
44
44
|
*/
|
|
45
45
|
export declare function skipComment(text: string, i: number): number;
|
|
46
|
+
/**
|
|
47
|
+
* Blanks comments in the source, overwriting the comment characters with
|
|
48
|
+
* spaces so every source offset (and therefore every diagnostic line/column)
|
|
49
|
+
* is preserved. Newlines inside a comment are kept so line numbers hold.
|
|
50
|
+
*
|
|
51
|
+
* In JSX-children position acorn reads both `//` and `/* ... */` as JSXText
|
|
52
|
+
* rather than a comment, so commented-out code still ran: `//<span>old</span>`
|
|
53
|
+
* inside a component rendered the element, `//{count + 1}` emitted a live
|
|
54
|
+
* binding, and `/* <span>old</span> */` leaked the markup as visible text.
|
|
55
|
+
* Blanking comments before the parse makes a commented-out line behave like
|
|
56
|
+
* a comment in every position of a `.vsk` file.
|
|
57
|
+
*
|
|
58
|
+
* `/* ... */` is blanked wherever it appears (outside a string) because a
|
|
59
|
+
* block comment is inert everywhere in JS — and an unescaped `/*` cannot occur
|
|
60
|
+
* inside a regex literal, since it would terminate the regex there.
|
|
61
|
+
*
|
|
62
|
+
* `//` is blanked only when it is the first non-whitespace token on its line: a
|
|
63
|
+
* trailing `// note` after code is a real comment acorn already ignores, and
|
|
64
|
+
* blanking a mid-line `//` would corrupt regex literals (`/https:\/\//`) and
|
|
65
|
+
* intentional JSX text such as `ratio 1//2`. Strings and template literals are
|
|
66
|
+
* skipped throughout, so a comment marker inside them is never touched.
|
|
67
|
+
*/
|
|
68
|
+
export declare function blankComments(text: string): string;
|
|
46
69
|
/**
|
|
47
70
|
* Given the index of an opening `(`, `[` or `{`, returns the index of its
|
|
48
71
|
* matching closing delimiter. Strings, `//` and `/* ... */` comments are
|
package/dist/scan.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../src/scan.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAItD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAErD;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAOzE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWrD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAS5D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAG9D;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAc9D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAsB1D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAY3D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAkBvE;AAED;;;;;;GAMG;A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BAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAcnE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAqB9D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAY3D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAexD"}
|
package/dist/scan.js
CHANGED
|
@@ -163,6 +163,86 @@ export function skipComment(text, i) {
|
|
|
163
163
|
}
|
|
164
164
|
return i;
|
|
165
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Blanks comments in the source, overwriting the comment characters with
|
|
168
|
+
* spaces so every source offset (and therefore every diagnostic line/column)
|
|
169
|
+
* is preserved. Newlines inside a comment are kept so line numbers hold.
|
|
170
|
+
*
|
|
171
|
+
* In JSX-children position acorn reads both `//` and `/* ... */` as JSXText
|
|
172
|
+
* rather than a comment, so commented-out code still ran: `//<span>old</span>`
|
|
173
|
+
* inside a component rendered the element, `//{count + 1}` emitted a live
|
|
174
|
+
* binding, and `/* <span>old</span> */` leaked the markup as visible text.
|
|
175
|
+
* Blanking comments before the parse makes a commented-out line behave like
|
|
176
|
+
* a comment in every position of a `.vsk` file.
|
|
177
|
+
*
|
|
178
|
+
* `/* ... */` is blanked wherever it appears (outside a string) because a
|
|
179
|
+
* block comment is inert everywhere in JS — and an unescaped `/*` cannot occur
|
|
180
|
+
* inside a regex literal, since it would terminate the regex there.
|
|
181
|
+
*
|
|
182
|
+
* `//` is blanked only when it is the first non-whitespace token on its line: a
|
|
183
|
+
* trailing `// note` after code is a real comment acorn already ignores, and
|
|
184
|
+
* blanking a mid-line `//` would corrupt regex literals (`/https:\/\//`) and
|
|
185
|
+
* intentional JSX text such as `ratio 1//2`. Strings and template literals are
|
|
186
|
+
* skipped throughout, so a comment marker inside them is never touched.
|
|
187
|
+
*/
|
|
188
|
+
export function blankComments(text) {
|
|
189
|
+
const chars = text.split('');
|
|
190
|
+
const n = text.length;
|
|
191
|
+
let lineStart = true;
|
|
192
|
+
let i = 0;
|
|
193
|
+
while (i < n) {
|
|
194
|
+
const ch = text[i];
|
|
195
|
+
if (ch === '\n') {
|
|
196
|
+
lineStart = true;
|
|
197
|
+
i++;
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
if (isWhitespaceChar(ch)) {
|
|
201
|
+
i++;
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (ch === '"' || ch === "'" || ch === '`') {
|
|
205
|
+
const end = skipString(text, i);
|
|
206
|
+
for (let k = i; k < end; k++) {
|
|
207
|
+
const c = text[k];
|
|
208
|
+
if (c === '\n')
|
|
209
|
+
lineStart = true;
|
|
210
|
+
else if (!isWhitespaceChar(c))
|
|
211
|
+
lineStart = false;
|
|
212
|
+
}
|
|
213
|
+
i = end;
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
if (ch === '/' && text[i + 1] === '/') {
|
|
217
|
+
if (!lineStart) {
|
|
218
|
+
i += 2;
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
let j = i;
|
|
222
|
+
while (j < n && text[j] !== '\n') {
|
|
223
|
+
chars[j] = ' ';
|
|
224
|
+
j++;
|
|
225
|
+
}
|
|
226
|
+
i = j;
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
if (ch === '/' && text[i + 1] === '*') {
|
|
230
|
+
let j = i;
|
|
231
|
+
while (j < n && !(text[j] === '*' && text[j + 1] === '/'))
|
|
232
|
+
j++;
|
|
233
|
+
const end = Math.min(j + 2, n);
|
|
234
|
+
for (let k = i; k < end; k++)
|
|
235
|
+
if (text[k] !== '\n')
|
|
236
|
+
chars[k] = ' ';
|
|
237
|
+
lineStart = false;
|
|
238
|
+
i = end;
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
lineStart = false;
|
|
242
|
+
i++;
|
|
243
|
+
}
|
|
244
|
+
return chars.join('');
|
|
245
|
+
}
|
|
166
246
|
/**
|
|
167
247
|
* Given the index of an opening `(`, `[` or `{`, returns the index of its
|
|
168
248
|
* matching closing delimiter. Strings, `//` and `/* ... */` comments are
|
package/dist/server-codegen.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { setRuntimeModule, prettifyHtml, isStatic, escapeHtml, quoteAttr, safeJsonForScript, randomToken, DEFAULT_MAX_BODY_BYTES, raw, exprJS, tryEvalExpr, childrenToHTML, extractTopLevelNames, extractRuntimeNames, buildParamInit, resolveComponentName, loadRuntimeImports, evalTopLevelCode, callStaticProps, callLoadFunction, __vskHydrate, __vskId, __vskImportedNames, resetVskState, setVskHydrate, setVskImportedNames, securityHeaders, corsHeaders, corsPreflight, csrfToken, verifyCsrfToken, csrfGuard, csrfHmac, assertSameOrigin, signCookie, unsignCookie, setSignedCookie, readSignedCookie, securityComment, redactLog, setRedactLogging, createRateLimiter, getClientIp, getClientProtocol, applyTrustProxy, } from '@vesk/compiler/src/server-utils';
|
|
1
|
+
export { setRuntimeModule, prettifyHtml, isStatic, escapeHtml, quoteAttr, safeJsonForScript, randomToken, DEFAULT_MAX_BODY_BYTES, raw, exprJS, tryEvalExpr, childrenToHTML, extractTopLevelNames, extractRuntimeNames, buildParamInit, resolveComponentName, loadRuntimeImports, evalTopLevelCode, callStaticProps, callLoadFunction, __vskHydrate, __vskMarkerless, __vskId, __vskImportedNames, resetVskState, setVskHydrate, setVskMarkerless, setVskImportedNames, securityHeaders, corsHeaders, corsPreflight, csrfToken, verifyCsrfToken, csrfGuard, csrfHmac, assertSameOrigin, signCookie, unsignCookie, setSignedCookie, readSignedCookie, securityComment, redactLog, setRedactLogging, createRateLimiter, getClientIp, getClientProtocol, applyTrustProxy, } from '@vesk/compiler/src/server-utils';
|
|
2
2
|
export { renderHeadHtml, mergeHeadHtml, } from '@vesk/compiler/src/server-head';
|
|
3
3
|
export { irNodeToJS, generateFunctionBody, buildComponentMap, buildComponentEntries, } from '@vesk/compiler/src/server-jsgen';
|
|
4
4
|
export { irToJSON, irFromJSON, hydratePrecompile, } from '@vesk/compiler/src/precompile-runtime';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-codegen.d.ts","sourceRoot":"","sources":["../src/server-codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,sBAAsB,EACtB,GAAG,EACH,MAAM,EACN,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,aAAa,EACb,SAAS,EACT,eAAe,EACf,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,eAAe,GAChB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,cAAc,EACd,aAAa,GACd,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,QAAQ,EACR,UAAU,EACV,iBAAiB,GAClB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EACL,cAAc,GACf,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,WAAW,EACX,MAAM,EACN,UAAU,EACV,GAAG,EACH,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,kCAAkC,CAAC"}
|
|
1
|
+
{"version":3,"file":"server-codegen.d.ts","sourceRoot":"","sources":["../src/server-codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,sBAAsB,EACtB,GAAG,EACH,MAAM,EACN,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,OAAO,EACP,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,aAAa,EACb,SAAS,EACT,eAAe,EACf,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,eAAe,GAChB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,cAAc,EACd,aAAa,GACd,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,QAAQ,EACR,UAAU,EACV,iBAAiB,GAClB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EACL,cAAc,GACf,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,WAAW,EACX,MAAM,EACN,UAAU,EACV,GAAG,EACH,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,kCAAkC,CAAC"}
|
package/dist/server-codegen.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { setRuntimeModule, prettifyHtml, isStatic, escapeHtml, quoteAttr, safeJsonForScript, randomToken, DEFAULT_MAX_BODY_BYTES, raw, exprJS, tryEvalExpr, childrenToHTML, extractTopLevelNames, extractRuntimeNames, buildParamInit, resolveComponentName, loadRuntimeImports, evalTopLevelCode, callStaticProps, callLoadFunction, __vskHydrate, __vskId, __vskImportedNames, resetVskState, setVskHydrate, setVskImportedNames, securityHeaders, corsHeaders, corsPreflight, csrfToken, verifyCsrfToken, csrfGuard, csrfHmac, assertSameOrigin, signCookie, unsignCookie, setSignedCookie, readSignedCookie, securityComment, redactLog, setRedactLogging, createRateLimiter, getClientIp, getClientProtocol, applyTrustProxy, } from '@vesk/compiler/src/server-utils';
|
|
1
|
+
export { setRuntimeModule, prettifyHtml, isStatic, escapeHtml, quoteAttr, safeJsonForScript, randomToken, DEFAULT_MAX_BODY_BYTES, raw, exprJS, tryEvalExpr, childrenToHTML, extractTopLevelNames, extractRuntimeNames, buildParamInit, resolveComponentName, loadRuntimeImports, evalTopLevelCode, callStaticProps, callLoadFunction, __vskHydrate, __vskMarkerless, __vskId, __vskImportedNames, resetVskState, setVskHydrate, setVskMarkerless, setVskImportedNames, securityHeaders, corsHeaders, corsPreflight, csrfToken, verifyCsrfToken, csrfGuard, csrfHmac, assertSameOrigin, signCookie, unsignCookie, setSignedCookie, readSignedCookie, securityComment, redactLog, setRedactLogging, createRateLimiter, getClientIp, getClientProtocol, applyTrustProxy, } from '@vesk/compiler/src/server-utils';
|
|
2
2
|
export { renderHeadHtml, mergeHeadHtml, } from '@vesk/compiler/src/server-head';
|
|
3
3
|
export { irNodeToJS, generateFunctionBody, buildComponentMap, buildComponentEntries, } from '@vesk/compiler/src/server-jsgen';
|
|
4
4
|
export { irToJSON, irFromJSON, hydratePrecompile, } from '@vesk/compiler/src/precompile-runtime';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-head.d.ts","sourceRoot":"","sources":["../src/server-head.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"server-head.d.ts","sourceRoot":"","sources":["../src/server-head.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAyHzD,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,MAAM,CAe7F;AAoFD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAkExI"}
|
package/dist/server-head.js
CHANGED
|
@@ -79,7 +79,16 @@ function headElementKey(node, props, locals) {
|
|
|
79
79
|
return null;
|
|
80
80
|
return null;
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
const HEAD_RECONCILE_MARKER = 'data-vesk-head';
|
|
83
|
+
const HEAD_RECONCILE_TAGS = new Set(['title', 'meta', 'link', 'base', 'style']);
|
|
84
|
+
function headIsReconcilable(tag, attrMap) {
|
|
85
|
+
if (!HEAD_RECONCILE_TAGS.has(tag))
|
|
86
|
+
return false;
|
|
87
|
+
if (tag === 'meta' && attrMap.has('charset'))
|
|
88
|
+
return false;
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
function irNodeToHeadHtml(node, props, locals = {}, reconcileable = false) {
|
|
83
92
|
if (node instanceof StaticNode) {
|
|
84
93
|
const attrMap = new Map(node.attributes.map((a) => [a.name, a.value]));
|
|
85
94
|
for (const child of node.children) {
|
|
@@ -91,16 +100,17 @@ function irNodeToHeadHtml(node, props, locals = {}) {
|
|
|
91
100
|
catch { /* skip */ }
|
|
92
101
|
}
|
|
93
102
|
}
|
|
103
|
+
const marker = reconcileable && headIsReconcilable(node.tag, attrMap) ? ` ${HEAD_RECONCILE_MARKER}` : '';
|
|
94
104
|
const attrs = [...attrMap.entries()]
|
|
95
105
|
.map(([k, v]) => ` ${k}="${escapeHtml(v)}"`)
|
|
96
106
|
.join('');
|
|
97
107
|
if (node.selfClosing)
|
|
98
|
-
return `<${node.tag}${attrs} />`;
|
|
108
|
+
return `<${node.tag}${attrs}${marker} />`;
|
|
99
109
|
const inner = node.children
|
|
100
110
|
.filter((c) => !(c instanceof DynamicBinding && c.kind === 'attribute' && c.target !== 'ref'))
|
|
101
|
-
.map((c) => irNodeToHeadHtml(c, props, locals))
|
|
111
|
+
.map((c) => irNodeToHeadHtml(c, props, locals, false))
|
|
102
112
|
.join('');
|
|
103
|
-
return `<${node.tag}${attrs}>${inner}</${node.tag}>`;
|
|
113
|
+
return `<${node.tag}${attrs}${marker}>${inner}</${node.tag}>`;
|
|
104
114
|
}
|
|
105
115
|
if (node instanceof TextNode)
|
|
106
116
|
return node.value;
|
|
@@ -127,7 +137,7 @@ export function renderHeadHtml(comp, props = {}) {
|
|
|
127
137
|
continue;
|
|
128
138
|
if (key !== null)
|
|
129
139
|
seen.add(key);
|
|
130
|
-
parts.push(irNodeToHeadHtml(child, props, locals));
|
|
140
|
+
parts.push(irNodeToHeadHtml(child, props, locals, true));
|
|
131
141
|
}
|
|
132
142
|
}
|
|
133
143
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-jsgen.d.ts","sourceRoot":"","sources":["../src/server-jsgen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAOzE,OAAO,EAAkG,KAAK,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAmDrK,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,OAAO,GAAE,OAAe,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"server-jsgen.d.ts","sourceRoot":"","sources":["../src/server-jsgen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAOzE,OAAO,EAAkG,KAAK,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAmDrK,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,OAAO,GAAE,OAAe,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,MAAM,CAgEjJ;AA4XD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CAqD1F;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,EAAE,CA4BzE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAYhG"}
|
package/dist/server-jsgen.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StaticNode, TextNode, DynamicBinding, OpaqueDynamicRegion, MapRegion, WhileLoop, SwitchBlock, TryCatch, ForLoop, TrackDecl, RuntimeStatement, ComponentRef, ComponentCall, ServerBlock, ClientBlock, HeadBlock, SlotNode, PropSlot, PropSlotRender, } from '@vesk/compiler/src/ir';
|
|
2
2
|
import { isStaticIR, collectTrackedNames, transformTracked, transformTrackedInit, semicolonizeStatement } from '@vesk/compiler/src/client-codegen';
|
|
3
3
|
import { unwrapTrackCall, stripTrackGeneric, hasTopLevelComma, skipWhitespace, findBalancedEnd, startsWithIdentifier } from '@vesk/compiler/src/scan';
|
|
4
|
-
import { escapeHtml, indent, exprJS, extractTopLevelNames, extractRuntimeNames, buildParamInit, __vskHydrate, __vskImportedNames, setVskImportedNames, setVskForceClaim, takeVskForceClaim, nextVskId, } from '@vesk/compiler/src/server-utils';
|
|
4
|
+
import { escapeHtml, indent, exprJS, extractTopLevelNames, extractRuntimeNames, buildParamInit, __vskHydrate, __vskMarkerless, __vskImportedNames, setVskImportedNames, setVskForceClaim, takeVskForceClaim, nextVskId, } from '@vesk/compiler/src/server-utils';
|
|
5
5
|
import { localValueImportNames } from '@vesk/compiler/src/module-imports';
|
|
6
6
|
// Hydrate-mode component-boundary wrapper. Each server-rendered component call
|
|
7
7
|
// is preceded by a `<!--vsk-->` marker and a single container element: the
|
|
@@ -109,6 +109,12 @@ export function irNodeToJS(node, importedNames, isAsync = false, tracked) {
|
|
|
109
109
|
if (node instanceof RuntimeStatement)
|
|
110
110
|
return semicolonizeStatement(transformTracked(node, tracked || new Map()));
|
|
111
111
|
if (node instanceof SlotNode) {
|
|
112
|
+
// Markerless mode drops the slot boundary comments: SSR output is plain
|
|
113
|
+
// HTML and slot claims scope structurally (createLayoutSlot subject to the
|
|
114
|
+
// markerless layout contract — Phase 3.x). The children themselves render
|
|
115
|
+
// identically either way.
|
|
116
|
+
if (__vskMarkerless)
|
|
117
|
+
return `__out.push(props.children || '');`;
|
|
112
118
|
const sid = `s${nextVskId()}`;
|
|
113
119
|
return `__out.push('<!--vsk-slot:${sid}-->');__out.push(props.children || '');__out.push('<!--vsk-slot-end:${sid}-->');`;
|
|
114
120
|
}
|
|
@@ -142,9 +148,11 @@ function staticNodeToJS(node, isAsync = false, tracked) {
|
|
|
142
148
|
let openTag = `<${node.tag}`;
|
|
143
149
|
const forceClaim = takeVskForceClaim();
|
|
144
150
|
const subtreeNeedsJS = __vskHydrate && (forceClaim || !isStaticIR(node.children));
|
|
145
|
-
if (subtreeNeedsJS) {
|
|
151
|
+
if (subtreeNeedsJS && !__vskMarkerless) {
|
|
146
152
|
// Keyed static boundary (Hydrate-Todo: no bare markers): the walker
|
|
147
153
|
// asserts this tag on adopt and names it in every miss/orphan report.
|
|
154
|
+
// Markerless mode omits the comment entirely — the structural walker
|
|
155
|
+
// scopes interior claims to the claimed element's own children.
|
|
148
156
|
lines.push('__out.push(' + JSON.stringify(`<!--vsk:t:${sanitizeMarkerName(node.tag)}-->`) + ');');
|
|
149
157
|
}
|
|
150
158
|
for (const attr of node.attributes) {
|
|
@@ -261,7 +269,7 @@ function mapRegionToJS(node, isAsync = false, tracked) {
|
|
|
261
269
|
// injected into a shadow copy of the item root at codegen time — it flows
|
|
262
270
|
// through the existing dynamic-attribute machinery (which also forces a
|
|
263
271
|
// claim marker on otherwise-static roots).
|
|
264
|
-
const bodyForItem = __vskHydrate && node.keyExpr ? keyedItemTemplate(node) : node.bodyTemplate;
|
|
272
|
+
const bodyForItem = __vskHydrate && !__vskMarkerless && node.keyExpr ? keyedItemTemplate(node) : node.bodyTemplate;
|
|
265
273
|
const hasAlternate = node.alternateNodes.length > 0;
|
|
266
274
|
const arrVar = hasAlternate ? `__a${nextVskId()}` : null;
|
|
267
275
|
if (hasAlternate) {
|
|
@@ -484,8 +492,16 @@ function componentCallToJS(node, importedNames, isAsync = false, tracked) {
|
|
|
484
492
|
// components during SSR.
|
|
485
493
|
const calleeVar = `__cc${nextVskId()}`;
|
|
486
494
|
lines.push(`const ${calleeVar} = ${callee};`);
|
|
495
|
+
// Registry lookups can resolve to `undefined` when a JSX tag names a
|
|
496
|
+
// component that was never declared, imported, or registered at runtime
|
|
497
|
+
// (e.g. `<Slot/>` in a framework where `{props.children}` is the channel).
|
|
498
|
+
// Guard the hoisted callee so the failure is an actionable message instead
|
|
499
|
+
// of `Cannot read properties of undefined (reading '__veskScope')` mid-deref.
|
|
500
|
+
if (!node.calleeExpr) {
|
|
501
|
+
lines.push(`if (${calleeVar} == null) throw new Error(${JSON.stringify(`Component "${compName}" was not found while rendering SSR HTML. Declare it with the \`component\` keyword, import it, or register it in the component registry.`)});`);
|
|
502
|
+
}
|
|
487
503
|
const callExpr = `${awaitKw}${calleeVar}(${propsObj}, __registry, (${calleeVar}.__veskScope || __vesk))`;
|
|
488
|
-
if (__vskHydrate) {
|
|
504
|
+
if (__vskHydrate && !__vskMarkerless) {
|
|
489
505
|
lines.push(`__out.push(${JSON.stringify(componentMarker(compName))} + (${callExpr} || ''));`);
|
|
490
506
|
}
|
|
491
507
|
else {
|
package/dist/server-render.js
CHANGED
|
@@ -77,7 +77,7 @@ function compileFileInternal(source, sourcePath, seenImportFiles) {
|
|
|
77
77
|
return { ir, componentMap, __vesk };
|
|
78
78
|
}
|
|
79
79
|
export function render(source, componentName, props = {}, registry = new Map(), options = {}) {
|
|
80
|
-
resetVskState(!!options.hydrate);
|
|
80
|
+
resetVskState(!!options.hydrate, options.markerless !== false);
|
|
81
81
|
const compiled = compileFile(source, { sourcePath: options.sourcePath || undefined });
|
|
82
82
|
const componentMap = compiled.componentMap;
|
|
83
83
|
const renderFn = componentMap.get(componentName);
|
|
@@ -116,7 +116,7 @@ export function render(source, componentName, props = {}, registry = new Map(),
|
|
|
116
116
|
return bodyHtml;
|
|
117
117
|
}
|
|
118
118
|
export function renderPage(source, componentName, props = {}, registry = new Map(), options = {}) {
|
|
119
|
-
resetVskState(!!options.hydrate);
|
|
119
|
+
resetVskState(!!options.hydrate, options.markerless !== false);
|
|
120
120
|
let __vesk, componentMap, ir;
|
|
121
121
|
if (options.cached) {
|
|
122
122
|
const cached = options.cached;
|
|
@@ -321,11 +321,11 @@ export async function ssg(source, componentName, customProps, options = {}) {
|
|
|
321
321
|
return true;
|
|
322
322
|
return !isStatic(c.body);
|
|
323
323
|
});
|
|
324
|
-
const rendered = await renderPage(source, componentName, props, options.registry || new Map(), { hydrate: needsClient });
|
|
324
|
+
const rendered = await renderPage(source, componentName, props, options.registry || new Map(), { hydrate: needsClient, markerless: options.markerless !== false });
|
|
325
325
|
const bodyHtml = rendered.body;
|
|
326
326
|
const headHtml = rendered.head;
|
|
327
327
|
const clientCode = needsClient
|
|
328
|
-
? compileClient(source, null, { hydrate: true })
|
|
328
|
+
? compileClient(source, null, { hydrate: true, markerless: options.markerless !== false })
|
|
329
329
|
: '';
|
|
330
330
|
const serializedProps = safeJsonForScript(JSON.stringify(props));
|
|
331
331
|
const hasClient = clientCode.length > 0;
|
|
@@ -530,7 +530,7 @@ export function renderPageStream(source, componentName, props = {}, registry = n
|
|
|
530
530
|
const renderFn = componentMap.get(componentName);
|
|
531
531
|
if (!renderFn)
|
|
532
532
|
throw new Error(`Component "${componentName}" not found in source`);
|
|
533
|
-
resetVskState(!!options.hydrate);
|
|
533
|
+
resetVskState(!!options.hydrate, options.markerless !== false);
|
|
534
534
|
const targetComp = ir.components.find((c) => c.name === componentName);
|
|
535
535
|
const cssUrls = options.cssUrls || (options.cssUrl ? [options.cssUrl] : []);
|
|
536
536
|
const cssLink = cssUrls.map(u => `\t<link rel="stylesheet" href="${u}" />\n`).join('');
|
package/dist/server-utils.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { IRNode } from '@vesk/compiler/src/ir';
|
|
2
2
|
export declare let __vskHydrate: boolean;
|
|
3
|
+
export declare let __vskMarkerless: boolean;
|
|
3
4
|
export declare let __vskId: number;
|
|
4
5
|
export declare let __vskForceClaim: boolean;
|
|
5
6
|
export declare let __vskImportedNames: Set<string> | null;
|
|
6
|
-
export declare function resetVskState(hydrate?: boolean): void;
|
|
7
|
+
export declare function resetVskState(hydrate?: boolean, markerless?: boolean): void;
|
|
7
8
|
export declare function setVskHydrate(v: boolean): void;
|
|
9
|
+
export declare function setVskMarkerless(v: boolean): void;
|
|
8
10
|
export declare function setVskImportedNames(names: Set<string> | null): void;
|
|
9
11
|
export declare function setVskForceClaim(v: boolean): void;
|
|
10
12
|
export declare function takeVskForceClaim(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-utils.d.ts","sourceRoot":"","sources":["../src/server-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAapD,eAAO,IAAI,YAAY,SAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"server-utils.d.ts","sourceRoot":"","sources":["../src/server-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAapD,eAAO,IAAI,YAAY,SAAQ,CAAC;AAOhC,eAAO,IAAI,eAAe,SAAO,CAAC;AAClC,eAAO,IAAI,OAAO,QAAI,CAAC;AACvB,eAAO,IAAI,eAAe,SAAQ,CAAC;AACnC,eAAO,IAAI,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAW,CAAC;AAEzD,wBAAgB,aAAa,CAAC,OAAO,UAAQ,EAAE,UAAU,UAAO,GAAG,IAAI,CAWtE;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,CAE9C;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,CAEjD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI,CAEnE;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,CAEjD;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAI3C;AAED,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA6CjD;AAuCD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AC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CA2BlE;AAUD,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAM3D;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYlE;AAID,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAEnE;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgBhF;AAED,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CA6C9F;AAED,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CASxE;AAED,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAgBjJ"}
|
package/dist/server-utils.js
CHANGED
|
@@ -9,17 +9,34 @@ const VOID_ELEMENTS = new Set([
|
|
|
9
9
|
]);
|
|
10
10
|
const RAW_TEXT_ELEMENTS = new Set(['style', 'script', 'title']);
|
|
11
11
|
export let __vskHydrate = false;
|
|
12
|
+
// Markerless (structural) hydration mode: SSR emits ordinary application HTML
|
|
13
|
+
// with no hydration comments and no `data-vsk-*` attributes — the client
|
|
14
|
+
// recovery architecture walks plain elements positionally instead of via
|
|
15
|
+
// markers. Markerless is the DEFAULT; pass `markerless: false` to render
|
|
16
|
+
// options to restore the legacy marker emission (hydration markers only ever
|
|
17
|
+
// appear when `__vskHydrate` is also true).
|
|
18
|
+
export let __vskMarkerless = true;
|
|
12
19
|
export let __vskId = 0;
|
|
13
20
|
export let __vskForceClaim = false;
|
|
14
21
|
export let __vskImportedNames = null;
|
|
15
|
-
export function resetVskState(hydrate = false) {
|
|
22
|
+
export function resetVskState(hydrate = false, markerless = true) {
|
|
16
23
|
__vskHydrate = hydrate;
|
|
24
|
+
__vskMarkerless = markerless;
|
|
17
25
|
__vskId = 0;
|
|
18
26
|
__vskForceClaim = false;
|
|
27
|
+
// Runtime components that hand-render SSR roots (e.g. the router `Link`,
|
|
28
|
+
// which self-prefixes a `<!--vsk:c:Link-->` claim marker in marker mode)
|
|
29
|
+
// must mirror the compiler's marker choice while serving a request.
|
|
30
|
+
// Mirrored as a global, not an import, so `@vesk/runtime` never depends on
|
|
31
|
+
// the compiler package.
|
|
32
|
+
globalThis.__vsk_ssr_markerless = markerless === true;
|
|
19
33
|
}
|
|
20
34
|
export function setVskHydrate(v) {
|
|
21
35
|
__vskHydrate = v;
|
|
22
36
|
}
|
|
37
|
+
export function setVskMarkerless(v) {
|
|
38
|
+
__vskMarkerless = v;
|
|
39
|
+
}
|
|
23
40
|
export function setVskImportedNames(names) {
|
|
24
41
|
__vskImportedNames = names;
|
|
25
42
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -13,6 +13,14 @@ export interface FullPageOptions {
|
|
|
13
13
|
security?: import('@vesk/types').VeskSecurity;
|
|
14
14
|
__vesk?: Record<string, unknown>;
|
|
15
15
|
hydrate?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Markerless (structural) hydration: SSR emits ordinary application HTML
|
|
18
|
+
* with no hydration comments and no `data-vsk-*` attributes; the client
|
|
19
|
+
* walks plain elements positionally. This is the DEFAULT. Pass
|
|
20
|
+
* `markerless: false` to restore legacy marker emission. Only takes effect
|
|
21
|
+
* when `hydrate` is true.
|
|
22
|
+
*/
|
|
23
|
+
markerless?: boolean;
|
|
16
24
|
sourcePath?: string;
|
|
17
25
|
externalDataScript?: import('@vesk/types').ExternalDataScript;
|
|
18
26
|
cached?: CompileFileResult;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAIpD,YAAY,EACV,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,UAAU,EACV,OAAO,EACP,eAAe,EACf,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EAClB,OAAO,EACP,QAAQ,EACR,eAAe,EACf,qBAAqB,EACrB,WAAW,EACX,YAAY,EACZ,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,aAAa,EAAE,YAAY,CAAC;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,aAAa,EAAE,kBAAkB,CAAC;IAC9D,MAAM,CAAC,EAA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M,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,aAAa,EAAE,kBAAkB,CAAC;IAC9D,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,aAAa,EAAE,UAAU,EAAE,CAAC;IAC7C;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,aAAa,shBAahB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vesk/compiler",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.38",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vesk compiler — lexer, parser, semantic analysis, IR, codegen",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@sveltejs/acorn-typescript": "^1.0.0",
|
|
23
|
-
"@vesk/types": "^0.2.
|
|
23
|
+
"@vesk/types": "^0.2.38",
|
|
24
24
|
"acorn": "^8.15.0",
|
|
25
25
|
"esrap": "^2.3.0",
|
|
26
26
|
"is-reference": "^3.0.0",
|