@file-viewer/vite-plugin 2.3.0 → 2.3.1
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.js +23 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1209,6 +1209,20 @@ async function copyDirectoryIfPresent(from, to) {
|
|
|
1209
1209
|
await cp(from, to, { recursive: true, force: true });
|
|
1210
1210
|
return true;
|
|
1211
1211
|
}
|
|
1212
|
+
async function copyVersionedCadRuntimeDirectoryIfPresent(from, to, runtimeVersion) {
|
|
1213
|
+
if (!from || !existsSync(from)) {
|
|
1214
|
+
return false;
|
|
1215
|
+
}
|
|
1216
|
+
if (!runtimeVersion || !/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(runtimeVersion)) {
|
|
1217
|
+
throw new Error(`[file-viewer:vite-plugin] Cannot publish CAD runtime assets with invalid version ${JSON.stringify(runtimeVersion)}.`);
|
|
1218
|
+
}
|
|
1219
|
+
const copied = await copyDirectoryIfPresent(from, to);
|
|
1220
|
+
if (!copied) {
|
|
1221
|
+
return false;
|
|
1222
|
+
}
|
|
1223
|
+
const versionedTarget = join(to, runtimeVersion);
|
|
1224
|
+
return copyDirectoryIfPresent(from, versionedTarget);
|
|
1225
|
+
}
|
|
1212
1226
|
async function copyPdfCjkFontAssets(from, to) {
|
|
1213
1227
|
if (!from) {
|
|
1214
1228
|
return false;
|
|
@@ -1291,8 +1305,15 @@ async function copyKnownRendererAssets(targetRoot, rendererIds) {
|
|
|
1291
1305
|
sourceVersion: spreadsheetVersion || undefined
|
|
1292
1306
|
}
|
|
1293
1307
|
: undefined);
|
|
1294
|
-
const
|
|
1295
|
-
|
|
1308
|
+
const cadDependencyAnchors = ['@file-viewer/renderer-cad'];
|
|
1309
|
+
const cadRoot = resolvePackageRoot('@flyfish-dev/cad-viewer', cadDependencyAnchors);
|
|
1310
|
+
const cadRuntimeVersion = assertOwnedPackageVersion('@flyfish-dev/cad-viewer', cadRoot, '@file-viewer/renderer-cad', cadDependencyAnchors);
|
|
1311
|
+
await push('cad', 'cad-wasm-directory', join(targetRoot, 'wasm/cad'), () => copyVersionedCadRuntimeDirectoryIfPresent(cadRoot ? join(cadRoot, 'dist/wasm') : null, join(targetRoot, 'wasm/cad'), cadRuntimeVersion), undefined, cadRoot
|
|
1312
|
+
? {
|
|
1313
|
+
sourcePackage: '@flyfish-dev/cad-viewer',
|
|
1314
|
+
sourceVersion: cadRuntimeVersion || undefined
|
|
1315
|
+
}
|
|
1316
|
+
: undefined);
|
|
1296
1317
|
const modelDependencyAnchors = [
|
|
1297
1318
|
'@file-viewer/renderer-3d',
|
|
1298
1319
|
'@file-viewer/geometry-engine'
|
package/package.json
CHANGED