@file-viewer/renderer-3d 3.1.2 → 3.2.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/GEO3D.md +505 -0
- package/GEO3D_THIRD_PARTY_NOTICES.md +63 -0
- package/IFC.md +14 -1
- package/README.en.md +3 -35
- package/README.md +3 -35
- package/bin/copy-geo3d-assets.mjs +143 -0
- package/bin/copy-ifc-assets.mjs +53 -17
- package/dist/geo3d-workers/geotiff-worker.js +9 -0
- package/dist/geo3d-workers/las-worker.js +3858 -0
- package/dist/geo3d-workers/licenses/_giro3d_giro3d-LICENSE +10 -0
- package/dist/geo3d-workers/licenses/copc-license +21 -0
- package/dist/geo3d-workers/licenses/cross-fetch-LICENSE +21 -0
- package/dist/geo3d-workers/licenses/laz-perf-COPYING.txt +202 -0
- package/dist/geo3d-workers/licenses/mgrs-license.md +19 -0
- package/dist/geo3d-workers/licenses/ol-LICENSE.md +25 -0
- package/dist/geo3d-workers/licenses/proj4-LICENSE.md +29 -0
- package/dist/geo3d-workers/licenses/three-LICENSE +21 -0
- package/dist/geo3d-workers/licenses/wkt-parser-LICENSE.md +29 -0
- package/dist/geo3d-workers/manifest.json +203 -0
- package/dist/geo3d-workers/raster-licenses/_giro3d_giro3d-LICENSE +10 -0
- package/dist/geo3d-workers/raster-licenses/_petamoriken_float16-LICENSE +21 -0
- package/dist/geo3d-workers/raster-licenses/geotiff-LICENSE +22 -0
- package/dist/geo3d-workers/raster-licenses/lerc-LICENSE +101 -0
- package/dist/geo3d-workers/raster-licenses/lerc-NOTICE +23 -0
- package/dist/geo3d-workers/raster-licenses/pako-LICENSE +21 -0
- package/dist/geo3d-workers/raster-licenses/quick-lru-license +9 -0
- package/dist/geo3d-workers/raster-licenses/web-worker-LICENSE +201 -0
- package/dist/geo3d-workers/raster-licenses/xml-utils-LICENSE +121 -0
- package/dist/geo3d-workers/raster-licenses/zstddec-LICENSE +54 -0
- package/dist/geo3d-workers/texture-worker.js +1 -0
- package/dist/geo3d.d.ts +10 -0
- package/dist/geo3d.js +38 -0
- package/dist/geo3dArchive.d.ts +25 -0
- package/dist/geo3dArchive.js +393 -0
- package/dist/geo3dCityJson.d.ts +65 -0
- package/dist/geo3dCityJson.js +354 -0
- package/dist/geo3dCrs.d.ts +8 -0
- package/dist/geo3dCrs.js +18 -0
- package/dist/geo3dHooks.d.ts +4 -0
- package/dist/geo3dHooks.js +91 -0
- package/dist/geo3dInspect.d.ts +32 -0
- package/dist/geo3dInspect.js +410 -0
- package/dist/geo3dLasWorkers.d.ts +6 -0
- package/dist/geo3dLasWorkers.js +59 -0
- package/dist/geo3dOwnedWorkerPool.d.ts +31 -0
- package/dist/geo3dOwnedWorkerPool.js +209 -0
- package/dist/geo3dPointFactories.js +3835 -0
- package/dist/geo3dPointMaterial.d.ts +2 -0
- package/dist/geo3dPointMaterial.js +54 -0
- package/dist/geo3dRange.d.ts +11 -0
- package/dist/geo3dRange.js +151 -0
- package/dist/geo3dRasterFactories.js +32 -0
- package/dist/geo3dRasterWorkers.d.ts +14 -0
- package/dist/geo3dRasterWorkers.js +48 -0
- package/dist/geo3dRuntime.d.ts +144 -0
- package/dist/geo3dRuntime.js +378 -0
- package/dist/geo3dUrl.d.ts +1 -0
- package/dist/geo3dUrl.js +5 -0
- package/dist/ifc-import.worker.js +0 -2
- package/dist/ifc.d.ts +0 -9
- package/dist/ifc.js +0 -1
- package/dist/ifcRuntime.js +4 -9
- package/dist/ifcSettings.d.ts +0 -3
- package/dist/ifcSettings.js +0 -3
- package/dist/model.js +0 -4
- package/dist/occtModel.js +0 -2
- package/licenses/laz-perf-COPYING.txt +202 -0
- package/licenses/laz-perf-PROVENANCE.md +22 -0
- package/licenses/lerc-LICENSE +101 -0
- package/licenses/lerc-NOTICE +23 -0
- package/licenses/lerc-PROVENANCE.md +37 -0
- package/licenses/thatopen-components-MIT.txt +18 -0
- package/package.json +115 -29
package/README.md
CHANGED
|
@@ -1,39 +1,7 @@
|
|
|
1
1
|
# @file-viewer/renderer-3d
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Runtime package version 3.2.0.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Usage and API documentation: https://doc.file-viewer.app/guide/on-demand-renderers
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
import FileViewer from '@file-viewer/vue3'
|
|
9
|
-
import { modelRenderer } from '@file-viewer/renderer-3d'
|
|
10
|
-
|
|
11
|
-
const options = {
|
|
12
|
-
rendererMode: 'replace',
|
|
13
|
-
renderers: modelRenderer,
|
|
14
|
-
model: {
|
|
15
|
-
workerUrl: '/viewer-assets/wasm/model/occt-worker.js',
|
|
16
|
-
runtimeUrl: '/viewer-assets/wasm/model/occt-import-js.js',
|
|
17
|
-
wasmUrl: '/viewer-assets/wasm/model/occt-import-js.wasm',
|
|
18
|
-
workerTimeoutMs: 120_000,
|
|
19
|
-
},
|
|
20
|
-
}
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
也可以把 `modelRenderer` 与 CAD 等 renderer 组合,或直接使用已经聚合它的 `@file-viewer/preset-all`。full 包和 `@file-viewer/vite-plugin` 会准备默认离线资产;只安装 renderer 时,需要自行托管 OCCT Worker、runtime、WASM 和两个许可证文件。
|
|
24
|
-
|
|
25
|
-
默认路径为:
|
|
26
|
-
|
|
27
|
-
- `wasm/model/occt-worker.js`
|
|
28
|
-
- `wasm/model/occt-import-js.js`
|
|
29
|
-
- `wasm/model/occt-import-js.wasm`
|
|
30
|
-
|
|
31
|
-
部署在子路径或独立资产域名时,通过 `options.model.workerUrl`、`runtimeUrl`、`wasmUrl` 传入最终 URL。不要使用运行时 CDN 回退。严格 CSP 需要在 `worker-src`、`script-src` 和 `connect-src` 中允许对应来源;部分浏览器还需要 `script-src 'wasm-unsafe-eval'`。
|
|
32
|
-
|
|
33
|
-
## 能力边界
|
|
34
|
-
|
|
35
|
-
- STEP / STP、IGES / IGS、BREP:在 Worker 中使用 `occt-import-js` / OpenCascade 三角化,保留装配层级、实例、法线和面颜色,再构建 Three.js 场景。
|
|
36
|
-
- 通用模型:支持 WebGL 轨道控制、适配视图、网格、坐标轴、线框和自动旋转。`gltf` / `dae` / `fbx` 的外部贴图或二进制资源继续以原始 `url` 目录为基准加载。
|
|
37
|
-
- 全局统一缩放:renderer 注册标准缩放 provider,因此外层工具栏的放大、缩小、比例重置和适配视图会直接控制相机;滚轮、触控板和捏合缩放也会同步更新全局比例状态。
|
|
38
|
-
- IFC、3DM:当前只做签名识别和明确的接入提示,仍需分别接入 `web-ifc` / That Open 与 `rhino3dm`,不会显示成成功预览。
|
|
39
|
-
- `@file-viewer/core` 不内置 Three.js 或几何内核。需要模型预览时请显式安装本包、相应 preset,或 full 包。
|
|
7
|
+
The package's own license is Apache-2.0. Included third-party notices apply to their respective components.
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createHash } from 'node:crypto'
|
|
3
|
+
import { realpathSync } from 'node:fs'
|
|
4
|
+
import { access, copyFile, mkdir, mkdtemp, readFile, readdir, rm, writeFile } from 'node:fs/promises'
|
|
5
|
+
import { createRequire } from 'node:module'
|
|
6
|
+
import { dirname, join, resolve } from 'node:path'
|
|
7
|
+
import { fileURLToPath } from 'node:url'
|
|
8
|
+
|
|
9
|
+
const require = createRequire(import.meta.url)
|
|
10
|
+
|
|
11
|
+
async function packageDir(name, resolver = require) {
|
|
12
|
+
// Giro3D 2.0.5 exposes subpath modules but has no index.js at its bare
|
|
13
|
+
// package entry. Resolve metadata first; packages with restrictive exports
|
|
14
|
+
// (such as Three.js) can still be located by walking from their real entry.
|
|
15
|
+
let entry
|
|
16
|
+
for (const candidate of [
|
|
17
|
+
`${name}/package.json`,
|
|
18
|
+
name === '@giro3d/giro3d' ? `${name}/core/Instance.js` : name,
|
|
19
|
+
]) {
|
|
20
|
+
try { entry = resolver.resolve(candidate); break } catch { /* Try the documented module entry. */ }
|
|
21
|
+
}
|
|
22
|
+
if (!entry) throw new Error(`Cannot resolve installed ${name} package metadata or module entry`)
|
|
23
|
+
let current = dirname(entry)
|
|
24
|
+
for (;;) {
|
|
25
|
+
try {
|
|
26
|
+
const metadata = JSON.parse(await readFile(join(current, 'package.json'), 'utf8'))
|
|
27
|
+
if (metadata.name === name) return { path: current, metadata }
|
|
28
|
+
} catch { /* Continue walking toward the package root. */ }
|
|
29
|
+
const parent = dirname(current)
|
|
30
|
+
if (parent === current) throw new Error(`Cannot locate ${name} package root`)
|
|
31
|
+
current = parent
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function copyDirectory(source, destination) {
|
|
36
|
+
await mkdir(destination, { recursive: true })
|
|
37
|
+
for (const entry of await readdir(source, { withFileTypes: true })) {
|
|
38
|
+
const from = join(source, entry.name), to = join(destination, entry.name)
|
|
39
|
+
if (entry.isDirectory()) await copyDirectory(from, to)
|
|
40
|
+
else if (entry.isFile()) await copyFile(from, to)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function findNamedFile(root, filename, depth = 0) {
|
|
44
|
+
if (depth > 6) return null
|
|
45
|
+
for (const entry of await readdir(root, { withFileTypes: true })) {
|
|
46
|
+
const full = join(root, entry.name)
|
|
47
|
+
if (entry.isFile() && entry.name === filename) return full
|
|
48
|
+
if (entry.isDirectory() && entry.name !== 'node_modules') {
|
|
49
|
+
const nested = await findNamedFile(full, filename, depth + 1)
|
|
50
|
+
if (nested) return nested
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return null
|
|
54
|
+
}
|
|
55
|
+
async function copyLicenses(packages, destination) {
|
|
56
|
+
await mkdir(destination, { recursive: true })
|
|
57
|
+
for (const pkg of packages) {
|
|
58
|
+
const names = (await readdir(pkg.path)).filter(name => /^licen[cs]e(?:[.-]|$)/i.test(name))
|
|
59
|
+
for (const name of names) await copyFile(join(pkg.path, name), join(destination, `${pkg.metadata.name.replace(/[@/]/g, '_')}-${name}`))
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async function collectFiles(root, prefix = '') {
|
|
63
|
+
const result = {}
|
|
64
|
+
for (const entry of await readdir(root, { withFileTypes: true })) {
|
|
65
|
+
if (entry.name === 'licenses' || entry.name === 'manifest.json') continue
|
|
66
|
+
const full = join(root, entry.name), relative = prefix ? `${prefix}/${entry.name}` : entry.name
|
|
67
|
+
if (entry.isDirectory()) Object.assign(result, await collectFiles(full, relative))
|
|
68
|
+
else if (entry.isFile()) {
|
|
69
|
+
const bytes = await readFile(full)
|
|
70
|
+
result[relative] = { bytes: bytes.length, sha256: createHash('sha256').update(bytes).digest('hex') }
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return result
|
|
74
|
+
}
|
|
75
|
+
export async function copyGeo3dAssets(destination) {
|
|
76
|
+
const giro = await packageDir('@giro3d/giro3d')
|
|
77
|
+
if (giro.metadata.version !== '2.0.5') throw new Error(`Geo3D assets require tested @giro3d/giro3d@2.0.5, found ${giro.metadata.version}`)
|
|
78
|
+
const giroRequire = createRequire(join(giro.path, 'package.json'))
|
|
79
|
+
const [lazPerf, three] = await Promise.all([
|
|
80
|
+
packageDir('laz-perf', giroRequire),
|
|
81
|
+
packageDir('three', giroRequire),
|
|
82
|
+
])
|
|
83
|
+
const lazWasm = await findNamedFile(lazPerf.path, 'laz-perf.wasm')
|
|
84
|
+
if (!lazWasm) throw new Error('Cannot locate laz-perf.wasm in the installed laz-perf package')
|
|
85
|
+
const draco = join(three.path, 'examples/jsm/libs/draco/gltf'), basis = join(three.path, 'examples/jsm/libs/basis')
|
|
86
|
+
await Promise.all([access(draco), access(basis)])
|
|
87
|
+
destination = resolve(destination)
|
|
88
|
+
await mkdir(dirname(destination), { recursive: true })
|
|
89
|
+
const stage = await mkdtemp(join(dirname(destination), '.geo3d-assets-'))
|
|
90
|
+
try {
|
|
91
|
+
await mkdir(join(stage, 'laz-perf'), { recursive: true })
|
|
92
|
+
await copyFile(lazWasm, join(stage, 'laz-perf', 'laz-perf.wasm'))
|
|
93
|
+
await copyDirectory(draco, join(stage, 'three', 'draco'))
|
|
94
|
+
await copyDirectory(basis, join(stage, 'three', 'basis'))
|
|
95
|
+
const workerDir = fileURLToPath(new URL('../dist/geo3d-workers/', import.meta.url))
|
|
96
|
+
const workerManifest = JSON.parse(await readFile(join(workerDir, 'manifest.json'), 'utf8'))
|
|
97
|
+
const workerBytes = await readFile(join(workerDir, 'las-worker.js'))
|
|
98
|
+
if (workerManifest.engine !== giro.metadata.version ||
|
|
99
|
+
createHash('sha256').update(workerBytes).digest('hex') !== workerManifest.workerSha256) {
|
|
100
|
+
throw new Error('Geo3D point Worker assets do not match the built package.')
|
|
101
|
+
}
|
|
102
|
+
for (const name of ['geotiff-worker.js', 'texture-worker.js']) {
|
|
103
|
+
const bytes = await readFile(join(workerDir, name))
|
|
104
|
+
if (createHash('sha256').update(bytes).digest('hex') !== workerManifest.raster?.files?.[name]) {
|
|
105
|
+
throw new Error(`Geo3D raster Worker asset does not match the built package: ${name}`)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
await copyDirectory(workerDir, join(stage, 'workers'))
|
|
109
|
+
await copyLicenses([giro, lazPerf, three], join(stage, 'licenses'))
|
|
110
|
+
const notice = [
|
|
111
|
+
'Optional Geo3D runtime assets for File Viewer.',
|
|
112
|
+
'These assets are loaded only by @file-viewer/renderer-3d/geo3d.',
|
|
113
|
+
`@giro3d/giro3d@${giro.metadata.version}: ${giro.metadata.license || 'See package license'}`,
|
|
114
|
+
`laz-perf@${lazPerf.metadata.version}: ${lazPerf.metadata.license || 'See package license'}`,
|
|
115
|
+
`three@${three.metadata.version}: ${three.metadata.license || 'See package license'}`,
|
|
116
|
+
'laz-perf.wasm is served locally for COPC and LAZ decoding.',
|
|
117
|
+
'workers/las-worker.js, geotiff-worker.js and texture-worker.js are source-owned.',
|
|
118
|
+
'Preserve workers/licenses/, workers/raster-licenses/ and workers/manifest.json.',
|
|
119
|
+
'Three.js DRACO and KTX2/Basis decoder assets are served locally for compressed 3D Tiles content.',
|
|
120
|
+
'Preserve licenses/, NOTICE.txt and manifest.json when redistributing these copied assets.', '',
|
|
121
|
+
].join('\n')
|
|
122
|
+
await writeFile(join(stage, 'NOTICE.txt'), notice)
|
|
123
|
+
const files = await collectFiles(stage)
|
|
124
|
+
await writeFile(join(stage, 'manifest.json'), JSON.stringify({
|
|
125
|
+
schema: 1,
|
|
126
|
+
packages: [giro, lazPerf, three].map(pkg => ({ name: pkg.metadata.name, version: pkg.metadata.version, license: pkg.metadata.license })),
|
|
127
|
+
files,
|
|
128
|
+
}, null, 2) + '\n')
|
|
129
|
+
await copyDirectory(stage, destination)
|
|
130
|
+
return { destination, files }
|
|
131
|
+
} finally { await rm(stage, { recursive: true, force: true }) }
|
|
132
|
+
}
|
|
133
|
+
function isEntryPoint() {
|
|
134
|
+
try { return Boolean(process.argv[1]) && realpathSync(process.argv[1]) === fileURLToPath(import.meta.url) }
|
|
135
|
+
catch { return false }
|
|
136
|
+
}
|
|
137
|
+
if (isEntryPoint()) {
|
|
138
|
+
if (process.argv.includes('--help')) { console.log('Usage: file-viewer-geo3d-assets [destination-directory]'); process.exit(0) }
|
|
139
|
+
if (process.argv.length > 3 || process.argv[2]?.startsWith('-')) { console.error('Expected one destination directory'); process.exit(1) }
|
|
140
|
+
copyGeo3dAssets(process.argv[2] || 'public/file-viewer/vendor/geo3d')
|
|
141
|
+
.then(result => console.log(`Geo3D assets installed: ${result.destination}`))
|
|
142
|
+
.catch(error => { console.error(error instanceof Error ? error.message : String(error)); process.exitCode = 1 })
|
|
143
|
+
}
|
package/bin/copy-ifc-assets.mjs
CHANGED
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
mkdtemp,
|
|
12
12
|
rm,
|
|
13
13
|
readdir,
|
|
14
|
+
lstat,
|
|
15
|
+
rename,
|
|
14
16
|
} from "node:fs/promises";
|
|
15
17
|
import { createHash } from "node:crypto";
|
|
16
18
|
|
|
@@ -31,14 +33,34 @@ async function packageDir(name, resolver = require) {
|
|
|
31
33
|
current = parent;
|
|
32
34
|
}
|
|
33
35
|
}
|
|
36
|
+
async function checkOutputPath(path, directory = false) {
|
|
37
|
+
let info;
|
|
38
|
+
try {
|
|
39
|
+
info = await lstat(path);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
if (error.code === "ENOENT") return;
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
if (
|
|
45
|
+
info.isSymbolicLink() ||
|
|
46
|
+
!(directory ? info.isDirectory() : info.isFile())
|
|
47
|
+
)
|
|
48
|
+
throw new Error(
|
|
49
|
+
`IFC asset destination must be a regular ${directory ? "directory" : "file"}: ${path}`,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
34
52
|
export async function copyIfcAssets(destination) {
|
|
35
|
-
const [webIfc, fragments, three] = await Promise.all(
|
|
36
|
-
["web-ifc", "@thatopen/fragments", "three"].map((name) => packageDir(name)),
|
|
53
|
+
const [webIfc, fragments, components, three] = await Promise.all(
|
|
54
|
+
["web-ifc", "@thatopen/fragments", "@thatopen/components", "three"].map((name) => packageDir(name)),
|
|
37
55
|
);
|
|
38
56
|
const fragmentRequire = createRequire(join(fragments.path, "package.json"));
|
|
57
|
+
const importerWebIfc = await packageDir("web-ifc", fragmentRequire);
|
|
58
|
+
const componentRequire = createRequire(join(components.path, "package.json"));
|
|
59
|
+
const componentFragments = await packageDir("@thatopen/fragments", componentRequire);
|
|
39
60
|
const packages = [
|
|
40
61
|
webIfc,
|
|
41
62
|
fragments,
|
|
63
|
+
components,
|
|
42
64
|
three,
|
|
43
65
|
...(await Promise.all(
|
|
44
66
|
["earcut", "flatbuffers", "lru-cache", "pako"].map((name) =>
|
|
@@ -48,13 +70,18 @@ export async function copyIfcAssets(destination) {
|
|
|
48
70
|
];
|
|
49
71
|
if (
|
|
50
72
|
webIfc.metadata.version !== "0.0.77" ||
|
|
51
|
-
fragments.metadata.version !== "3.4.
|
|
73
|
+
fragments.metadata.version !== "3.4.8" ||
|
|
74
|
+
components.metadata.version !== "3.4.9" ||
|
|
75
|
+
realpathSync(importerWebIfc.path) !== realpathSync(webIfc.path) ||
|
|
76
|
+
realpathSync(componentFragments.path) !== realpathSync(fragments.path)
|
|
52
77
|
)
|
|
53
78
|
throw new Error(
|
|
54
|
-
"IFC assets must
|
|
79
|
+
"IFC assets and importer must share the tested web-ifc@0.0.77, @thatopen/fragments@3.4.8 and @thatopen/components@3.4.9 engines",
|
|
55
80
|
);
|
|
56
81
|
const { build } = await import("esbuild");
|
|
57
82
|
destination = resolve(destination);
|
|
83
|
+
await checkOutputPath(destination, true);
|
|
84
|
+
await checkOutputPath(join(destination, "licenses"), true);
|
|
58
85
|
await mkdir(dirname(destination), { recursive: true });
|
|
59
86
|
const stage = await mkdtemp(join(dirname(destination), ".ifc-assets-"));
|
|
60
87
|
try {
|
|
@@ -71,7 +98,7 @@ export async function copyIfcAssets(destination) {
|
|
|
71
98
|
join(stage, "fragments.worker.mjs"),
|
|
72
99
|
);
|
|
73
100
|
await build({
|
|
74
|
-
entryPoints: [join(packageRoot, "
|
|
101
|
+
entryPoints: [join(packageRoot, "dist/ifc-import.worker.js")],
|
|
75
102
|
outfile: join(stage, "ifc-import.worker.js"),
|
|
76
103
|
bundle: true,
|
|
77
104
|
format: "esm",
|
|
@@ -87,6 +114,10 @@ export async function copyIfcAssets(destination) {
|
|
|
87
114
|
join(packageRoot, "licenses/thatopen-fragments-MIT.txt"),
|
|
88
115
|
join(licenses, "thatopen-fragments-MIT.txt"),
|
|
89
116
|
);
|
|
117
|
+
await copyFile(
|
|
118
|
+
join(packageRoot, "licenses/thatopen-components-MIT.txt"),
|
|
119
|
+
join(licenses, "thatopen-components-MIT.txt"),
|
|
120
|
+
);
|
|
90
121
|
for (const pkg of packages) {
|
|
91
122
|
const names = (await readdir(pkg.path)).filter((name) =>
|
|
92
123
|
/^licen[cs]e(?:[.-]|$)/i.test(name),
|
|
@@ -101,8 +132,9 @@ export async function copyIfcAssets(destination) {
|
|
|
101
132
|
"Optional IFC runtime assets for File Viewer.",
|
|
102
133
|
"These assets are not loaded by the ordinary model/Office entry.",
|
|
103
134
|
"web-ifc is MPL-2.0. Its WASM and bundled import code are unmodified upstream implementations.",
|
|
104
|
-
"Corresponding source and build instructions: https://github.com/ThatOpen/engine_web-ifc (release 0.0.77).",
|
|
105
|
-
"Fragments is MIT: https://github.com/ThatOpen/engine_fragment (release 3.4.
|
|
135
|
+
"Corresponding source and build instructions: https://github.com/ThatOpen/engine_web-ifc/tree/f26c4beef0a668ebdb180d2b95a94097a1e21cef (release 0.0.77).",
|
|
136
|
+
"Fragments is MIT: https://github.com/ThatOpen/engine_fragment/tree/2ba7e9ddbc02689b8c1044e31daed26f3005f3c5 (release 3.4.8).",
|
|
137
|
+
"Components is MIT: https://github.com/ThatOpen/engine_components/tree/8479a7c5c6a3c0cf8c7ceab1d1fb329a3f7d1922 (release 3.4.9).",
|
|
106
138
|
"Preserve licenses/, the linked worker legal notices and this notice when redistributing.",
|
|
107
139
|
...packages.map(
|
|
108
140
|
(pkg) =>
|
|
@@ -136,17 +168,21 @@ export async function copyIfcAssets(destination) {
|
|
|
136
168
|
2,
|
|
137
169
|
) + "\n",
|
|
138
170
|
);
|
|
139
|
-
//
|
|
171
|
+
// Check every owned path before changing any existing asset. Host files stay intact.
|
|
172
|
+
const assetNames = (await readdir(stage)).filter((name) => name !== "licenses");
|
|
173
|
+
const licenseNames = await readdir(licenses);
|
|
174
|
+
for (const name of assetNames)
|
|
175
|
+
await checkOutputPath(join(destination, name));
|
|
176
|
+
for (const name of licenseNames)
|
|
177
|
+
await checkOutputPath(join(destination, "licenses", name));
|
|
140
178
|
await mkdir(join(destination, "licenses"), { recursive: true });
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
} else await copyFile(join(stage, name), join(destination, name));
|
|
149
|
-
}
|
|
179
|
+
await checkOutputPath(destination, true);
|
|
180
|
+
await checkOutputPath(join(destination, "licenses"), true);
|
|
181
|
+
// Rename complete staged files so a final file link is replaced rather than followed.
|
|
182
|
+
for (const name of assetNames)
|
|
183
|
+
await rename(join(stage, name), join(destination, name));
|
|
184
|
+
for (const name of licenseNames)
|
|
185
|
+
await rename(join(licenses, name), join(destination, "licenses", name));
|
|
150
186
|
return { destination, files };
|
|
151
187
|
} finally {
|
|
152
188
|
await rm(stage, { recursive: true, force: true });
|