fix jszip for production
This commit is contained in:
parent
e12f498afa
commit
9674b50be0
10 changed files with 64 additions and 21 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -5,6 +5,7 @@ app.json
|
||||||
build
|
build
|
||||||
data
|
data
|
||||||
dist
|
dist
|
||||||
|
jszip-esm.js
|
||||||
logs
|
logs
|
||||||
mod
|
mod
|
||||||
node_modules
|
node_modules
|
||||||
|
|
|
||||||
2
app.js
2
app.js
|
|
@ -341,7 +341,7 @@ const redirList = [
|
||||||
|
|
||||||
function handleVersion(req, res, next) {
|
function handleVersion(req, res, next) {
|
||||||
let vstr = oversion || dversion || version;
|
let vstr = oversion || dversion || version;
|
||||||
if (!req.app.ispre && !redirList.indexOf(req.app.path) >= 0 && req.url.indexOf(vstr) < 0) {
|
if (!req.app.ispre && redirList.indexOf(req.app.path) === 0 && req.url.indexOf(vstr) < 0) {
|
||||||
if (req.url.indexOf("?") > 0) {
|
if (req.url.indexOf("?") > 0) {
|
||||||
return http.redirect(res, `${req.url},ver:${vstr}`);
|
return http.redirect(res, `${req.url},ver:${vstr}`);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
7
bin/webpack-jszip-bundle.js
Normal file
7
bin/webpack-jszip-bundle.js
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
import * as JSZip from "../node_modules/jszip/dist/jszip.js";
|
||||||
|
|
||||||
|
export default JSZip;
|
||||||
|
|
||||||
|
export {
|
||||||
|
JSZip
|
||||||
|
};
|
||||||
38
bin/webpack-jszip-esm.js
Normal file
38
bin/webpack-jszip-esm.js
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
mode: 'production',
|
||||||
|
entry: path.resolve(__dirname, './webpack-jszip-bundle.js'),
|
||||||
|
output: {
|
||||||
|
path: path.resolve(__dirname, '../src/ext'),
|
||||||
|
filename: 'jszip-esm.js',
|
||||||
|
library: {
|
||||||
|
type: 'module'
|
||||||
|
},
|
||||||
|
module: true
|
||||||
|
},
|
||||||
|
experiments: {
|
||||||
|
outputModule: true
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.mjs', '.js'],
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.m?js$/,
|
||||||
|
resolve: {
|
||||||
|
fullySpecified: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
optimization: {
|
||||||
|
minimize: false
|
||||||
|
},
|
||||||
|
performance: {
|
||||||
|
hints: false,
|
||||||
|
maxAssetSize: 2 * 1024 * 1024,
|
||||||
|
maxEntrypointSize: 2 * 1024 * 1024,
|
||||||
|
},
|
||||||
|
};
|
||||||
16
package.json
16
package.json
|
|
@ -49,9 +49,11 @@
|
||||||
"earcut": "^3.0.1",
|
"earcut": "^3.0.1",
|
||||||
"express-useragent": "^1.0.13",
|
"express-useragent": "^1.0.13",
|
||||||
"fast-glob": "^3.3.3",
|
"fast-glob": "^3.3.3",
|
||||||
|
"i": "^0.3.7",
|
||||||
"jszip": "^3.7.1",
|
"jszip": "^3.7.1",
|
||||||
"manifold-3d": "^3.1.1",
|
"manifold-3d": "^3.1.1",
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.4",
|
||||||
|
"npm": "^11.4.2",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"react-responsive-carousel": "^3.2.23",
|
"react-responsive-carousel": "^3.2.23",
|
||||||
"serve-static": "^1.14.1",
|
"serve-static": "^1.14.1",
|
||||||
|
|
@ -79,7 +81,7 @@
|
||||||
"webpack-cli": "^5.1.4"
|
"webpack-cli": "^5.1.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm i && npm run clean && npm run dev -- --dryrun && npm run webpack3",
|
"setup": "npm i && npm run clean && npm run dev -- --dryrun && npm run webpack-ext",
|
||||||
"build": "npm run prebuild && electron-builder",
|
"build": "npm run prebuild && electron-builder",
|
||||||
"build-nopublish": "npm run prebuild && electron-builder --publish never",
|
"build-nopublish": "npm run prebuild && electron-builder --publish never",
|
||||||
"build-debug": "npm run prebuild && DEBUG=electron-builder electron-builder",
|
"build-debug": "npm run prebuild && DEBUG=electron-builder electron-builder",
|
||||||
|
|
@ -94,8 +96,8 @@
|
||||||
"docs-build": "docusaurus build --config conf/docusaurus.config.js",
|
"docs-build": "docusaurus build --config conf/docusaurus.config.js",
|
||||||
"docs-serve": "docusaurus serve --config conf/docusaurus.config.js",
|
"docs-serve": "docusaurus serve --config conf/docusaurus.config.js",
|
||||||
"docs-check": "prettier --config ./conf/prettier.config.js ./docs --check",
|
"docs-check": "prettier --config ./conf/prettier.config.js ./docs --check",
|
||||||
"dev": "npm run webpack3 && gs-app-server --debug --single",
|
"dev": "npm run webpack-ext && gs-app-server --debug --single",
|
||||||
"prod": "npm run webpack prod && gs-app-server",
|
"prod": "npm run webpack-ext && npm run webpack-src prod && gs-app-server",
|
||||||
"prod-dryrun": "gs-app-server --dryrun",
|
"prod-dryrun": "gs-app-server --dryrun",
|
||||||
"start": "npm run prebuild prod && electron .",
|
"start": "npm run prebuild prod && electron .",
|
||||||
"start-dev": "npm run prebuild prod && electron . --devel",
|
"start-dev": "npm run prebuild prod && electron . --devel",
|
||||||
|
|
@ -103,11 +105,13 @@
|
||||||
"start-ddb": "npm run prebuild && electron . --devel --debugg",
|
"start-ddb": "npm run prebuild && electron . --devel --debugg",
|
||||||
"mk-links": "find src web -type l | xargs -I{} sh -c 'echo \"{},$(readlink {})\"' > conf/links.csv",
|
"mk-links": "find src web -type l | xargs -I{} sh -c 'echo \"{},$(readlink {})\"' > conf/links.csv",
|
||||||
"mac-verify": "spctl --assess -vv --type install dist/*/*.app",
|
"mac-verify": "spctl --assess -vv --type install dist/*/*.app",
|
||||||
"prebuild": "npm run setup && npm run webpack prod && node bin/electron-pre.js",
|
"prebuild": "npm run setup && npm run webpack-src prod && node bin/electron-pre.js",
|
||||||
"postbuild": "node bin/electron-post.js",
|
"postbuild": "node bin/electron-post.js",
|
||||||
"preinstall": "node bin/install-pre.js",
|
"preinstall": "node bin/install-pre.js",
|
||||||
"webpack": "npm run webpack3 && node bin/esbuild.config.mjs",
|
"webpack-ext": "npm run webpack-three && npm run webpack-zip",
|
||||||
"webpack3": "npx webpack --config bin/webpack-three-esm.js"
|
"webpack-src": "node bin/esbuild.config.mjs",
|
||||||
|
"webpack-three": "npx webpack --config bin/webpack-three-esm.js",
|
||||||
|
"webpack-zip": "npx webpack --config bin/webpack-three-esm.js"
|
||||||
},
|
},
|
||||||
"main": "app-el.js",
|
"main": "app-el.js",
|
||||||
"build": {
|
"build": {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
|
||||||
|
|
||||||
//import original library
|
|
||||||
import * as JSZip from "./jszip.js";
|
|
||||||
|
|
||||||
//export object attached to the window object
|
|
||||||
export default JSZip;
|
|
||||||
|
|
@ -1872,7 +1872,7 @@ function init_lang() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function run() {
|
export function run() {
|
||||||
init_lang();
|
|
||||||
client.start();
|
client.start();
|
||||||
|
init_lang();
|
||||||
return api;
|
return api;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import { space } from '../../moto/space.js';
|
||||||
import { local } from '../../data/local.js';
|
import { local } from '../../data/local.js';
|
||||||
import { utils } from './utils.js';
|
import { utils } from './utils.js';
|
||||||
import { version } from '../../moto/license.js';
|
import { version } from '../../moto/license.js';
|
||||||
import JSZip from '../../ext/jszip.esm.js';
|
import { JSZip } from '../../ext/jszip-esm.js';
|
||||||
|
|
||||||
const { areEqual, ls2o, js2o } = utils;
|
const { areEqual, ls2o, js2o } = utils;
|
||||||
const { COLOR } = consts;
|
const { COLOR } = consts;
|
||||||
|
|
@ -660,7 +660,7 @@ function settingsImportUrl(url, ask) {
|
||||||
|
|
||||||
function settingsImportZip(data, ask) {
|
function settingsImportZip(data, ask) {
|
||||||
let alert = api.show.alert("Importing Workspace");
|
let alert = api.show.alert("Importing Workspace");
|
||||||
JSZip.loadAsync(data).then(zip => {
|
new JSZip().loadAsync(data).then(zip => {
|
||||||
for (let [key,value] of Object.entries(zip.files)) {
|
for (let [key,value] of Object.entries(zip.files)) {
|
||||||
if (key === "workspace.json") {
|
if (key === "workspace.json") {
|
||||||
value.async("string").then(json => {
|
value.async("string").then(json => {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
import '../../add/array.js';
|
import '../../add/array.js';
|
||||||
import '../../add/class.js';
|
import '../../add/class.js';
|
||||||
import '../../add/three.js';
|
import '../../add/three.js';
|
||||||
import '../../ext/jszip.js';
|
|
||||||
|
|
||||||
import { base } from '../../geo/base.js';
|
import { base } from '../../geo/base.js';
|
||||||
import { codec } from '../core/codec.js';
|
import { codec } from '../core/codec.js';
|
||||||
|
|
@ -17,6 +16,7 @@ import { wasm_ctrl } from '../../geo/wasm.js';
|
||||||
import { version } from '../../moto/license.js';
|
import { version } from '../../moto/license.js';
|
||||||
import { Widget, newWidget } from '../core/widget.js';
|
import { Widget, newWidget } from '../core/widget.js';
|
||||||
import { load } from "../../load/png.js";
|
import { load } from "../../load/png.js";
|
||||||
|
import { JSZip } from '../../ext/jszip-esm.js';
|
||||||
|
|
||||||
import { CAM } from '../mode/cam/driver-be.js';
|
import { CAM } from '../mode/cam/driver-be.js';
|
||||||
import { DRAG } from '../mode/drag/driver.js';
|
import { DRAG } from '../mode/drag/driver.js';
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { THREE } from '../ext/three.js';
|
import { THREE } from '../ext/three.js';
|
||||||
import JSZip from '../ext/jszip.esm.js';
|
import { JSZip } from '../ext/jszip-esm.js';
|
||||||
|
|
||||||
let { BufferAttribute, Matrix4 } = THREE;
|
let { BufferAttribute, Matrix4 } = THREE;
|
||||||
|
|
||||||
|
|
@ -218,7 +218,7 @@ function extractItems(records) {
|
||||||
*/
|
*/
|
||||||
export function parseAsync(data) {
|
export function parseAsync(data) {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
let zip = await JSZip.loadAsync(data);
|
let zip = await new JSZip().loadAsync(data);
|
||||||
let models = {};
|
let models = {};
|
||||||
for (let [key, value] of Object.entries(zip.files)) {
|
for (let [key, value] of Object.entries(zip.files)) {
|
||||||
if (key.endsWith(".model")) {
|
if (key.endsWith(".model")) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue