@bamboocss/vite 1.48.1 → 1.48.3
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/dist/index.cjs +35 -23
- package/dist/index.mjs +35 -23
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -875,10 +875,20 @@ const bamboocss = (options = {}) => {
|
|
|
875
875
|
] : null
|
|
876
876
|
]);
|
|
877
877
|
const transformArtifactIntegrity = (environment, artifact) => (0, node_crypto.createHmac)("sha256", transformArtifactIntegrityKey).update(serializeTransformArtifact(environment, artifact)).digest("base64url");
|
|
878
|
-
const sealTransformArtifact = (environment, artifact) =>
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
878
|
+
const sealTransformArtifact = (environment, artifact) => {
|
|
879
|
+
const detached = {
|
|
880
|
+
...artifact,
|
|
881
|
+
skipped: artifact.skipped.map(([reason, count]) => [reason, count]),
|
|
882
|
+
survivors: artifact.survivors.map((survivor) => ({ ...survivor })),
|
|
883
|
+
classNames: [...artifact.classNames],
|
|
884
|
+
dependencies: [...artifact.dependencies],
|
|
885
|
+
...artifact.signature ? { signature: { ...artifact.signature } } : {}
|
|
886
|
+
};
|
|
887
|
+
return {
|
|
888
|
+
...detached,
|
|
889
|
+
integrity: transformArtifactIntegrity(environment, detached)
|
|
890
|
+
};
|
|
891
|
+
};
|
|
882
892
|
const skipReasons = new Set([
|
|
883
893
|
"dynamic",
|
|
884
894
|
"raw-call",
|
|
@@ -1408,16 +1418,8 @@ const bamboocss = (options = {}) => {
|
|
|
1408
1418
|
const reasons = Array.from(skipped.entries()).sort((a, b) => b[1] - a[1]).map(([reason, count]) => `${reason}=${count}`).join(" ");
|
|
1409
1419
|
_bamboocss_logger.logger.info("vite:transform", `Compiled ${folded}/${total} (${share}%) across ${filesWithFolds}/${perFile.size} files` + (reasons ? ` — declined: ${reasons}` : ""));
|
|
1410
1420
|
};
|
|
1411
|
-
/**
|
|
1412
|
-
const
|
|
1413
|
-
let snapshot;
|
|
1414
|
-
try {
|
|
1415
|
-
snapshot = structuredClone(value);
|
|
1416
|
-
} catch {
|
|
1417
|
-
throw cachedArtifactError(expectedModuleId, environment, void 0, `could not be snapshotted as serializable schema version ${TRANSFORM_ARTIFACT_VERSION} data`);
|
|
1418
|
-
}
|
|
1419
|
-
if (!isTransformArtifact(snapshot) || snapshot.moduleId !== expectedModuleId || snapshot.file !== expectedModuleId.split("?")[0] || !hasValidTransformArtifactIntegrity(environment, snapshot)) throw cachedArtifactError(expectedModuleId, environment, snapshot);
|
|
1420
|
-
const artifact = snapshot;
|
|
1421
|
+
/** Apply every per-build fact established by one trusted or validated transform artifact. */
|
|
1422
|
+
const commitTransformArtifact = (state, artifact) => {
|
|
1421
1423
|
const { file, moduleId } = artifact;
|
|
1422
1424
|
state.transformArtifactsByModule.set(moduleId, artifact);
|
|
1423
1425
|
recordFoldDependencies(state, moduleId, file, artifact.dependencies);
|
|
@@ -1427,6 +1429,17 @@ const bamboocss = (options = {}) => {
|
|
|
1427
1429
|
state.foldInputsByModule.delete(moduleId);
|
|
1428
1430
|
}
|
|
1429
1431
|
};
|
|
1432
|
+
/** Snapshot and authenticate transform metadata owned by Rollup's external cache. */
|
|
1433
|
+
const applyCachedTransformArtifact = (state, value, expectedModuleId, environment) => {
|
|
1434
|
+
let snapshot;
|
|
1435
|
+
try {
|
|
1436
|
+
snapshot = structuredClone(value);
|
|
1437
|
+
} catch {
|
|
1438
|
+
throw cachedArtifactError(expectedModuleId, environment, void 0, `could not be snapshotted as serializable schema version ${TRANSFORM_ARTIFACT_VERSION} data`);
|
|
1439
|
+
}
|
|
1440
|
+
if (!isTransformArtifact(snapshot) || snapshot.moduleId !== expectedModuleId || snapshot.file !== expectedModuleId.split("?")[0] || !hasValidTransformArtifactIntegrity(environment, snapshot)) throw cachedArtifactError(expectedModuleId, environment, snapshot);
|
|
1441
|
+
commitTransformArtifact(state, snapshot);
|
|
1442
|
+
};
|
|
1430
1443
|
/**
|
|
1431
1444
|
* Replay transform metadata for modules Rollup reused from its cache.
|
|
1432
1445
|
*
|
|
@@ -1449,7 +1462,7 @@ const bamboocss = (options = {}) => {
|
|
|
1449
1462
|
const meta = pluginContext.getModuleInfo(id)?.meta;
|
|
1450
1463
|
if (!meta || !Object.prototype.hasOwnProperty.call(meta, TRANSFORM_META_KEY)) continue;
|
|
1451
1464
|
const artifact = meta[TRANSFORM_META_KEY];
|
|
1452
|
-
|
|
1465
|
+
applyCachedTransformArtifact(state, artifact, id, environmentName(pluginContext));
|
|
1453
1466
|
}
|
|
1454
1467
|
};
|
|
1455
1468
|
/**
|
|
@@ -2246,8 +2259,7 @@ const bamboocss = (options = {}) => {
|
|
|
2246
2259
|
})), ...result.exportReads]);
|
|
2247
2260
|
} catch (error) {
|
|
2248
2261
|
_bamboocss_logger.logger.caughtError("vite:transform", `Failed to compile ${filePath}`, error);
|
|
2249
|
-
|
|
2250
|
-
applyTransformArtifact(state, sealTransformArtifact(environmentName(this), {
|
|
2262
|
+
commitTransformArtifact(state, {
|
|
2251
2263
|
version: TRANSFORM_ARTIFACT_VERSION,
|
|
2252
2264
|
moduleId: id,
|
|
2253
2265
|
file: filePath,
|
|
@@ -2260,8 +2272,8 @@ const bamboocss = (options = {}) => {
|
|
|
2260
2272
|
}],
|
|
2261
2273
|
transformedFile: false,
|
|
2262
2274
|
classNames: [],
|
|
2263
|
-
dependencies:
|
|
2264
|
-
})
|
|
2275
|
+
dependencies: [...state.dependenciesByModule.get(id) ?? []]
|
|
2276
|
+
});
|
|
2265
2277
|
state.foldSignatures.delete(id);
|
|
2266
2278
|
state.foldInputsByModule.delete(id);
|
|
2267
2279
|
if (command === "serve") throw asError(error, `failed to compile ${filePath}`);
|
|
@@ -2279,7 +2291,7 @@ const bamboocss = (options = {}) => {
|
|
|
2279
2291
|
reason: entry.reason
|
|
2280
2292
|
});
|
|
2281
2293
|
}
|
|
2282
|
-
const artifact =
|
|
2294
|
+
const artifact = {
|
|
2283
2295
|
version: TRANSFORM_ARTIFACT_VERSION,
|
|
2284
2296
|
moduleId: id,
|
|
2285
2297
|
file: filePath,
|
|
@@ -2294,8 +2306,8 @@ const bamboocss = (options = {}) => {
|
|
|
2294
2306
|
output: digest(result.code),
|
|
2295
2307
|
path: filePath
|
|
2296
2308
|
} } : {}
|
|
2297
|
-
}
|
|
2298
|
-
|
|
2309
|
+
};
|
|
2310
|
+
commitTransformArtifact(state, artifact);
|
|
2299
2311
|
if (artifact.signature && (command === "serve" || requestedParsePath !== filePath)) state.foldInputsByModule.set(id, {
|
|
2300
2312
|
code,
|
|
2301
2313
|
input: artifact.signature.input,
|
|
@@ -2312,7 +2324,7 @@ const bamboocss = (options = {}) => {
|
|
|
2312
2324
|
...survivor
|
|
2313
2325
|
})));
|
|
2314
2326
|
}
|
|
2315
|
-
const meta = { [TRANSFORM_META_KEY]: artifact };
|
|
2327
|
+
const meta = { [TRANSFORM_META_KEY]: sealTransformArtifact(environmentName(this), artifact) };
|
|
2316
2328
|
if (!result.folded.length) return typeof this.getModuleInfo === "function" ? {
|
|
2317
2329
|
code,
|
|
2318
2330
|
map: null,
|
package/dist/index.mjs
CHANGED
|
@@ -870,10 +870,20 @@ const bamboocss = (options = {}) => {
|
|
|
870
870
|
] : null
|
|
871
871
|
]);
|
|
872
872
|
const transformArtifactIntegrity = (environment, artifact) => createHmac("sha256", transformArtifactIntegrityKey).update(serializeTransformArtifact(environment, artifact)).digest("base64url");
|
|
873
|
-
const sealTransformArtifact = (environment, artifact) =>
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
873
|
+
const sealTransformArtifact = (environment, artifact) => {
|
|
874
|
+
const detached = {
|
|
875
|
+
...artifact,
|
|
876
|
+
skipped: artifact.skipped.map(([reason, count]) => [reason, count]),
|
|
877
|
+
survivors: artifact.survivors.map((survivor) => ({ ...survivor })),
|
|
878
|
+
classNames: [...artifact.classNames],
|
|
879
|
+
dependencies: [...artifact.dependencies],
|
|
880
|
+
...artifact.signature ? { signature: { ...artifact.signature } } : {}
|
|
881
|
+
};
|
|
882
|
+
return {
|
|
883
|
+
...detached,
|
|
884
|
+
integrity: transformArtifactIntegrity(environment, detached)
|
|
885
|
+
};
|
|
886
|
+
};
|
|
877
887
|
const skipReasons = new Set([
|
|
878
888
|
"dynamic",
|
|
879
889
|
"raw-call",
|
|
@@ -1403,16 +1413,8 @@ const bamboocss = (options = {}) => {
|
|
|
1403
1413
|
const reasons = Array.from(skipped.entries()).sort((a, b) => b[1] - a[1]).map(([reason, count]) => `${reason}=${count}`).join(" ");
|
|
1404
1414
|
logger.info("vite:transform", `Compiled ${folded}/${total} (${share}%) across ${filesWithFolds}/${perFile.size} files` + (reasons ? ` — declined: ${reasons}` : ""));
|
|
1405
1415
|
};
|
|
1406
|
-
/**
|
|
1407
|
-
const
|
|
1408
|
-
let snapshot;
|
|
1409
|
-
try {
|
|
1410
|
-
snapshot = structuredClone(value);
|
|
1411
|
-
} catch {
|
|
1412
|
-
throw cachedArtifactError(expectedModuleId, environment, void 0, `could not be snapshotted as serializable schema version ${TRANSFORM_ARTIFACT_VERSION} data`);
|
|
1413
|
-
}
|
|
1414
|
-
if (!isTransformArtifact(snapshot) || snapshot.moduleId !== expectedModuleId || snapshot.file !== expectedModuleId.split("?")[0] || !hasValidTransformArtifactIntegrity(environment, snapshot)) throw cachedArtifactError(expectedModuleId, environment, snapshot);
|
|
1415
|
-
const artifact = snapshot;
|
|
1416
|
+
/** Apply every per-build fact established by one trusted or validated transform artifact. */
|
|
1417
|
+
const commitTransformArtifact = (state, artifact) => {
|
|
1416
1418
|
const { file, moduleId } = artifact;
|
|
1417
1419
|
state.transformArtifactsByModule.set(moduleId, artifact);
|
|
1418
1420
|
recordFoldDependencies(state, moduleId, file, artifact.dependencies);
|
|
@@ -1422,6 +1424,17 @@ const bamboocss = (options = {}) => {
|
|
|
1422
1424
|
state.foldInputsByModule.delete(moduleId);
|
|
1423
1425
|
}
|
|
1424
1426
|
};
|
|
1427
|
+
/** Snapshot and authenticate transform metadata owned by Rollup's external cache. */
|
|
1428
|
+
const applyCachedTransformArtifact = (state, value, expectedModuleId, environment) => {
|
|
1429
|
+
let snapshot;
|
|
1430
|
+
try {
|
|
1431
|
+
snapshot = structuredClone(value);
|
|
1432
|
+
} catch {
|
|
1433
|
+
throw cachedArtifactError(expectedModuleId, environment, void 0, `could not be snapshotted as serializable schema version ${TRANSFORM_ARTIFACT_VERSION} data`);
|
|
1434
|
+
}
|
|
1435
|
+
if (!isTransformArtifact(snapshot) || snapshot.moduleId !== expectedModuleId || snapshot.file !== expectedModuleId.split("?")[0] || !hasValidTransformArtifactIntegrity(environment, snapshot)) throw cachedArtifactError(expectedModuleId, environment, snapshot);
|
|
1436
|
+
commitTransformArtifact(state, snapshot);
|
|
1437
|
+
};
|
|
1425
1438
|
/**
|
|
1426
1439
|
* Replay transform metadata for modules Rollup reused from its cache.
|
|
1427
1440
|
*
|
|
@@ -1444,7 +1457,7 @@ const bamboocss = (options = {}) => {
|
|
|
1444
1457
|
const meta = pluginContext.getModuleInfo(id)?.meta;
|
|
1445
1458
|
if (!meta || !Object.prototype.hasOwnProperty.call(meta, TRANSFORM_META_KEY)) continue;
|
|
1446
1459
|
const artifact = meta[TRANSFORM_META_KEY];
|
|
1447
|
-
|
|
1460
|
+
applyCachedTransformArtifact(state, artifact, id, environmentName(pluginContext));
|
|
1448
1461
|
}
|
|
1449
1462
|
};
|
|
1450
1463
|
/**
|
|
@@ -2241,8 +2254,7 @@ const bamboocss = (options = {}) => {
|
|
|
2241
2254
|
})), ...result.exportReads]);
|
|
2242
2255
|
} catch (error) {
|
|
2243
2256
|
logger.caughtError("vite:transform", `Failed to compile ${filePath}`, error);
|
|
2244
|
-
|
|
2245
|
-
applyTransformArtifact(state, sealTransformArtifact(environmentName(this), {
|
|
2257
|
+
commitTransformArtifact(state, {
|
|
2246
2258
|
version: TRANSFORM_ARTIFACT_VERSION,
|
|
2247
2259
|
moduleId: id,
|
|
2248
2260
|
file: filePath,
|
|
@@ -2255,8 +2267,8 @@ const bamboocss = (options = {}) => {
|
|
|
2255
2267
|
}],
|
|
2256
2268
|
transformedFile: false,
|
|
2257
2269
|
classNames: [],
|
|
2258
|
-
dependencies:
|
|
2259
|
-
})
|
|
2270
|
+
dependencies: [...state.dependenciesByModule.get(id) ?? []]
|
|
2271
|
+
});
|
|
2260
2272
|
state.foldSignatures.delete(id);
|
|
2261
2273
|
state.foldInputsByModule.delete(id);
|
|
2262
2274
|
if (command === "serve") throw asError(error, `failed to compile ${filePath}`);
|
|
@@ -2274,7 +2286,7 @@ const bamboocss = (options = {}) => {
|
|
|
2274
2286
|
reason: entry.reason
|
|
2275
2287
|
});
|
|
2276
2288
|
}
|
|
2277
|
-
const artifact =
|
|
2289
|
+
const artifact = {
|
|
2278
2290
|
version: TRANSFORM_ARTIFACT_VERSION,
|
|
2279
2291
|
moduleId: id,
|
|
2280
2292
|
file: filePath,
|
|
@@ -2289,8 +2301,8 @@ const bamboocss = (options = {}) => {
|
|
|
2289
2301
|
output: digest(result.code),
|
|
2290
2302
|
path: filePath
|
|
2291
2303
|
} } : {}
|
|
2292
|
-
}
|
|
2293
|
-
|
|
2304
|
+
};
|
|
2305
|
+
commitTransformArtifact(state, artifact);
|
|
2294
2306
|
if (artifact.signature && (command === "serve" || requestedParsePath !== filePath)) state.foldInputsByModule.set(id, {
|
|
2295
2307
|
code,
|
|
2296
2308
|
input: artifact.signature.input,
|
|
@@ -2307,7 +2319,7 @@ const bamboocss = (options = {}) => {
|
|
|
2307
2319
|
...survivor
|
|
2308
2320
|
})));
|
|
2309
2321
|
}
|
|
2310
|
-
const meta = { [TRANSFORM_META_KEY]: artifact };
|
|
2322
|
+
const meta = { [TRANSFORM_META_KEY]: sealTransformArtifact(environmentName(this), artifact) };
|
|
2311
2323
|
if (!result.folded.length) return typeof this.getModuleInfo === "function" ? {
|
|
2312
2324
|
code,
|
|
2313
2325
|
map: null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/vite",
|
|
3
|
-
"version": "1.48.
|
|
3
|
+
"version": "1.48.3",
|
|
4
4
|
"description": "Vite integration for Bamboo CSS",
|
|
5
5
|
"homepage": "https://bamboocss.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,18 +42,18 @@
|
|
|
42
42
|
"postcss": "8.5.26",
|
|
43
43
|
"postcss-selector-parser": "7.1.5",
|
|
44
44
|
"ts-morph": "28.0.0",
|
|
45
|
-
"@bamboocss/config": "1.48.
|
|
46
|
-
"@bamboocss/extractor": "1.48.
|
|
47
|
-
"@bamboocss/
|
|
48
|
-
"@bamboocss/node": "1.48.
|
|
49
|
-
"@bamboocss/
|
|
50
|
-
"@bamboocss/
|
|
51
|
-
"@bamboocss/
|
|
45
|
+
"@bamboocss/config": "1.48.3",
|
|
46
|
+
"@bamboocss/extractor": "1.48.3",
|
|
47
|
+
"@bamboocss/shared": "1.48.3",
|
|
48
|
+
"@bamboocss/node": "1.48.3",
|
|
49
|
+
"@bamboocss/core": "1.48.3",
|
|
50
|
+
"@bamboocss/logger": "1.48.3",
|
|
51
|
+
"@bamboocss/types": "1.48.3"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@jridgewell/trace-mapping": "^0.3.31",
|
|
55
55
|
"vite": "7.2.6",
|
|
56
|
-
"@bamboocss/fixture": "1.48.
|
|
56
|
+
"@bamboocss/fixture": "1.48.3"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"vite": ">=5"
|