mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-13 21:32:18 +00:00
hybridized nx clean package + spark package
This commit is contained in:
1 parent
1a734c55ac
commit
9b901c93ca
3 files changed
+193
-27
No files matched your search
Vendored
+50
-4
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"name": "@frontend/spark",
|
||||
"version": "0.0.1",
|
||||
"name": "@sparkjsdev/spark",
|
||||
"version": "0.1.10",
|
||||
"private": true,
|
||||
"description": "An advanced 3D Gaussian Splatting renderer for THREE.js",
|
||||
"homepage": "https://sparkjs.dev/",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
@@ -15,7 +17,51 @@
|
||||
"default": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"assets:clean": "node scripts/clean-assets.js",
|
||||
"assets:compress": "node scripts/compress-to-spz.js",
|
||||
"assets:download": "node scripts/download-assets.js",
|
||||
"build": "npm run build:production && npm run build:dev",
|
||||
"build:dev": "vite build --mode dev",
|
||||
"build:production": "vite build --mode production",
|
||||
"build:wasm": "node rust/build_wasm.js",
|
||||
"build:watch": "onchange 'src/**/*.{ts,glsl}' -- npm run build:dev",
|
||||
"clean": "rm -rf dist/ && rm -rf node_modules/ && rm -rf rust/target/ && rm -rf rust/spark-internal-rs/pkg/ && npm run assets:clean",
|
||||
"dev": "npm run build:dev && (vite --host & npm run build:watch)",
|
||||
"docs": "node scripts/clean-site-files.js && node scripts/copy-site-files.js && mkdocs serve",
|
||||
"format": "biome format .",
|
||||
"format:fix": "biome format . --fix",
|
||||
"lint": "biome check .",
|
||||
"lint:fix": "biome check . --fix",
|
||||
"lint:summary": "biome check --reporter=summary",
|
||||
"prepare": "",
|
||||
"site:build": "npm run build && npm run site:clean && node scripts/copy-site-files.js && mkdocs build && node scripts/rename-assets-to-static.js",
|
||||
"site:clean": "node scripts/clean-site-files.js && node scripts/clean-site.js",
|
||||
"site:deploy": "npm run site:build && node scripts/deploy-site.js",
|
||||
"site:serve": "node scripts/serve-site.js site",
|
||||
"start": "npm run dev",
|
||||
"test": "node --no-warnings --loader ts-node/esm --test test/**/*.test.ts"
|
||||
},
|
||||
"repository": "sparkjs-dev/spark",
|
||||
"files": ["dist"],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "1.9.4",
|
||||
"@types/three": "0.178.0",
|
||||
"lefthook": "1.11.12",
|
||||
"lil-gui": "^0.20.0",
|
||||
"onchange": "7.1.0",
|
||||
"stats.js": "^0.17.0",
|
||||
"three": "^0.178.0",
|
||||
"ts-node": "10.9.2",
|
||||
"typescript": "^5.7.3",
|
||||
"vite": "^6.0.11",
|
||||
"vite-plugin-dts": "^4.5.4",
|
||||
"vite-plugin-glsl": "^1.3.1",
|
||||
"spark-internal-rs": "file:rust/spark-internal-rs/pkg"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
}
|
||||
"fflate": "^0.8.2"
|
||||
},
|
||||
"keywords": ["3d", "three.js", "gsplats", "3dgs", "gaussian", "splats"]
|
||||
}
|
||||
Vendored
+24
-2
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.lib.json"
|
||||
@@ -9,5 +8,28 @@
|
||||
{
|
||||
"path": "./tsconfig.spec.json"
|
||||
}
|
||||
]
|
||||
],
|
||||
"compilerOptions": {
|
||||
"target": "es2020",
|
||||
"module": "es2020",
|
||||
"lib": ["ES2020", "DOM"],
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"moduleResolution": "bundler",
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"sourceMap": true,
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
"types": ["vite/client", "vite-plugin-glsl/ext"]
|
||||
},
|
||||
"ts-node": {
|
||||
"experimentalSpecifierResolution": "node",
|
||||
"transpileOnly": true,
|
||||
"esm": true
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist", "examples"]
|
||||
}
|
||||
Vendored
+119
-21
@@ -1,23 +1,121 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { defineConfig } from "vite";
|
||||
import dts from "vite-plugin-dts";
|
||||
import glsl from "vite-plugin-glsl";
|
||||
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig(() => ({
|
||||
root: __dirname,
|
||||
cacheDir: '../../node_modules/.vite/vendor/spark',
|
||||
plugins: [],
|
||||
// Uncomment this if you are using workers.
|
||||
// worker: {
|
||||
// plugins: [ nxViteTsPaths() ],
|
||||
// },
|
||||
test: {
|
||||
'watch': false,
|
||||
'globals': true,
|
||||
'environment': "node",
|
||||
'include': ["src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
||||
'reporters': ["default"],
|
||||
'coverage': {
|
||||
'reportsDirectory': './test-output/vitest/coverage',
|
||||
'provider': 'v8' as const,
|
||||
const assetsDirectory = "examples/assets";
|
||||
const localAssetsDirectoryExist = fs.existsSync(assetsDirectory);
|
||||
if (!localAssetsDirectoryExist) {
|
||||
console.log(
|
||||
"************************************************************************",
|
||||
);
|
||||
console.log(" Examples assets will be fetched from an external server.");
|
||||
console.log(
|
||||
" To work offline you can download them: npm run assets:download",
|
||||
);
|
||||
console.log(
|
||||
"************************************************************************",
|
||||
);
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
const isMinify = mode === "production";
|
||||
const isFirstPass = mode === "production";
|
||||
|
||||
return {
|
||||
root: __dirname,
|
||||
cacheDir: '../../node_modules/.vite/vendor/spark',
|
||||
appType: "mpa",
|
||||
|
||||
plugins: [
|
||||
glsl({
|
||||
include: ["**/*.glsl"],
|
||||
}),
|
||||
|
||||
dts({ outDir: "dist/types" }),
|
||||
{
|
||||
name: "serve-node-modules-alias",
|
||||
configureServer(server) {
|
||||
const baseUrlPath = "/examples/js/vendor/";
|
||||
|
||||
server.middlewares.use((req, res, next) => {
|
||||
if (!req.url.startsWith(baseUrlPath)) return next();
|
||||
|
||||
const relModulePath = req.url.slice(baseUrlPath.length); // safe substring
|
||||
const absPath = path.resolve("node_modules", relModulePath);
|
||||
|
||||
if (fs.existsSync(absPath) && fs.statSync(absPath).isFile()) {
|
||||
const ext = path.extname(absPath);
|
||||
const contentType =
|
||||
{
|
||||
".js": "application/javascript",
|
||||
".mjs": "application/javascript",
|
||||
".css": "text/css",
|
||||
".json": "application/json",
|
||||
}[ext] || "application/octet-stream";
|
||||
|
||||
res.setHeader("Content-Type", contentType);
|
||||
fs.createReadStream(absPath).pipe(res);
|
||||
} else {
|
||||
res.statusCode = 404;
|
||||
res.end(`Not found: ${relModulePath}`);
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`📦 Dev alias active: ${baseUrlPath} → node_modules/*`);
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
build: {
|
||||
minify: isMinify,
|
||||
lib: {
|
||||
entry: path.resolve(__dirname, "src/index.ts"),
|
||||
name: "spark",
|
||||
formats: ["es", "cjs"],
|
||||
fileName: (format) => {
|
||||
const base = format === "es" ? "spark.module" : `spark.${format}`;
|
||||
return isMinify ? `${base}.min.js` : `${base}.js`;
|
||||
},
|
||||
},
|
||||
sourcemap: true,
|
||||
rollupOptions: {
|
||||
external: ["three"],
|
||||
output: {
|
||||
globals: {
|
||||
three: "THREE",
|
||||
},
|
||||
},
|
||||
},
|
||||
emptyOutDir: isFirstPass,
|
||||
},
|
||||
|
||||
worker: {
|
||||
rollupOptions: {
|
||||
treeshake: "smallest",
|
||||
},
|
||||
plugins: () => [
|
||||
glsl({
|
||||
include: ["**/*.glsl"],
|
||||
}),
|
||||
],
|
||||
},
|
||||
|
||||
server: {
|
||||
watch: {
|
||||
usePolling: true,
|
||||
},
|
||||
port: 8080,
|
||||
},
|
||||
|
||||
optimizeDeps: {
|
||||
force: true,
|
||||
exclude: ["three"], // prevent Vite pre-bundling
|
||||
},
|
||||
|
||||
define: {
|
||||
sparkLocalAssets: localAssetsDirectoryExist,
|
||||
},
|
||||
};
|
||||
});
|
||||
Reference in new issue
Block a user