diff --git a/package.json b/package.json index bed9cff..6290236 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "scripts": { "tsc": "tsc", "prepcopy": "copyfiles -u 1 -V \"./src/**/*.glsl\" \"./dist/tsc/\"", - "dbg": "yarn prepcopy && tsc && webpack && webpack serve", - "prod": "yarn prepcopy && tsc && webpack --env production && webpack serve --env production", + "dbg": "webpack && webpack serve", + "prod": "webpack --env production && webpack serve --env production", "lint": "eslint ./src/we_utils/src/cthree/ --ext js,ts,jsx,tsx --fix" }, "repository": { @@ -49,7 +49,6 @@ "eslint-plugin-react": "^7.27.1", "file-loader": "^6.2.0", "fork-ts-checker-webpack-plugin": "^6.2.5", - "ink-docstrap": "^1.3.2", "null-loader": "^4.0.1", "prettier": "^2.5.0", "react": "^18.2.0", diff --git a/src/we_utils b/src/we_utils index 998c924..32df21e 160000 --- a/src/we_utils +++ b/src/we_utils @@ -1 +1 @@ -Subproject commit 998c92456fe981be932d225d80b21fa2ff5b5d23 +Subproject commit 32df21efc601ba6f9ecc4152d8c5d2a5d14da1ba diff --git a/tsconfig.json b/tsconfig.json index ed29514..4c9c802 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,11 +6,12 @@ "we_utils/*": ["src/we_utils/*"], "three.ts/*": ["src/we_utils/src/three.ts/*"] }, + "noEmit": true, "target": "ES2021", "module": "ES2020", "moduleResolution": "Node", "esModuleInterop": true, - "sourceMap": false, + "sourceMap": true, "removeComments": true, "baseUrl": ".", "noImplicitAny": false, @@ -21,6 +22,6 @@ }, "types": ["*.d.ts"], "include": ["./src/**/*.ts"], - "exclude": ["**/*.asc"], + "exclude": ["**/*.asc", "node_modules", "src/**/*.spec.ts", "src/we_utils/docs"], } diff --git a/webpack.config.js b/webpack.config.js index cb40be5..64094c4 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,10 +1,16 @@ -/* eslint-disable no-undef */ -/* eslint-disable @typescript-eslint/no-var-requires */ /** - * Webpack build config for AudiOrbits. + * @author hexxone / https://hexx.one * + * @license + * Copyright (c) 2022 hexxone All rights reserved. + * Licensed under the GNU GENERAL PUBLIC LICENSE. + * See LICENSE file in the project root for full license information. + * + * Webpack build config for AudiOrbits. * Probably not a good example to start from :D */ +/* eslint-disable no-undef */ +/* eslint-disable @typescript-eslint/no-var-requires */ const path = require("path"); @@ -17,7 +23,7 @@ const BundleAnalyzerPlugin = // custom plugins const OfflinePlugin = require("./src/we_utils/src/offline/OfflinePlugin"); const WascBuilderPlugin = require("./src/we_utils/src/wasc-worker/WascBuilderPlugin"); -const RenamerPlugin = require("./src/we_utils/src/renamer/RenamerPlugin"); +// const RenamerPlugin = require("./src/we_utils/src/renamer/RenamerPlugin"); module.exports = (env) => { const prod = env.production || false; @@ -25,18 +31,26 @@ module.exports = (env) => { return { mode: stringMode, - entry: "./dist/tsc/AudiOrbi.js", + entry: { + ao: { + import: "./src/AudiOrbi.ts", + }, + }, // compile target // target: ["web", "es6", "es2020"], output: { chunkFormat: "module", path: path.resolve(__dirname, "dist", stringMode), - publicPath: "/", - library: "ao", - libraryTarget: "commonjs", - filename: "ao.js", + publicPath: "dist/" + stringMode, + library: { + name: "ao", + type: "var", // window + }, + // libraryTarget: "commonjs", + // filename: "ao.js", + filename: "[name].js", + chunkFilename: "[name].js", globalObject: "this", - chunkFilename: (_pathData) => "ao.[id].js", }, // remove dead code optimization: { @@ -47,11 +61,11 @@ module.exports = (env) => { // https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions terserOptions: { // ecma: 2020, - parse: {}, - compress: { - unsafe: prod, - hoist_funs: prod, - }, + // parse: {}, + // compress: { + // unsafe: prod, + // hoist_funs: prod, + // }, format: { comments: false, }, @@ -62,15 +76,16 @@ module.exports = (env) => { regex: /_(private|internal)_/, // the same prefixes like for custom transformer }, }, - module: false, + module: true, toplevel: true, sourceMap: false, - keep_fnames: !prod, + // keep_fnames: !prod, + keep_classnames: !prod, }, extractComments: false, }), ], - chunkIds: "deterministic", + chunkIds: "size", concatenateModules: true, moduleIds: "size", mangleExports: "size", @@ -82,7 +97,40 @@ module.exports = (env) => { devtool: false, module: { rules: [ - // JS loader + // loader for workers... + // { + // test: /\.worker\.js$/i, + // loader: "src/we_utils/src/worker-loader-fork/src/index.js", + // options: { + // esModule: true, + // filename: "asdasd.foo.js", + // chunkFilename: "sdf.custom.js", + // }, + // }, + // loader for Typescript + { + test: /\.tsx?$/, + loader: "ts-loader", + exclude: /node_modules/, + options: { + compiler: "typescript", // ttypescript + transpileOnly: true, + // getCustomTransformers: (program) => { + // return { + // before: prod + // ? [ + // propertiesRenameTransformer(program, { + // entrySourceFiles: ["main.ts"], + // reserved: ["a", "b", "c", "d", "w", "x", "y", "z", "min", "max"], + // // noImplicitAny: true, + // }), + // ] + // : [], + // }; + // }, + }, + }, + // Process any JS outside of the app with Babel. { test: /\.jsx?$/, // If you are using TypeScript: /\.tsx?$/ include: path.resolve(__dirname, "src"), @@ -107,15 +155,23 @@ module.exports = (env) => { }, ], }, + resolveLoader: { + alias: { + "worker-loader": path.resolve( + __dirname, + "./src/we_utils/src/worker-loader-fork/dist" + ), + }, + }, resolve: { extensions: [".tsx", ".ts", ".js", ".glsl"], // plugins: [new TsconfigPathsPlugin({ configFile: "./tsconfig.json" })], alias: { - "we_utils/src": path.resolve(__dirname, "./dist/tsc/we_utils/src"), + "we_utils/src": path.resolve(__dirname, "./src/we_utils/src"), "three.ts/src": path.resolve( __dirname, - "./dist/tsc/we_utils/src/three.ts/src" + "./src/we_utils/src/three.ts/src" ), // reverse mapping shaders (dont get copied by tsc) // "fragment/*.glsl": path.resolve(__dirname, "./src/we_utils/src/three/shader/fragment"), @@ -144,7 +200,7 @@ module.exports = (env) => { // will create a list of all app-files. // this list is used to cache the app offline in browser. new OfflinePlugin({ - staticdir: "dist/tsc", + staticdir: __dirname + "\\public", outfile: "offlinefiles.json", extrafiles: ["/"], pretty: !prod, diff --git a/yarn.lock b/yarn.lock index 8fb03c3..48d21e2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1611,13 +1611,6 @@ domelementtype@^2.0.1, domelementtype@^2.2.0: resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.3.0.tgz#5c45e8e869952626331d7aab326d01daf65d589d" integrity sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw== -domhandler@^3.0.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-3.3.0.tgz#6db7ea46e4617eb15cf875df68b2b8524ce0037a" - integrity sha512-J1C5rIANUbuYK+FuFL98650rihynUOEzRLxW+90bKZRWB6A1X1Tf82GxR1qAWLyfNPRvjqfip3Q5tdYlmAa9lA== - dependencies: - domelementtype "^2.0.1" - domhandler@^4.2.0, domhandler@^4.2.2: version "4.3.1" resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-4.3.1.tgz#8d792033416f59d68bc03a5aa7b018c1ca89279c" @@ -1625,7 +1618,7 @@ domhandler@^4.2.0, domhandler@^4.2.2: dependencies: domelementtype "^2.2.0" -domutils@^2.0.0, domutils@^2.8.0: +domutils@^2.8.0: version "2.8.0" resolved "https://registry.yarnpkg.com/domutils/-/domutils-2.8.0.tgz#4437def5db6e2d1f5d6ee859bd95ca7d02048135" integrity sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A== @@ -1944,9 +1937,9 @@ eslint-visitor-keys@^3.3.0: integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== eslint@^8.3.0: - version "8.26.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.26.0.tgz#2bcc8836e6c424c4ac26a5674a70d44d84f2181d" - integrity sha512-kzJkpaw1Bfwheq4VXUezFriD1GxszX6dUekM7Z3aC2o4hju+tsR/XyTC3RcoSD7jmy9VkPU3+N6YjVU2e96Oyg== + version "8.27.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.27.0.tgz#d547e2f7239994ad1faa4bb5d84e5d809db7cf64" + integrity sha512-0y1bfG2ho7mty+SiILVf9PfuRA49ek4Nc60Wmmu62QlobNR+CeXa4xXIJgcuwSQgZiWaPH+5BDsctpIW0PR/wQ== dependencies: "@eslint/eslintrc" "^1.3.3" "@humanwhocodes/config-array" "^0.11.6" @@ -1989,9 +1982,9 @@ eslint@^8.3.0: text-table "^0.2.0" espree@^9.4.0: - version "9.4.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.4.0.tgz#cd4bc3d6e9336c433265fc0aa016fc1aaf182f8a" - integrity sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw== + version "9.4.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.4.1.tgz#51d6092615567a2c2cff7833445e37c28c0065bd" + integrity sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg== dependencies: acorn "^8.8.0" acorn-jsx "^5.3.2" @@ -2515,16 +2508,6 @@ html-escaper@^2.0.0: resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== -htmlparser2@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-4.1.0.tgz#9a4ef161f2e4625ebf7dfbe6c0a2f52d18a59e78" - integrity sha512-4zDq1a1zhE4gQso/c5LP1OtrhYTncXNSpvJYtWJBtXAETPlMfi3IFNjGuQbYLuVY4ZR0QMqRVvo4Pdy9KLyP8Q== - dependencies: - domelementtype "^2.0.1" - domhandler "^3.0.0" - domutils "^2.0.0" - entities "^2.0.0" - htmlparser2@^7.1.2: version "7.2.0" resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-7.2.0.tgz#8817cdea38bbc324392a90b1990908e81a65f5a5" @@ -2642,14 +2625,6 @@ inherits@2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw== -ink-docstrap@^1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/ink-docstrap/-/ink-docstrap-1.3.2.tgz#5923dc48c41c9bccb3a524d10f5924d343448900" - integrity sha512-STx5orGQU1gfrkoI/fMU7lX6CSP7LBGO10gXNgOZhwKhUqbtNjCkYSewJtNnLmWP1tAGN6oyEpG1HFPw5vpa5Q== - dependencies: - moment "^2.14.1" - sanitize-html "^1.13.0" - internal-slot@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.3.tgz#7347e307deeea2faac2ac6205d4bc7d34967f59c" @@ -3067,7 +3042,7 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4: +lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -3200,11 +3175,6 @@ mkdirp@^1.0.4: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== -moment@^2.14.1: - version "2.29.4" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" - integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== - mrmime@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/mrmime/-/mrmime-1.0.1.tgz#5f90c825fad4bdd41dc914eff5d1a8cfdaf24f27" @@ -3324,13 +3294,13 @@ object.assign@^4.1.2, object.assign@^4.1.3, object.assign@^4.1.4: object-keys "^1.1.1" object.entries@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.5.tgz#e1acdd17c4de2cd96d5a08487cfb9db84d881861" - integrity sha512-TyxmjUoZggd4OrrU1W66FMDG6CuqJxsFvymeyXI51+vQLN67zYfZseptRge703kKQdo4uccgAKebXFcRCzk4+g== + version "1.1.6" + resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.6.tgz#9737d0e5b8291edd340a3e3264bb8a3b00d5fa23" + integrity sha512-leTPzo4Zvg3pmbQ3rDK69Rl8GQvIqMWubrkxONG9/ojtFE2rD9fjMKfSI5BxW3osRH1m6VdzmqK8oAY9aT4x5w== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.1" + define-properties "^1.1.4" + es-abstract "^1.20.4" object.fromentries@^2.0.5: version "2.0.5" @@ -3473,11 +3443,6 @@ parse-json@^5.0.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" -parse-srcset@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/parse-srcset/-/parse-srcset-1.0.2.tgz#f2bd221f6cc970a938d88556abc589caaaa2bde1" - integrity sha512-/2qh0lav6CmI15FzA3i/2Bzk2zCgQhGMkvhOhKNcBVQ1ldgpbfiNTVslmooUmWJcADi1f1kIeynbDRVzNlfR6Q== - parseurl@~1.3.2, parseurl@~1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" @@ -3513,11 +3478,6 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== -picocolors@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-0.2.1.tgz#570670f793646851d1ba135996962abad587859f" - integrity sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA== - picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" @@ -3535,14 +3495,6 @@ pkg-dir@^4.1.0, pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" -postcss@^7.0.27: - version "7.0.39" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.39.tgz#9624375d965630e2e1f2c02a935c82a59cb48309" - integrity sha512-yioayjNbHn6z1/Bywyb2Y4s3yvDAeXGOyxqD+LnVOinq6Mdmd++SW2wUNVzavyyHxd6+DxzWGIuosg6P1Rj8uA== - dependencies: - picocolors "^0.2.1" - source-map "^0.6.1" - prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -3986,16 +3938,6 @@ safe-regex-test@^1.0.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sanitize-html@^1.13.0: - version "1.27.5" - resolved "https://registry.yarnpkg.com/sanitize-html/-/sanitize-html-1.27.5.tgz#6c8149462adb23e360e1bb71cc0bae7f08c823c7" - integrity sha512-M4M5iXDAUEcZKLXkmk90zSYWEtk5NH3JmojQxKxV371fnMh+x9t1rqdmXaGoyEHw3z/X/8vnFhKjGL5xFGOJ3A== - dependencies: - htmlparser2 "^4.1.0" - lodash "^4.17.15" - parse-srcset "^1.0.2" - postcss "^7.0.27" - schema-utils@2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.7.0.tgz#17151f76d8eae67fbbf77960c33c676ad9f4efc7" @@ -4185,7 +4127,7 @@ source-map-support@^0.5.20, source-map-support@~0.5.20: buffer-from "^1.0.0" source-map "^0.6.0" -source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: +source-map@^0.6.0, source-map@~0.6.0, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==