@rsvelte/vite-plugin-svelte-native 0.3.10 → 0.3.11
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 +6 -6
- package/parse-envelope.js +29 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsvelte/vite-plugin-svelte-native",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"description": "NAPI bindings to the rsvelte compiler — used by the @rsvelte vite-plugin-svelte shim",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"index.d.ts"
|
|
31
31
|
],
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"@rsvelte/vite-plugin-svelte-native-darwin-arm64": "^0.3.
|
|
34
|
-
"@rsvelte/vite-plugin-svelte-native-darwin-x64": "^0.3.
|
|
35
|
-
"@rsvelte/vite-plugin-svelte-native-linux-arm64-gnu": "^0.3.
|
|
36
|
-
"@rsvelte/vite-plugin-svelte-native-linux-x64-gnu": "^0.3.
|
|
37
|
-
"@rsvelte/vite-plugin-svelte-native-win32-x64-msvc": "^0.3.
|
|
33
|
+
"@rsvelte/vite-plugin-svelte-native-darwin-arm64": "^0.3.11",
|
|
34
|
+
"@rsvelte/vite-plugin-svelte-native-darwin-x64": "^0.3.11",
|
|
35
|
+
"@rsvelte/vite-plugin-svelte-native-linux-arm64-gnu": "^0.3.11",
|
|
36
|
+
"@rsvelte/vite-plugin-svelte-native-linux-x64-gnu": "^0.3.11",
|
|
37
|
+
"@rsvelte/vite-plugin-svelte-native-win32-x64-msvc": "^0.3.11"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
package/parse-envelope.js
CHANGED
|
@@ -19,7 +19,7 @@ const MAGIC = 0x3156_5052; // "RPV1" little-endian
|
|
|
19
19
|
// reorder, `typeParameters` on function-like nodes, Identifier `optional`);
|
|
20
20
|
// v4 adds the object-method `typeParameters`-after-`body` flag byte.
|
|
21
21
|
// Keep in lockstep with `napi_raw_parse.rs`'s `VERSION`.
|
|
22
|
-
const VERSION =
|
|
22
|
+
const VERSION = 10;
|
|
23
23
|
const HEADER_LEN = 24;
|
|
24
24
|
|
|
25
25
|
// Tags — must mirror napi_raw_parse.rs.
|
|
@@ -155,6 +155,7 @@ const JS_STATIC_BLOCK = 0xc4;
|
|
|
155
155
|
const JS_DECORATOR = 0xc5;
|
|
156
156
|
const JS_TS_TYPE_ANNOTATION = 0xc6;
|
|
157
157
|
const JS_TS_MODULE_DECLARATION = 0xc8;
|
|
158
|
+
const JS_TS_MODULE_BLOCK = 0xd4;
|
|
158
159
|
const JS_COMMENT = 0xc9;
|
|
159
160
|
const JS_NULL = 0xca;
|
|
160
161
|
// 0xcb was the former whole-node JS_RAW_JSON escape (removed — TS type
|
|
@@ -594,6 +595,8 @@ function readNodeBody(ctx, tag, start, end) {
|
|
|
594
595
|
return readJsBareExpr(ctx, 'TSParameterProperty', start, end);
|
|
595
596
|
case JS_TS_MODULE_DECLARATION:
|
|
596
597
|
return readJsTSModuleDeclaration(ctx, start, end);
|
|
598
|
+
case JS_TS_MODULE_BLOCK:
|
|
599
|
+
return readJsTSModuleBlock(ctx, start, end);
|
|
597
600
|
case JS_TS_AS_EXPRESSION:
|
|
598
601
|
return readJsTSAssertion(ctx, 'TSAsExpression', start, end, true);
|
|
599
602
|
case JS_TS_SATISFIES_EXPRESSION:
|
|
@@ -1208,18 +1211,24 @@ function readJsFunctionDeclaration(ctx, start, end) {
|
|
|
1208
1211
|
const expression = readBool(ctx);
|
|
1209
1212
|
const generator = readBool(ctx);
|
|
1210
1213
|
const asyncFlag = readBool(ctx);
|
|
1214
|
+
const declare = readBool(ctx);
|
|
1211
1215
|
const typeParameters = readOptTypeAnnotation(ctx);
|
|
1216
|
+
const returnType = readOptTypeAnnotation(ctx);
|
|
1212
1217
|
const params = readChildArray(ctx);
|
|
1213
1218
|
const body = readOptNode(ctx);
|
|
1214
|
-
|
|
1219
|
+
// A function with no body is a `declare function` or an overload signature,
|
|
1220
|
+
// which acorn-typescript spells as `TSDeclareFunction` with no `body` key.
|
|
1221
|
+
const node = { type: body === null ? 'TSDeclareFunction' : 'FunctionDeclaration', start, end };
|
|
1215
1222
|
if (loc !== null) node.loc = loc;
|
|
1223
|
+
if (declare) node.declare = true;
|
|
1216
1224
|
node.id = id;
|
|
1217
1225
|
node.expression = expression;
|
|
1218
1226
|
node.generator = generator;
|
|
1219
1227
|
node.async = asyncFlag;
|
|
1220
1228
|
if (typeParameters !== null) node.typeParameters = typeParameters;
|
|
1221
1229
|
node.params = params;
|
|
1222
|
-
node.
|
|
1230
|
+
if (returnType !== null) node.returnType = returnType;
|
|
1231
|
+
if (body !== null) node.body = body;
|
|
1223
1232
|
return node;
|
|
1224
1233
|
}
|
|
1225
1234
|
|
|
@@ -1593,10 +1602,27 @@ function readJsTSTypeAnnotation(ctx, start, end) {
|
|
|
1593
1602
|
|
|
1594
1603
|
function readJsTSModuleDeclaration(ctx, start, end) {
|
|
1595
1604
|
const loc = readTypedLoc(ctx);
|
|
1605
|
+
const id = readOptNode(ctx);
|
|
1606
|
+
const declare = readBool(ctx);
|
|
1607
|
+
const global = readBool(ctx);
|
|
1596
1608
|
const body = readOptNode(ctx);
|
|
1597
1609
|
const node = { type: 'TSModuleDeclaration', start, end };
|
|
1598
1610
|
if (loc !== null) node.loc = loc;
|
|
1611
|
+
// acorn-typescript omits both flags when false, and orders `global` before
|
|
1612
|
+
// `id` and `declare` after `body`.
|
|
1613
|
+
if (global) node.global = true;
|
|
1614
|
+
if (id !== null) node.id = id;
|
|
1599
1615
|
if (body !== null) node.body = body;
|
|
1616
|
+
if (declare) node.declare = true;
|
|
1617
|
+
return node;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
function readJsTSModuleBlock(ctx, start, end) {
|
|
1621
|
+
const loc = readTypedLoc(ctx);
|
|
1622
|
+
const body = readChildArray(ctx);
|
|
1623
|
+
const node = { type: 'TSModuleBlock', start, end };
|
|
1624
|
+
if (loc !== null) node.loc = loc;
|
|
1625
|
+
node.body = body;
|
|
1600
1626
|
return node;
|
|
1601
1627
|
}
|
|
1602
1628
|
|