@vizejs/native 0.442.0 → 0.454.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.
package/index.d.ts CHANGED
@@ -271,7 +271,7 @@ export interface CompileResult {
271
271
 
272
272
  /** Compiler options for bindings */
273
273
  export interface CompilerOptions {
274
- /** Vue template whitespace strategy, or Vize's opt-in "vue2-line-breaks" migration mode. */
274
+ /** Vue template whitespace strategy, or Vize's opt-in Vue 2 migration modes ("vue2-line-breaks", "vue2-preserve"). */
275
275
  whitespace?: string;
276
276
  /** Output mode: "module" or "function" */
277
277
  mode?: string;
@@ -630,6 +630,12 @@ export declare function generateVariants(
630
630
 
631
631
  export declare function generateViteHmrCode(scopeId: string, updateType: string): string;
632
632
 
633
+ /**
634
+ * An opaque identity minted once by the native build invocation.
635
+ * Direct builds without the instrumented producer return no identity.
636
+ */
637
+ export declare function getNativeBuildToken(): string | null;
638
+
633
639
  /** Get Patina's currently registered rule metadata. */
634
640
  export declare function getPatinaRules(): any;
635
641
 
@@ -1028,6 +1034,8 @@ export declare function parseTemplate(
1028
1034
 
1029
1035
  /** Single-file Patina lint options for NAPI */
1030
1036
  export interface PatinaLintOptionsNapi {
1037
+ /** Include native fix messages and UTF-8 byte text edits in diagnostics. */
1038
+ includeFixes?: boolean;
1031
1039
  /** Filename used for diagnostics */
1032
1040
  filename?: string;
1033
1041
  /** Locale code: "en", "ja", or "zh" */
@@ -1375,7 +1383,11 @@ export interface TransformPluginNapi {
1375
1383
  run: (arg: string) => string;
1376
1384
  }
1377
1385
 
1378
- export declare function transformViteCssVarsForPipeline(css: string, scopeId: string): string;
1386
+ export declare function transformViteCssVarsForPipeline(
1387
+ css: string,
1388
+ scopeId: string,
1389
+ productionFilename?: string | undefined | null,
1390
+ ): string;
1379
1391
 
1380
1392
  /**
1381
1393
  * Perform type checking on a Vue SFC
@@ -1549,7 +1561,7 @@ export interface OxlintHtmlOptions {
1549
1561
  rootJson: string;
1550
1562
  /** Exact original caller snapshot, including every whitespace byte. */
1551
1563
  rootBytes: Array<number>;
1552
- /** Exact supported host version: 1.78.0 or 1.86.0. */
1564
+ /** Exact supported host version: 1.78.0, 1.81.0, or 1.86.0. */
1553
1565
  hostProfile: string;
1554
1566
  noIgnore: boolean;
1555
1567
  cliIgnorePatterns: Array<string>;
@@ -1623,6 +1635,7 @@ export interface OxlintHtmlCompleted {
1623
1635
  cwd: string;
1624
1636
  literalTarget: string;
1625
1637
  target: string;
1638
+ /** VCS root, or the filesystem matcher root for the 1.81 no-VCS profile. */
1626
1639
  repository: string;
1627
1640
  rootJson: string;
1628
1641
  noIgnore: boolean;
package/index.js CHANGED
@@ -45,6 +45,7 @@ module.exports.generateDesignTokensMarkdown = nativeBinding.generateDesignTokens
45
45
  module.exports.generateSfcScopeId = nativeBinding.generateSfcScopeId;
46
46
  module.exports.generateVariants = nativeBinding.generateVariants;
47
47
  module.exports.generateViteHmrCode = nativeBinding.generateViteHmrCode;
48
+ module.exports.getNativeBuildToken = nativeBinding.getNativeBuildToken;
48
49
  module.exports.getPatinaRules = nativeBinding.getPatinaRules;
49
50
  module.exports.getTypeCheckCapabilities = nativeBinding.getTypeCheckCapabilities;
50
51
  module.exports.hasSfcScopedStyle = nativeBinding.hasSfcScopedStyle;
@@ -0,0 +1,56 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+
4
+ const { randomUUID } = require("node:crypto");
5
+ const { extname } = require("node:path");
6
+ const registry = Symbol.for("@vizejs/native/binding-identities/v1");
7
+ const shared = globalThis[registry];
8
+ const identities = shared instanceof WeakMap ? shared : new WeakMap();
9
+ if (shared === undefined) {
10
+ try {
11
+ Object.defineProperty(globalThis, registry, { value: identities });
12
+ } catch {
13
+ // A frozen global still permits safe identities local to this helper copy.
14
+ }
15
+ }
16
+
17
+ function remember(binding, isNative = false) {
18
+ if ((typeof binding !== "object" || binding === null) && typeof binding !== "function") return;
19
+ if (identities.has(binding)) return;
20
+ let token;
21
+ if (isNative) {
22
+ try {
23
+ token = binding.getNativeBuildToken?.();
24
+ } catch {
25
+ // An unavailable or unknown provider cannot authorize persistent reuse.
26
+ }
27
+ }
28
+ identities.set(
29
+ binding,
30
+ Object.freeze(
31
+ typeof token === "string" && /^[0-9a-f]{32}$/.test(token)
32
+ ? { kind: "native", token }
33
+ : { kind: "process", nonce: randomUUID() },
34
+ ),
35
+ );
36
+ }
37
+
38
+ // Read the actual image's immutable token, never a possibly replaced disk file.
39
+ function requireWithBindingIdentity(requireBinding, specifier) {
40
+ const binding = requireBinding(specifier);
41
+ let isNative = false;
42
+ try {
43
+ isNative = extname(requireBinding.resolve(specifier)) === ".node";
44
+ } catch {
45
+ // A cached binding can still load after its original path disappears.
46
+ }
47
+ remember(binding, isNative);
48
+ return binding;
49
+ }
50
+
51
+ function getBindingIdentity(binding) {
52
+ remember(binding);
53
+ return identities.get(binding);
54
+ }
55
+
56
+ module.exports = { requireWithBindingIdentity, getBindingIdentity };
package/native-binding.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // @ts-nocheck
3
3
 
4
4
  const { loadTarget, nativeTargets } = require("./native-targets");
5
-
5
+ const { requireWithBindingIdentity } = require("./native-binding-identity");
6
6
  const loadErrors = [];
7
7
 
8
8
  function isMissingModuleForSpecifier(error, specifier) {
@@ -15,7 +15,7 @@ function isMissingModuleForSpecifier(error, specifier) {
15
15
 
16
16
  function tryRequire(specifier) {
17
17
  try {
18
- return require(specifier);
18
+ return requireWithBindingIdentity(require, specifier);
19
19
  } catch (error) {
20
20
  if (isMissingModuleForSpecifier(error, specifier)) {
21
21
  error.vizeMissingNativeSpecifier = true;
package/native-targets.js CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  const { readFileSync } = require("node:fs");
5
5
  const { execFileSync } = require("node:child_process");
6
-
6
+ const { requireWithBindingIdentity } = require("./native-binding-identity");
7
7
  const binaryName = "vize-vitrine";
8
8
  const packageVersion = require("./package.json").version;
9
9
 
@@ -107,7 +107,7 @@ function nativeTargets(loadErrors) {
107
107
 
108
108
  function requireTargetPackage(target) {
109
109
  const packageName = `@vizejs/native-${target}`;
110
- const binding = require(packageName);
110
+ const binding = requireWithBindingIdentity(require, packageName);
111
111
  const bindingPackageVersion = require(`${packageName}/package.json`).version;
112
112
 
113
113
  if (
@@ -125,7 +125,7 @@ function requireTargetPackage(target) {
125
125
  function loadTarget(target, loadErrors) {
126
126
  const localBinding = `./${binaryName}.${target}.node`;
127
127
  try {
128
- return require(localBinding);
128
+ return requireWithBindingIdentity(require, localBinding);
129
129
  } catch (error) {
130
130
  markMissingModuleForSpecifier(error, localBinding);
131
131
  loadErrors.push(error);
package/package.json CHANGED
@@ -13,6 +13,7 @@
13
13
  "index.js",
14
14
  "index.d.ts",
15
15
  "native-binding.js",
16
+ "native-binding-identity.js",
16
17
  "native-targets.js"
17
18
  ],
18
19
  "homepage": "https://github.com/ubugeeei-prod/vize",
@@ -47,14 +48,14 @@
47
48
  ]
48
49
  },
49
50
  "optionalDependencies": {
50
- "@vizejs/native-darwin-arm64": "0.442.0",
51
- "@vizejs/native-darwin-x64": "0.442.0",
52
- "@vizejs/native-linux-arm64-gnu": "0.442.0",
53
- "@vizejs/native-linux-arm64-musl": "0.442.0",
54
- "@vizejs/native-linux-x64-gnu": "0.442.0",
55
- "@vizejs/native-linux-x64-musl": "0.442.0",
56
- "@vizejs/native-win32-arm64-msvc": "0.442.0",
57
- "@vizejs/native-win32-x64-msvc": "0.442.0"
51
+ "@vizejs/native-darwin-arm64": "0.454.0",
52
+ "@vizejs/native-darwin-x64": "0.454.0",
53
+ "@vizejs/native-linux-arm64-gnu": "0.454.0",
54
+ "@vizejs/native-linux-arm64-musl": "0.454.0",
55
+ "@vizejs/native-linux-x64-gnu": "0.454.0",
56
+ "@vizejs/native-linux-x64-musl": "0.454.0",
57
+ "@vizejs/native-win32-arm64-msvc": "0.454.0",
58
+ "@vizejs/native-win32-x64-msvc": "0.454.0"
58
59
  },
59
60
  "publishConfig": {
60
61
  "access": "public"
@@ -65,10 +66,10 @@
65
66
  "url": "https://github.com/ubugeeei-prod/vize"
66
67
  },
67
68
  "types": "index.d.ts",
68
- "version": "0.442.0",
69
+ "version": "0.454.0",
69
70
  "scripts": {
70
71
  "build": "node ./scripts/build-local.mjs --release",
71
- "build:ci": "napi build --platform --profile ci --manifest-path ../../crates/vize_vitrine/Cargo.toml -p vize_vitrine --features napi,legacy --output-dir . && node ./scripts/sync-entrypoint.mjs",
72
+ "build:ci": "node ./scripts/build-ci.mjs",
72
73
  "build:debug": "node ./scripts/build-local.mjs"
73
74
  }
74
75
  }