@vizejs/native 0.707.0 → 0.708.0

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/index.d.ts +9 -0
  2. package/index.js +21 -0
  3. package/package.json +9 -9
package/index.d.ts CHANGED
@@ -340,6 +340,15 @@ export interface CompilerOptions {
340
340
  scriptExt?: string;
341
341
  }
342
342
 
343
+ /** One explicit filesystem-stability window for imported-type resolution. */
344
+ export declare class TypeResolutionBatch {
345
+ /** End this stability window. Repeated calls are harmless. */
346
+ close(): boolean;
347
+ }
348
+
349
+ /** Begin an explicit imported-type filesystem-stability window. */
350
+ export declare function beginTypeResolutionBatch(): TypeResolutionBatch;
351
+
343
352
  export declare function compileSfc(
344
353
  source: string,
345
354
  options?: SfcCompileOptionsNapi | undefined | null,
package/index.js CHANGED
@@ -4,13 +4,34 @@
4
4
  // Native target selection and package version checks live in native-binding.js.
5
5
  const nativeBinding = require("./native-binding");
6
6
 
7
+ const compileSfcNative = nativeBinding.compileSfc;
8
+ const beginTypeResolutionBatchNative = nativeBinding.beginTypeResolutionBatch;
9
+ let activeTypeResolutionTurn = null;
10
+ nativeBinding.compileSfc = function compileSfc(source, options) {
11
+ if (typeof beginTypeResolutionBatchNative !== "function") {
12
+ return compileSfcNative(source, options);
13
+ }
14
+ if (activeTypeResolutionTurn === null) {
15
+ const turn = beginTypeResolutionBatchNative();
16
+ activeTypeResolutionTurn = turn;
17
+ queueMicrotask(() => {
18
+ if (activeTypeResolutionTurn !== turn) return;
19
+ activeTypeResolutionTurn = null;
20
+ turn.close();
21
+ });
22
+ }
23
+ return compileSfcNative(source, options);
24
+ };
25
+
7
26
  module.exports = nativeBinding;
8
27
  module.exports.getVueLanguageProjectMetadata = nativeBinding.getVueLanguageProjectMetadata;
9
28
  module.exports.generateVueLanguageCode = nativeBinding.generateVueLanguageCode;
10
29
  module.exports.PluginDocumentHandle = nativeBinding.PluginDocumentHandle;
30
+ module.exports.TypeResolutionBatch = nativeBinding.TypeResolutionBatch;
11
31
  module.exports.applyOutputPlugins = nativeBinding.applyOutputPlugins;
12
32
  module.exports.applyViteDefineReplacements = nativeBinding.applyViteDefineReplacements;
13
33
  module.exports.artToCsf = nativeBinding.artToCsf;
34
+ module.exports.beginTypeResolutionBatch = nativeBinding.beginTypeResolutionBatch;
14
35
  module.exports.buildDesignTokenMap = nativeBinding.buildDesignTokenMap;
15
36
  module.exports.buildInspectorGraph = nativeBinding.buildInspectorGraph;
16
37
  module.exports.chunkVitePrecompileFiles = nativeBinding.chunkVitePrecompileFiles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/native",
3
- "version": "0.707.0",
3
+ "version": "0.708.0",
4
4
  "description": "High-performance Vue.js compiler - Native bindings",
5
5
  "keywords": [
6
6
  "compiler",
@@ -38,14 +38,14 @@
38
38
  "@napi-rs/cli": "3.6.2"
39
39
  },
40
40
  "optionalDependencies": {
41
- "@vizejs/native-darwin-arm64": "0.707.0",
42
- "@vizejs/native-darwin-x64": "0.707.0",
43
- "@vizejs/native-linux-arm64-gnu": "0.707.0",
44
- "@vizejs/native-linux-arm64-musl": "0.707.0",
45
- "@vizejs/native-linux-x64-gnu": "0.707.0",
46
- "@vizejs/native-linux-x64-musl": "0.707.0",
47
- "@vizejs/native-win32-arm64-msvc": "0.707.0",
48
- "@vizejs/native-win32-x64-msvc": "0.707.0"
41
+ "@vizejs/native-darwin-arm64": "0.708.0",
42
+ "@vizejs/native-darwin-x64": "0.708.0",
43
+ "@vizejs/native-linux-arm64-gnu": "0.708.0",
44
+ "@vizejs/native-linux-arm64-musl": "0.708.0",
45
+ "@vizejs/native-linux-x64-gnu": "0.708.0",
46
+ "@vizejs/native-linux-x64-musl": "0.708.0",
47
+ "@vizejs/native-win32-arm64-msvc": "0.708.0",
48
+ "@vizejs/native-win32-x64-msvc": "0.708.0"
49
49
  },
50
50
  "napi": {
51
51
  "binaryName": "vize-vitrine",