@rsvelte/vite-plugin-svelte-native 0.3.3 → 0.3.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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.cjs +19 -2
  3. package/package.json +6 -6
package/README.md CHANGED
@@ -17,7 +17,7 @@ The package ships a loader that resolves the right prebuilt `.node` binary for y
17
17
  | OS | Architecture |
18
18
  |---|---|
19
19
  | macOS | arm64, x64 |
20
- | Linux | x64 (glibc), arm64 (glibc) |
20
+ | Linux | x64 (glibc ≥ 2.35), arm64 (glibc ≥ 2.35) |
21
21
  | Windows | x64 (MSVC) |
22
22
 
23
23
  If your platform isn't listed, please [open an issue](https://github.com/baseballyama/rsvelte/issues).
package/index.cjs CHANGED
@@ -127,8 +127,9 @@ function applyWarningFilter(result, warningFilter) {
127
127
  //
128
128
  // Callers that need the raw envelope (e.g. to ship it across a worker
129
129
  // boundary without re-encoding) can still grab `binding.compileEnvelope`
130
- // directly. The legacy JSON path is preserved as `compileLegacy` for
131
- // parity testing and as an escape hatch.
130
+ // directly, except with modernAst: the v1 envelope has no AST field.
131
+ // The legacy JSON path is preserved as `compileLegacy` for parity testing
132
+ // and as an escape hatch.
132
133
  function compile(source, options) {
133
134
  if (typeof options?.cssHash === 'function') {
134
135
  // A dynamic cssHash needs the Rust→JS callback bridge, which would deadlock
@@ -138,6 +139,9 @@ function compile(source, options) {
138
139
  );
139
140
  }
140
141
  const { options: resolved, warningFilter } = prepareCompileOptions(options);
142
+ if (resolved?.modernAst) {
143
+ return applyWarningFilter(binding.compile(source, resolved), warningFilter);
144
+ }
141
145
  return applyWarningFilter(
142
146
  decodeEnvelope(binding.compileEnvelopeExternalSources(source, resolved), source),
143
147
  warningFilter,
@@ -175,6 +179,11 @@ function compileBatch(inputs) {
175
179
  if (warningFilter) filters[i] = warningFilter;
176
180
  return options === input.options ? input : { source: input.source, options };
177
181
  });
182
+ if (prepared.some((input) => input.options?.modernAst)) {
183
+ return prepared.map((input, i) =>
184
+ applyWarningFilter(binding.compile(input.source, input.options), filters[i]),
185
+ );
186
+ }
178
187
  const sourceContents = prepared.map((input) => input.source);
179
188
  const results = decodeBatch(
180
189
  binding.compileBatchExternalSources(prepared),
@@ -202,6 +211,9 @@ async function compileAsync(source, options) {
202
211
  );
203
212
  return applyWarningFilter(result, warningFilter);
204
213
  }
214
+ if (resolved?.modernAst) {
215
+ return applyWarningFilter(binding.compile(source, resolved), warningFilter);
216
+ }
205
217
  return applyWarningFilter(
206
218
  decodeEnvelope(
207
219
  await binding.compileEnvelopeExternalSourcesAsync(source, resolved),
@@ -219,6 +231,11 @@ async function compileBatchAsync(inputs) {
219
231
  if (warningFilter) filters[i] = warningFilter;
220
232
  return options === input.options ? input : { source: input.source, options };
221
233
  });
234
+ if (prepared.some((input) => input.options?.modernAst)) {
235
+ return prepared.map((input, i) =>
236
+ applyWarningFilter(binding.compile(input.source, input.options), filters[i]),
237
+ );
238
+ }
222
239
  const sourceContents = prepared.map((input) => input.source);
223
240
  const results = decodeBatch(
224
241
  await binding.compileBatchExternalSourcesAsync(prepared),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsvelte/vite-plugin-svelte-native",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "NAPI bindings to the rsvelte compiler — used by the @rsvelte vite-plugin-svelte shim",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -29,11 +29,11 @@
29
29
  "index.d.ts"
30
30
  ],
31
31
  "optionalDependencies": {
32
- "@rsvelte/vite-plugin-svelte-native-darwin-arm64": "^0.3.3",
33
- "@rsvelte/vite-plugin-svelte-native-darwin-x64": "^0.3.3",
34
- "@rsvelte/vite-plugin-svelte-native-linux-arm64-gnu": "^0.3.3",
35
- "@rsvelte/vite-plugin-svelte-native-linux-x64-gnu": "^0.3.3",
36
- "@rsvelte/vite-plugin-svelte-native-win32-x64-msvc": "^0.3.3"
32
+ "@rsvelte/vite-plugin-svelte-native-darwin-arm64": "^0.3.5",
33
+ "@rsvelte/vite-plugin-svelte-native-darwin-x64": "^0.3.5",
34
+ "@rsvelte/vite-plugin-svelte-native-linux-arm64-gnu": "^0.3.5",
35
+ "@rsvelte/vite-plugin-svelte-native-linux-x64-gnu": "^0.3.5",
36
+ "@rsvelte/vite-plugin-svelte-native-win32-x64-msvc": "^0.3.5"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"