@vizejs/native 0.443.0 → 0.457.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 +14 -2
- package/index.js +1 -0
- package/native-binding-identity.js +56 -0
- package/native-binding.js +2 -2
- package/native-targets.js +3 -3
- package/package.json +11 -10
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"
|
|
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(
|
|
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
|
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
|
|
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
|
|
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
|
|
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.
|
|
51
|
-
"@vizejs/native-darwin-x64": "0.
|
|
52
|
-
"@vizejs/native-linux-arm64-gnu": "0.
|
|
53
|
-
"@vizejs/native-linux-arm64-musl": "0.
|
|
54
|
-
"@vizejs/native-linux-x64-gnu": "0.
|
|
55
|
-
"@vizejs/native-linux-x64-musl": "0.
|
|
56
|
-
"@vizejs/native-win32-arm64-msvc": "0.
|
|
57
|
-
"@vizejs/native-win32-x64-msvc": "0.
|
|
51
|
+
"@vizejs/native-darwin-arm64": "0.457.0",
|
|
52
|
+
"@vizejs/native-darwin-x64": "0.457.0",
|
|
53
|
+
"@vizejs/native-linux-arm64-gnu": "0.457.0",
|
|
54
|
+
"@vizejs/native-linux-arm64-musl": "0.457.0",
|
|
55
|
+
"@vizejs/native-linux-x64-gnu": "0.457.0",
|
|
56
|
+
"@vizejs/native-linux-x64-musl": "0.457.0",
|
|
57
|
+
"@vizejs/native-win32-arm64-msvc": "0.457.0",
|
|
58
|
+
"@vizejs/native-win32-x64-msvc": "0.457.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.
|
|
69
|
+
"version": "0.457.0",
|
|
69
70
|
"scripts": {
|
|
70
71
|
"build": "node ./scripts/build-local.mjs --release",
|
|
71
|
-
"build:ci": "
|
|
72
|
+
"build:ci": "node ./scripts/build-ci.mjs",
|
|
72
73
|
"build:debug": "node ./scripts/build-local.mjs"
|
|
73
74
|
}
|
|
74
75
|
}
|