create-ifc-lite 1.14.2 → 1.14.4
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/templates/babylonjs.js +19 -0
- package/dist/templates/threejs.js +19 -0
- package/dist/utils/config-fixers.js +21 -12
- package/package.json +3 -3
|
@@ -20,6 +20,7 @@ export function createBabylonjsTemplate(targetDir, projectName) {
|
|
|
20
20
|
dev: 'vite',
|
|
21
21
|
build: 'tsc && vite build',
|
|
22
22
|
preview: 'vite preview',
|
|
23
|
+
postinstall: 'node ./scripts/fix-ifc-lite-geometry-worker.mjs',
|
|
23
24
|
},
|
|
24
25
|
dependencies: {
|
|
25
26
|
'@ifc-lite/geometry': geometryVersion,
|
|
@@ -94,6 +95,24 @@ export default defineConfig({
|
|
|
94
95
|
`);
|
|
95
96
|
// src/
|
|
96
97
|
mkdirSync(join(targetDir, 'src'));
|
|
98
|
+
mkdirSync(join(targetDir, 'scripts'));
|
|
99
|
+
// scripts/fix-ifc-lite-geometry-worker.mjs
|
|
100
|
+
writeFileSync(join(targetDir, 'scripts', 'fix-ifc-lite-geometry-worker.mjs'), `import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
101
|
+
import path from 'node:path';
|
|
102
|
+
|
|
103
|
+
const entryPath = path.join(process.cwd(), 'node_modules', '@ifc-lite', 'geometry', 'dist', 'index.js');
|
|
104
|
+
|
|
105
|
+
if (!existsSync(entryPath)) {
|
|
106
|
+
process.exit(0);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const source = readFileSync(entryPath, 'utf8');
|
|
110
|
+
const patched = source.replace(/geometry\\.worker\\.ts/g, 'geometry.worker.js');
|
|
111
|
+
|
|
112
|
+
if (patched !== source) {
|
|
113
|
+
writeFileSync(entryPath, patched);
|
|
114
|
+
}
|
|
115
|
+
`);
|
|
97
116
|
// src/ifc-to-babylon.ts
|
|
98
117
|
writeFileSync(join(targetDir, 'src', 'ifc-to-babylon.ts'), `import {
|
|
99
118
|
Mesh, VertexData, StandardMaterial, Color3,
|
|
@@ -20,6 +20,7 @@ export function createThreejsTemplate(targetDir, projectName) {
|
|
|
20
20
|
dev: 'vite',
|
|
21
21
|
build: 'tsc && vite build',
|
|
22
22
|
preview: 'vite preview',
|
|
23
|
+
postinstall: 'node ./scripts/fix-ifc-lite-geometry-worker.mjs',
|
|
23
24
|
},
|
|
24
25
|
dependencies: {
|
|
25
26
|
'@ifc-lite/geometry': geometryVersion,
|
|
@@ -95,6 +96,24 @@ export default defineConfig({
|
|
|
95
96
|
`);
|
|
96
97
|
// src/
|
|
97
98
|
mkdirSync(join(targetDir, 'src'));
|
|
99
|
+
mkdirSync(join(targetDir, 'scripts'));
|
|
100
|
+
// scripts/fix-ifc-lite-geometry-worker.mjs
|
|
101
|
+
writeFileSync(join(targetDir, 'scripts', 'fix-ifc-lite-geometry-worker.mjs'), `import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
102
|
+
import path from 'node:path';
|
|
103
|
+
|
|
104
|
+
const entryPath = path.join(process.cwd(), 'node_modules', '@ifc-lite', 'geometry', 'dist', 'index.js');
|
|
105
|
+
|
|
106
|
+
if (!existsSync(entryPath)) {
|
|
107
|
+
process.exit(0);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const source = readFileSync(entryPath, 'utf8');
|
|
111
|
+
const patched = source.replace(/geometry\\.worker\\.ts/g, 'geometry.worker.js');
|
|
112
|
+
|
|
113
|
+
if (patched !== source) {
|
|
114
|
+
writeFileSync(entryPath, patched);
|
|
115
|
+
}
|
|
116
|
+
`);
|
|
98
117
|
// src/ifc-to-threejs.ts
|
|
99
118
|
writeFileSync(join(targetDir, 'src', 'ifc-to-threejs.ts'), `import * as THREE from 'three';
|
|
100
119
|
import type { MeshData } from '@ifc-lite/geometry';
|
|
@@ -106,6 +106,8 @@ export function fixViteConfig(targetDir) {
|
|
|
106
106
|
// Write standalone vite config with WASM support
|
|
107
107
|
const viteConfig = `import { defineConfig } from 'vite';
|
|
108
108
|
import react from '@vitejs/plugin-react';
|
|
109
|
+
import wasm from 'vite-plugin-wasm';
|
|
110
|
+
import topLevelAwait from 'vite-plugin-top-level-await';
|
|
109
111
|
import path from 'path';
|
|
110
112
|
import { readFileSync } from 'fs';
|
|
111
113
|
|
|
@@ -114,22 +116,14 @@ const pkg = JSON.parse(readFileSync('./package.json', 'utf-8'));
|
|
|
114
116
|
export default defineConfig({
|
|
115
117
|
plugins: [
|
|
116
118
|
react(),
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
configureServer(server) {
|
|
120
|
-
server.middlewares.use((req, res, next) => {
|
|
121
|
-
if (req.url?.endsWith('.wasm')) {
|
|
122
|
-
res.setHeader('Content-Type', 'application/wasm');
|
|
123
|
-
}
|
|
124
|
-
next();
|
|
125
|
-
});
|
|
126
|
-
},
|
|
127
|
-
},
|
|
119
|
+
wasm(),
|
|
120
|
+
topLevelAwait(),
|
|
128
121
|
],
|
|
129
122
|
define: {
|
|
130
123
|
__APP_VERSION__: JSON.stringify(pkg.version),
|
|
131
124
|
__BUILD_DATE__: JSON.stringify(new Date().toISOString()),
|
|
132
125
|
__RELEASE_HISTORY__: JSON.stringify([]),
|
|
126
|
+
__PACKAGE_VERSIONS__: JSON.stringify([]),
|
|
133
127
|
},
|
|
134
128
|
resolve: {
|
|
135
129
|
alias: {
|
|
@@ -139,6 +133,10 @@ export default defineConfig({
|
|
|
139
133
|
server: {
|
|
140
134
|
port: 3000,
|
|
141
135
|
open: true,
|
|
136
|
+
headers: {
|
|
137
|
+
'Cross-Origin-Opener-Policy': 'same-origin',
|
|
138
|
+
'Cross-Origin-Embedder-Policy': 'credentialless',
|
|
139
|
+
},
|
|
142
140
|
fs: {
|
|
143
141
|
allow: ['..'],
|
|
144
142
|
},
|
|
@@ -147,7 +145,18 @@ export default defineConfig({
|
|
|
147
145
|
target: 'esnext',
|
|
148
146
|
},
|
|
149
147
|
optimizeDeps: {
|
|
150
|
-
exclude: [
|
|
148
|
+
exclude: [
|
|
149
|
+
'@duckdb/duckdb-wasm',
|
|
150
|
+
'@ifc-lite/wasm',
|
|
151
|
+
'parquet-wasm',
|
|
152
|
+
'quickjs-emscripten',
|
|
153
|
+
'@jitl/quickjs-wasmfile-release-asyncify',
|
|
154
|
+
'esbuild-wasm',
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
worker: {
|
|
158
|
+
format: 'es',
|
|
159
|
+
plugins: () => [wasm(), topLevelAwait()],
|
|
151
160
|
},
|
|
152
161
|
assetsInclude: ['**/*.wasm'],
|
|
153
162
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-ifc-lite",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.4",
|
|
4
4
|
"description": "Create IFC-Lite projects with one command",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"node": ">=18.0.0"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
-
"build": "tsc",
|
|
36
|
-
"dev": "tsc --watch"
|
|
35
|
+
"build": "pnpm exec tsc",
|
|
36
|
+
"dev": "pnpm exec tsc --watch"
|
|
37
37
|
}
|
|
38
38
|
}
|