@rsvelte/vite-plugin-svelte-native 0.3.10 → 0.3.12
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 +31 -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.12",
|
|
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.12",
|
|
34
|
+
"@rsvelte/vite-plugin-svelte-native-darwin-x64": "^0.3.12",
|
|
35
|
+
"@rsvelte/vite-plugin-svelte-native-linux-arm64-gnu": "^0.3.12",
|
|
36
|
+
"@rsvelte/vite-plugin-svelte-native-linux-x64-gnu": "^0.3.12",
|
|
37
|
+
"@rsvelte/vite-plugin-svelte-native-win32-x64-msvc": "^0.3.12"
|
|
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 = 11;
|
|
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:
|
|
@@ -1123,6 +1126,8 @@ function readJsRestElement(ctx, start, end) {
|
|
|
1123
1126
|
const node = { type: 'RestElement', start, end };
|
|
1124
1127
|
if (loc !== null) node.loc = loc;
|
|
1125
1128
|
node.argument = argument;
|
|
1129
|
+
const typeAnnotation = readOptTypeAnnotation(ctx);
|
|
1130
|
+
if (typeAnnotation !== null) node.typeAnnotation = typeAnnotation;
|
|
1126
1131
|
return node;
|
|
1127
1132
|
}
|
|
1128
1133
|
|
|
@@ -1208,18 +1213,24 @@ function readJsFunctionDeclaration(ctx, start, end) {
|
|
|
1208
1213
|
const expression = readBool(ctx);
|
|
1209
1214
|
const generator = readBool(ctx);
|
|
1210
1215
|
const asyncFlag = readBool(ctx);
|
|
1216
|
+
const declare = readBool(ctx);
|
|
1211
1217
|
const typeParameters = readOptTypeAnnotation(ctx);
|
|
1218
|
+
const returnType = readOptTypeAnnotation(ctx);
|
|
1212
1219
|
const params = readChildArray(ctx);
|
|
1213
1220
|
const body = readOptNode(ctx);
|
|
1214
|
-
|
|
1221
|
+
// A function with no body is a `declare function` or an overload signature,
|
|
1222
|
+
// which acorn-typescript spells as `TSDeclareFunction` with no `body` key.
|
|
1223
|
+
const node = { type: body === null ? 'TSDeclareFunction' : 'FunctionDeclaration', start, end };
|
|
1215
1224
|
if (loc !== null) node.loc = loc;
|
|
1225
|
+
if (declare) node.declare = true;
|
|
1216
1226
|
node.id = id;
|
|
1217
1227
|
node.expression = expression;
|
|
1218
1228
|
node.generator = generator;
|
|
1219
1229
|
node.async = asyncFlag;
|
|
1220
1230
|
if (typeParameters !== null) node.typeParameters = typeParameters;
|
|
1221
1231
|
node.params = params;
|
|
1222
|
-
node.
|
|
1232
|
+
if (returnType !== null) node.returnType = returnType;
|
|
1233
|
+
if (body !== null) node.body = body;
|
|
1223
1234
|
return node;
|
|
1224
1235
|
}
|
|
1225
1236
|
|
|
@@ -1593,10 +1604,27 @@ function readJsTSTypeAnnotation(ctx, start, end) {
|
|
|
1593
1604
|
|
|
1594
1605
|
function readJsTSModuleDeclaration(ctx, start, end) {
|
|
1595
1606
|
const loc = readTypedLoc(ctx);
|
|
1607
|
+
const id = readOptNode(ctx);
|
|
1608
|
+
const declare = readBool(ctx);
|
|
1609
|
+
const global = readBool(ctx);
|
|
1596
1610
|
const body = readOptNode(ctx);
|
|
1597
1611
|
const node = { type: 'TSModuleDeclaration', start, end };
|
|
1598
1612
|
if (loc !== null) node.loc = loc;
|
|
1613
|
+
// acorn-typescript omits both flags when false, and orders `global` before
|
|
1614
|
+
// `id` and `declare` after `body`.
|
|
1615
|
+
if (global) node.global = true;
|
|
1616
|
+
if (id !== null) node.id = id;
|
|
1599
1617
|
if (body !== null) node.body = body;
|
|
1618
|
+
if (declare) node.declare = true;
|
|
1619
|
+
return node;
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
function readJsTSModuleBlock(ctx, start, end) {
|
|
1623
|
+
const loc = readTypedLoc(ctx);
|
|
1624
|
+
const body = readChildArray(ctx);
|
|
1625
|
+
const node = { type: 'TSModuleBlock', start, end };
|
|
1626
|
+
if (loc !== null) node.loc = loc;
|
|
1627
|
+
node.body = body;
|
|
1600
1628
|
return node;
|
|
1601
1629
|
}
|
|
1602
1630
|
|