From c617eff018530b9b22d36d54bc10acc43c5dcb73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Gra=C3=A7a?= <117302909+jorge-graca-sky@users.noreply.github.com> Date: Wed, 18 Jan 2023 15:33:01 +0000 Subject: [PATCH 01/20] fix: order same zIndex elements by updateTreeOrder Definitely not an ideal solution, but it is better than having an wrongly ordered zIndex elements --- src/tree/core/ElementCore.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tree/core/ElementCore.mjs b/src/tree/core/ElementCore.mjs index 05568d49..d32ddf57 100644 --- a/src/tree/core/ElementCore.mjs +++ b/src/tree/core/ElementCore.mjs @@ -2031,6 +2031,7 @@ export default class ElementCore { a.splice(ptr); } } else { + a.sort(ElementCore.sortZIndexedChildren); // Needed because items with same _zIndex may not be ordered by _updateTreeOrder // Merge-sort arrays; ptr = 0; let i = 0; From 606c7f965fa6945ebcbdfc3326f2a38302cb1ba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Gra=C3=A7a?= <117302909+jorge-graca-sky@users.noreply.github.com> Date: Thu, 9 Feb 2023 10:45:50 +0000 Subject: [PATCH 02/20] Update ElementCore.mjs --- src/tree/core/ElementCore.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tree/core/ElementCore.mjs b/src/tree/core/ElementCore.mjs index d32ddf57..ce48635f 100644 --- a/src/tree/core/ElementCore.mjs +++ b/src/tree/core/ElementCore.mjs @@ -2031,7 +2031,7 @@ export default class ElementCore { a.splice(ptr); } } else { - a.sort(ElementCore.sortZIndexedChildren); // Needed because items with same _zIndex may not be ordered by _updateTreeOrder + a.sort(ElementCore.sortSameZIndexedChildren); // Needed because items with same _zIndex may not be ordered by _updateTreeOrder // Merge-sort arrays; ptr = 0; let i = 0; @@ -2274,6 +2274,9 @@ ElementCoreContext.IDENTITY = new ElementCoreContext(); ElementCore.sortZIndexedChildren = function (a, b) { return (a._zIndex === b._zIndex ? a._updateTreeOrder - b._updateTreeOrder : a._zIndex - b._zIndex); }; +ElementCore.sortSameZIndexedChildren = function (a, b) { + return (a._zIndex === b._zIndex ? a._updateTreeOrder - b._updateTreeOrder : 0); +}; import ElementTexturizer from "./ElementTexturizer.mjs"; import Utils from "../Utils.mjs"; From 5ebbc4abb6b333846924ecf6fb771d6217551cb3 Mon Sep 17 00:00:00 2001 From: Grzegorz Zachar Date: Sat, 11 Mar 2023 21:48:28 +0100 Subject: [PATCH 03/20] Fixed recursion loop when accessing texture source in txLoaded callback. --- src/tree/Element.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tree/Element.mjs b/src/tree/Element.mjs index 360c2751..f6a75fa5 100644 --- a/src/tree/Element.mjs +++ b/src/tree/Element.mjs @@ -624,6 +624,7 @@ export default class Element { if (sourceChanged) { if (this.__displayedTexture) { + this.stage.removeUpdateSourceTexture(this.__displayedTexture) this.emit('txLoaded', this.__displayedTexture); } else { this.emit('txUnloaded', this.__displayedTexture); From e52364ab423c066851d0003863c94e8c7340f966 Mon Sep 17 00:00:00 2001 From: Frank Weindel Date: Tue, 7 Feb 2023 14:20:56 -0500 Subject: [PATCH 04/20] Enable TypeScript source files / Export all module files individually from `dist` - Both TypeScript and JavaScript may now be used to develop Lightning - `index.js` and `src/textures/TextTextureRendererUtils.mjs` were converted - Copy/Compile all source module files to the `dist` directory - JavaScript source files + Manual TypeScript definition files are copied over - TypeScript source files are compiled with `tsc` into the `dist` - The module files in `dist` are exported via package.json instead of fully bundled file - This fixes #490 to allow users to selectively import / tree shake the Lightning --- banner.vite-plugin.ts | 2 +- fixTsImportsFromJs.vite-plugin.ts | 28 + index.d.ts | 20 - index.js => index.ts | 0 package-lock.json | 924 +----------------- package.json | 23 +- scripts/copy-extra-tsd-files.sh | 16 - scripts/src-to-dist.sh | 33 + ...Utils.mjs => TextTextureRendererUtils.mts} | 106 +- tsconfig.build.json | 14 + tsconfig.json | 31 +- vite.config.js | 6 +- 12 files changed, 186 insertions(+), 1017 deletions(-) create mode 100644 fixTsImportsFromJs.vite-plugin.ts delete mode 100644 index.d.ts rename index.js => index.ts (100%) delete mode 100755 scripts/copy-extra-tsd-files.sh create mode 100755 scripts/src-to-dist.sh rename src/textures/{TextTextureRendererUtils.mjs => TextTextureRendererUtils.mts} (61%) create mode 100644 tsconfig.build.json diff --git a/banner.vite-plugin.ts b/banner.vite-plugin.ts index 73e9d6ac..7143377b 100644 --- a/banner.vite-plugin.ts +++ b/banner.vite-plugin.ts @@ -12,7 +12,7 @@ export function banner(bannerText: string): Plugin { generateBundle(options, bundle) { // Add banner to the beginning of each chunk Object.keys(bundle).forEach((key) => { - const file = bundle[key]; + const file = bundle[key]!; if (file.type === 'chunk') { file.code = bannerText + '\n' + file.code; } diff --git a/fixTsImportsFromJs.vite-plugin.ts b/fixTsImportsFromJs.vite-plugin.ts new file mode 100644 index 00000000..b9fdf119 --- /dev/null +++ b/fixTsImportsFromJs.vite-plugin.ts @@ -0,0 +1,28 @@ +import type { Plugin } from 'vite'; + +/** + * This Vite plugin ensures that TypeScript modules imported from JavaScript + * modules are resolved correctly. + */ +export function fixTsImportsFromJs(): Plugin { + return { + name: 'fix-ts-imports-from-js', + async resolveId(source, importer = '', options) { + let resolution = await this.resolve(source, importer, { + skipSelf: true, + ...options + }); + // If there was no resolution and the importer file is JavaScript and the source + // ends in `.js` lets see if we can resolve a `.ts` file + if (!resolution && (importer.endsWith('.js') || importer.endsWith('.mjs')) && + (source.endsWith('.js') || source.endsWith('.mjs'))) { + const newSource = source.replace(/\.mjs$/, '.mts').replace(/\.js$/, '.ts'); + resolution = await this.resolve(newSource, importer, { + skipSelf: true, + ...options + }); + } + return resolution; + }, + }; +} diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 677b7ab4..00000000 --- a/index.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * If not stated otherwise in this file or this component's LICENSE file the - * following copyright and licenses apply: - * - * Copyright 2022 Metrological - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import lng from './src/lightning.mjs'; -export default lng; diff --git a/index.js b/index.ts similarity index 100% rename from index.js rename to index.ts diff --git a/package-lock.json b/package-lock.json index dedecd0e..dfe5e0c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,8 +24,8 @@ "terser": "^5.16.8", "tsd": "^0.21.0", "typedoc": "^0.23.10", + "typescript": "^4.9.5", "vite": "^4.0.4", - "vite-plugin-dts": "^2.0.2", "vitest": "^0.27.2" } }, @@ -1773,108 +1773,6 @@ "@jridgewell/sourcemap-codec": "1.4.14" } }, - "node_modules/@microsoft/api-extractor": { - "version": "7.34.4", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.34.4.tgz", - "integrity": "sha512-HOdcci2nT40ejhwPC3Xja9G+WSJmWhCUKKryRfQYsmE9cD+pxmBaKBKCbuS9jUcl6bLLb4Gz+h7xEN5r0QiXnQ==", - "dev": true, - "dependencies": { - "@microsoft/api-extractor-model": "7.26.4", - "@microsoft/tsdoc": "0.14.2", - "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.55.2", - "@rushstack/rig-package": "0.3.18", - "@rushstack/ts-command-line": "4.13.2", - "colors": "~1.2.1", - "lodash": "~4.17.15", - "resolve": "~1.22.1", - "semver": "~7.3.0", - "source-map": "~0.6.1", - "typescript": "~4.8.4" - }, - "bin": { - "api-extractor": "bin/api-extractor" - } - }, - "node_modules/@microsoft/api-extractor-model": { - "version": "7.26.4", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.26.4.tgz", - "integrity": "sha512-PDCgCzXDo+SLY5bsfl4bS7hxaeEtnXj7XtuzEE+BtALp7B5mK/NrS2kHWU69pohgsRmEALycQdaQPXoyT2i5MQ==", - "dev": true, - "dependencies": { - "@microsoft/tsdoc": "0.14.2", - "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.55.2" - } - }, - "node_modules/@microsoft/api-extractor/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@microsoft/api-extractor/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/@microsoft/api-extractor/node_modules/typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/@microsoft/tsdoc": { - "version": "0.14.2", - "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz", - "integrity": "sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug==", - "dev": true - }, - "node_modules/@microsoft/tsdoc-config": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.16.2.tgz", - "integrity": "sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw==", - "dev": true, - "dependencies": { - "@microsoft/tsdoc": "0.14.2", - "ajv": "~6.12.6", - "jju": "~1.4.0", - "resolve": "~1.19.0" - } - }, - "node_modules/@microsoft/tsdoc-config/node_modules/resolve": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", - "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", - "dev": true, - "dependencies": { - "is-core-module": "^2.1.0", - "path-parse": "^1.0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -1964,110 +1862,6 @@ "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", "dev": true }, - "node_modules/@rushstack/node-core-library": { - "version": "3.55.2", - "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.55.2.tgz", - "integrity": "sha512-SaLe/x/Q/uBVdNFK5V1xXvsVps0y7h1sN7aSJllQyFbugyOaxhNRF25bwEDnicARNEjJw0pk0lYnJQ9Kr6ev0A==", - "dev": true, - "dependencies": { - "colors": "~1.2.1", - "fs-extra": "~7.0.1", - "import-lazy": "~4.0.0", - "jju": "~1.4.0", - "resolve": "~1.22.1", - "semver": "~7.3.0", - "z-schema": "~5.0.2" - }, - "peerDependencies": { - "@types/node": "*" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - } - } - }, - "node_modules/@rushstack/node-core-library/node_modules/fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/@rushstack/node-core-library/node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "dev": true, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/@rushstack/node-core-library/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@rushstack/node-core-library/node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/@rushstack/rig-package": { - "version": "0.3.18", - "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.3.18.tgz", - "integrity": "sha512-SGEwNTwNq9bI3pkdd01yCaH+gAsHqs0uxfGvtw9b0LJXH52qooWXnrFTRRLG1aL9pf+M2CARdrA9HLHJys3jiQ==", - "dev": true, - "dependencies": { - "resolve": "~1.22.1", - "strip-json-comments": "~3.1.1" - } - }, - "node_modules/@rushstack/rig-package/node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@rushstack/ts-command-line": { - "version": "4.13.2", - "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.13.2.tgz", - "integrity": "sha512-bCU8qoL9HyWiciltfzg7GqdfODUeda/JpI0602kbN5YH22rzTxyqYvv7aRLENCM7XCQ1VRs7nMkEqgJUOU8Sag==", - "dev": true, - "dependencies": { - "@types/argparse": "1.0.38", - "argparse": "~1.0.9", - "colors": "~1.2.1", - "string-argv": "~0.3.1" - } - }, "node_modules/@sinonjs/commons": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", @@ -2104,51 +1898,6 @@ "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==", "dev": true }, - "node_modules/@ts-morph/common": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.18.1.tgz", - "integrity": "sha512-RVE+zSRICWRsfrkAw5qCAK+4ZH9kwEFv5h0+/YeHTLieWP7F4wWq4JsKFuNWG+fYh/KF+8rAtgdj5zb2mm+DVA==", - "dev": true, - "dependencies": { - "fast-glob": "^3.2.12", - "minimatch": "^5.1.0", - "mkdirp": "^1.0.4", - "path-browserify": "^1.0.1" - } - }, - "node_modules/@ts-morph/common/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@ts-morph/common/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@ts-morph/common/node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "dev": true, - "bin": { - "mkdirp": "bin/cmd.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@tsd/typescript": { "version": "4.7.4", "resolved": "https://registry.npmjs.org/@tsd/typescript/-/typescript-4.7.4.tgz", @@ -2159,12 +1908,6 @@ "tsserver": "typescript/bin/tsserver" } }, - "node_modules/@types/argparse": { - "version": "1.0.38", - "resolved": "https://registry.npmjs.org/@types/argparse/-/argparse-1.0.38.tgz", - "integrity": "sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==", - "dev": true - }, "node_modules/@types/chai": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", @@ -2261,22 +2004,6 @@ "node": ">=0.4.0" } }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, "node_modules/ansi-colors": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", @@ -2600,12 +2327,6 @@ "node": ">=6" } }, - "node_modules/code-block-writer": { - "version": "11.0.3", - "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-11.0.3.tgz", - "integrity": "sha512-NiujjUFB4SwScJq2bwbYUtXbZhBSlY6vYzm++3Q6oC+U+injTqfPYFK8wS9COOmb2lueqp0ZRB4nK1VYeHgNyw==", - "dev": true - }, "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -2627,15 +2348,6 @@ "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==", "dev": true }, - "node_modules/colors": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.2.5.tgz", - "integrity": "sha512-erNRLao/Y3Fv54qUa0LBB+//Uf3YwMUmdJinN20yMXm9zdKKqH9wt7R9IIVZ+K7ShzfpLV/Zg8+VyrBJYB4lpg==", - "dev": true, - "engines": { - "node": ">=0.1.90" - } - }, "node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -3331,12 +3043,6 @@ "node": ">=0.10.0" } }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, "node_modules/fast-glob": { "version": "3.2.12", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", @@ -3353,12 +3059,6 @@ "node": ">=8.6.0" } }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, "node_modules/fastq": { "version": "1.13.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", @@ -3404,20 +3104,6 @@ "flat": "cli.js" } }, - "node_modules/fs-extra": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -3540,12 +3226,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "node_modules/growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", @@ -3630,15 +3310,6 @@ "node": ">= 4" } }, - "node_modules/import-lazy": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-4.0.0.tgz", - "integrity": "sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/indent-string": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", @@ -3860,12 +3531,6 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, - "node_modules/jju": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", - "integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==", - "dev": true - }, "node_modules/js-cleanup": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/js-cleanup/-/js-cleanup-1.2.0.tgz", @@ -3917,12 +3582,6 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, "node_modules/json5": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", @@ -3944,18 +3603,6 @@ "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", "dev": true }, - "node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, "node_modules/just-extend": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", @@ -3971,12 +3618,6 @@ "node": ">=0.10.0" } }, - "node_modules/kolorist": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/kolorist/-/kolorist-1.7.0.tgz", - "integrity": "sha512-ymToLHqL02udwVdbkowNpzjFd6UzozMtshPQKVi5k1EjKRqKqBrOnE9QbLEb0/pV76SAiIT13hdL8R6suc+f3g==", - "dev": true - }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -4020,18 +3661,6 @@ "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", "dev": true }, - "node_modules/lodash.get": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", - "dev": true - }, - "node_modules/lodash.isequal": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", - "dev": true - }, "node_modules/log-symbols": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", @@ -4541,12 +4170,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/path-browserify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", - "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", - "dev": true - }, "node_modules/path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -4687,15 +4310,6 @@ "node": "^10 || ^12 || >=14" } }, - "node_modules/punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -5223,15 +4837,6 @@ "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", "dev": true }, - "node_modules/string-argv": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz", - "integrity": "sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==", - "dev": true, - "engines": { - "node": ">=0.6.19" - } - }, "node_modules/string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -5479,16 +5084,6 @@ "node": ">=8" } }, - "node_modules/ts-morph": { - "version": "17.0.1", - "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-17.0.1.tgz", - "integrity": "sha512-10PkHyXmrtsTvZSL+cqtJLTgFXkU43Gd0JCc0Rw6GchWbqKe0Rwgt1v3ouobTZwQzF1mGhDeAlWYBMGRV7y+3g==", - "dev": true, - "dependencies": { - "@ts-morph/common": "~0.18.0", - "code-block-writer": "^11.0.3" - } - }, "node_modules/tsd": { "version": "0.21.0", "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.21.0.tgz", @@ -5588,11 +5183,10 @@ } }, "node_modules/typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", "dev": true, - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -5659,24 +5253,6 @@ "node": ">=4" } }, - "node_modules/universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "dev": true, - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "dependencies": { - "punycode": "^2.1.0" - } - }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", @@ -5687,15 +5263,6 @@ "spdx-expression-parse": "^3.0.0" } }, - "node_modules/validator": { - "version": "13.9.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.9.0.tgz", - "integrity": "sha512-B+dGG8U3fdtM0/aNK4/X8CXq/EcxU2WPrPEkJGslb47qyHsxmbggTWK0yEA4qnYVNF+nxNlN88o14hIcPmSIEA==", - "dev": true, - "engines": { - "node": ">= 0.10" - } - }, "node_modules/vite": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/vite/-/vite-4.0.4.tgz", @@ -5779,42 +5346,6 @@ "node": ">=0.10.0" } }, - "node_modules/vite-plugin-dts": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/vite-plugin-dts/-/vite-plugin-dts-2.0.2.tgz", - "integrity": "sha512-i3HBlrdqE2FQxQqrNwFj9P2ei/I7lt/d3Q8NOE1JCz/gNYhNf/oUeIJamIdWQUNQGhUd/Y6mtpm3kOYPw1gz8Q==", - "dev": true, - "dependencies": { - "@babel/parser": "^7.20.15", - "@microsoft/api-extractor": "^7.33.5", - "@rollup/pluginutils": "^5.0.2", - "@rushstack/node-core-library": "^3.53.2", - "debug": "^4.3.4", - "fast-glob": "^3.2.12", - "fs-extra": "^10.1.0", - "kolorist": "^1.6.0", - "magic-string": "^0.29.0", - "ts-morph": "17.0.1" - }, - "engines": { - "node": "^14.18.0 || >=16.0.0" - }, - "peerDependencies": { - "vite": ">=2.9.0" - } - }, - "node_modules/vite-plugin-dts/node_modules/magic-string": { - "version": "0.29.0", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.29.0.tgz", - "integrity": "sha512-WcfidHrDjMY+eLjlU+8OvwREqHwpgCeKVBUpQ3OhYYuvfaYCUgcbuBzappNzZvg/v8onU3oQj+BYpkOJe9Iw4Q==", - "dev": true, - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.4.13" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/vitest": { "version": "0.27.2", "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.27.2.tgz", @@ -6106,36 +5637,6 @@ "engines": { "node": ">=6" } - }, - "node_modules/z-schema": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/z-schema/-/z-schema-5.0.5.tgz", - "integrity": "sha512-D7eujBWkLa3p2sIpJA0d1pr7es+a7m0vFAnZLlCEKq/Ij2k0MLi9Br2UPxoxdYystm5K1yeBGzub0FlYUEWj2Q==", - "dev": true, - "dependencies": { - "lodash.get": "^4.4.2", - "lodash.isequal": "^4.5.0", - "validator": "^13.7.0" - }, - "bin": { - "z-schema": "bin/z-schema" - }, - "engines": { - "node": ">=8.0.0" - }, - "optionalDependencies": { - "commander": "^9.4.1" - } - }, - "node_modules/z-schema/node_modules/commander": { - "version": "9.5.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", - "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", - "dev": true, - "optional": true, - "engines": { - "node": "^12.20.0 || >=14" - } } }, "dependencies": { @@ -7412,90 +6913,6 @@ "@jridgewell/sourcemap-codec": "1.4.14" } }, - "@microsoft/api-extractor": { - "version": "7.34.4", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.34.4.tgz", - "integrity": "sha512-HOdcci2nT40ejhwPC3Xja9G+WSJmWhCUKKryRfQYsmE9cD+pxmBaKBKCbuS9jUcl6bLLb4Gz+h7xEN5r0QiXnQ==", - "dev": true, - "requires": { - "@microsoft/api-extractor-model": "7.26.4", - "@microsoft/tsdoc": "0.14.2", - "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.55.2", - "@rushstack/rig-package": "0.3.18", - "@rushstack/ts-command-line": "4.13.2", - "colors": "~1.2.1", - "lodash": "~4.17.15", - "resolve": "~1.22.1", - "semver": "~7.3.0", - "source-map": "~0.6.1", - "typescript": "~4.8.4" - }, - "dependencies": { - "semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", - "dev": true - } - } - }, - "@microsoft/api-extractor-model": { - "version": "7.26.4", - "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.26.4.tgz", - "integrity": "sha512-PDCgCzXDo+SLY5bsfl4bS7hxaeEtnXj7XtuzEE+BtALp7B5mK/NrS2kHWU69pohgsRmEALycQdaQPXoyT2i5MQ==", - "dev": true, - "requires": { - "@microsoft/tsdoc": "0.14.2", - "@microsoft/tsdoc-config": "~0.16.1", - "@rushstack/node-core-library": "3.55.2" - } - }, - "@microsoft/tsdoc": { - "version": "0.14.2", - "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz", - "integrity": "sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug==", - "dev": true - }, - "@microsoft/tsdoc-config": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.16.2.tgz", - "integrity": "sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw==", - "dev": true, - "requires": { - "@microsoft/tsdoc": "0.14.2", - "ajv": "~6.12.6", - "jju": "~1.4.0", - "resolve": "~1.19.0" - }, - "dependencies": { - "resolve": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", - "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", - "dev": true, - "requires": { - "is-core-module": "^2.1.0", - "path-parse": "^1.0.6" - } - } - } - }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -7551,88 +6968,6 @@ } } }, - "@rushstack/node-core-library": { - "version": "3.55.2", - "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.55.2.tgz", - "integrity": "sha512-SaLe/x/Q/uBVdNFK5V1xXvsVps0y7h1sN7aSJllQyFbugyOaxhNRF25bwEDnicARNEjJw0pk0lYnJQ9Kr6ev0A==", - "dev": true, - "requires": { - "colors": "~1.2.1", - "fs-extra": "~7.0.1", - "import-lazy": "~4.0.0", - "jju": "~1.4.0", - "resolve": "~1.22.1", - "semver": "~7.3.0", - "z-schema": "~5.0.2" - }, - "dependencies": { - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true - } - } - }, - "@rushstack/rig-package": { - "version": "0.3.18", - "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.3.18.tgz", - "integrity": "sha512-SGEwNTwNq9bI3pkdd01yCaH+gAsHqs0uxfGvtw9b0LJXH52qooWXnrFTRRLG1aL9pf+M2CARdrA9HLHJys3jiQ==", - "dev": true, - "requires": { - "resolve": "~1.22.1", - "strip-json-comments": "~3.1.1" - }, - "dependencies": { - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true - } - } - }, - "@rushstack/ts-command-line": { - "version": "4.13.2", - "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.13.2.tgz", - "integrity": "sha512-bCU8qoL9HyWiciltfzg7GqdfODUeda/JpI0602kbN5YH22rzTxyqYvv7aRLENCM7XCQ1VRs7nMkEqgJUOU8Sag==", - "dev": true, - "requires": { - "@types/argparse": "1.0.38", - "argparse": "~1.0.9", - "colors": "~1.2.1", - "string-argv": "~0.3.1" - } - }, "@sinonjs/commons": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", @@ -7669,56 +7004,12 @@ "integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==", "dev": true }, - "@ts-morph/common": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.18.1.tgz", - "integrity": "sha512-RVE+zSRICWRsfrkAw5qCAK+4ZH9kwEFv5h0+/YeHTLieWP7F4wWq4JsKFuNWG+fYh/KF+8rAtgdj5zb2mm+DVA==", - "dev": true, - "requires": { - "fast-glob": "^3.2.12", - "minimatch": "^5.1.0", - "mkdirp": "^1.0.4", - "path-browserify": "^1.0.1" - }, - "dependencies": { - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - }, - "minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - }, - "mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "dev": true - } - } - }, "@tsd/typescript": { "version": "4.7.4", "resolved": "https://registry.npmjs.org/@tsd/typescript/-/typescript-4.7.4.tgz", "integrity": "sha512-jbtC+RgKZ9Kk65zuRZbKLTACf+tvFW4Rfq0JEMXrlmV3P3yme+Hm+pnb5fJRyt61SjIitcrC810wj7+1tgsEmg==", "dev": true }, - "@types/argparse": { - "version": "1.0.38", - "resolved": "https://registry.npmjs.org/@types/argparse/-/argparse-1.0.38.tgz", - "integrity": "sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==", - "dev": true - }, "@types/chai": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz", @@ -7804,18 +7095,6 @@ "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", "dev": true }, - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, "ansi-colors": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz", @@ -8078,12 +7357,6 @@ } } }, - "code-block-writer": { - "version": "11.0.3", - "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-11.0.3.tgz", - "integrity": "sha512-NiujjUFB4SwScJq2bwbYUtXbZhBSlY6vYzm++3Q6oC+U+injTqfPYFK8wS9COOmb2lueqp0ZRB4nK1VYeHgNyw==", - "dev": true - }, "color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -8105,12 +7378,6 @@ "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==", "dev": true }, - "colors": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.2.5.tgz", - "integrity": "sha512-erNRLao/Y3Fv54qUa0LBB+//Uf3YwMUmdJinN20yMXm9zdKKqH9wt7R9IIVZ+K7ShzfpLV/Zg8+VyrBJYB4lpg==", - "dev": true - }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -8631,12 +7898,6 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, "fast-glob": { "version": "3.2.12", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", @@ -8650,12 +7911,6 @@ "micromatch": "^4.0.4" } }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, "fastq": { "version": "1.13.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", @@ -8692,17 +7947,6 @@ "is-buffer": "~2.0.3" } }, - "fs-extra": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - } - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -8794,12 +8038,6 @@ "slash": "^3.0.0" } }, - "graceful-fs": { - "version": "4.2.10", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dev": true - }, "growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", @@ -8860,12 +8098,6 @@ "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true }, - "import-lazy": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-4.0.0.tgz", - "integrity": "sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==", - "dev": true - }, "indent-string": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", @@ -9030,12 +8262,6 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, - "jju": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", - "integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==", - "dev": true - }, "js-cleanup": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/js-cleanup/-/js-cleanup-1.2.0.tgz", @@ -9075,12 +8301,6 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, "json5": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", @@ -9096,16 +8316,6 @@ "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", "dev": true }, - "jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6", - "universalify": "^2.0.0" - } - }, "just-extend": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", @@ -9118,12 +8328,6 @@ "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true }, - "kolorist": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/kolorist/-/kolorist-1.7.0.tgz", - "integrity": "sha512-ymToLHqL02udwVdbkowNpzjFd6UzozMtshPQKVi5k1EjKRqKqBrOnE9QbLEb0/pV76SAiIT13hdL8R6suc+f3g==", - "dev": true - }, "lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -9158,18 +8362,6 @@ "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", "dev": true }, - "lodash.get": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", - "dev": true - }, - "lodash.isequal": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", - "dev": true - }, "log-symbols": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", @@ -9579,12 +8771,6 @@ "lines-and-columns": "^1.1.6" } }, - "path-browserify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", - "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", - "dev": true - }, "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -9687,12 +8873,6 @@ "source-map-js": "^1.0.2" } }, - "punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", - "dev": true - }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -10108,12 +9288,6 @@ "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", "dev": true }, - "string-argv": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz", - "integrity": "sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==", - "dev": true - }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -10298,16 +9472,6 @@ "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", "dev": true }, - "ts-morph": { - "version": "17.0.1", - "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-17.0.1.tgz", - "integrity": "sha512-10PkHyXmrtsTvZSL+cqtJLTgFXkU43Gd0JCc0Rw6GchWbqKe0Rwgt1v3ouobTZwQzF1mGhDeAlWYBMGRV7y+3g==", - "dev": true, - "requires": { - "@ts-morph/common": "~0.18.0", - "code-block-writer": "^11.0.3" - } - }, "tsd": { "version": "0.21.0", "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.21.0.tgz", @@ -10381,11 +9545,10 @@ } }, "typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", - "dev": true, - "peer": true + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true }, "ufo": { "version": "1.0.1", @@ -10433,21 +9596,6 @@ "integrity": "sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==", "dev": true }, - "universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "dev": true - }, - "uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, "validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", @@ -10458,12 +9606,6 @@ "spdx-expression-parse": "^3.0.0" } }, - "validator": { - "version": "13.9.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.9.0.tgz", - "integrity": "sha512-B+dGG8U3fdtM0/aNK4/X8CXq/EcxU2WPrPEkJGslb47qyHsxmbggTWK0yEA4qnYVNF+nxNlN88o14hIcPmSIEA==", - "dev": true - }, "vite": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/vite/-/vite-4.0.4.tgz", @@ -10501,35 +9643,6 @@ } } }, - "vite-plugin-dts": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/vite-plugin-dts/-/vite-plugin-dts-2.0.2.tgz", - "integrity": "sha512-i3HBlrdqE2FQxQqrNwFj9P2ei/I7lt/d3Q8NOE1JCz/gNYhNf/oUeIJamIdWQUNQGhUd/Y6mtpm3kOYPw1gz8Q==", - "dev": true, - "requires": { - "@babel/parser": "^7.20.15", - "@microsoft/api-extractor": "^7.33.5", - "@rollup/pluginutils": "^5.0.2", - "@rushstack/node-core-library": "^3.53.2", - "debug": "^4.3.4", - "fast-glob": "^3.2.12", - "fs-extra": "^10.1.0", - "kolorist": "^1.6.0", - "magic-string": "^0.29.0", - "ts-morph": "17.0.1" - }, - "dependencies": { - "magic-string": { - "version": "0.29.0", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.29.0.tgz", - "integrity": "sha512-WcfidHrDjMY+eLjlU+8OvwREqHwpgCeKVBUpQ3OhYYuvfaYCUgcbuBzappNzZvg/v8onU3oQj+BYpkOJe9Iw4Q==", - "dev": true, - "requires": { - "@jridgewell/sourcemap-codec": "^1.4.13" - } - } - } - }, "vitest": { "version": "0.27.2", "resolved": "https://registry.npmjs.org/vitest/-/vitest-0.27.2.tgz", @@ -10752,27 +9865,6 @@ "lodash": "^4.17.15", "yargs": "^13.3.0" } - }, - "z-schema": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/z-schema/-/z-schema-5.0.5.tgz", - "integrity": "sha512-D7eujBWkLa3p2sIpJA0d1pr7es+a7m0vFAnZLlCEKq/Ij2k0MLi9Br2UPxoxdYystm5K1yeBGzub0FlYUEWj2Q==", - "dev": true, - "requires": { - "commander": "^9.4.1", - "lodash.get": "^4.4.2", - "lodash.isequal": "^4.5.0", - "validator": "^13.7.0" - }, - "dependencies": { - "commander": { - "version": "9.5.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", - "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", - "dev": true, - "optional": true - } - } } } } diff --git a/package.json b/package.json index d930debc..64d10261 100644 --- a/package.json +++ b/package.json @@ -5,18 +5,17 @@ "license": "Apache-2.0", "type": "module", "types": "dist/index.d.ts", - "module": "dist/lightning.esm.js", + "module": "dist/index.js", "main": "dist/lightning.js", "exports": { ".": { - "import": { - "types": "./dist/index.d.ts", - "default": "./dist/lightning.esm.js" - }, - "require": { - "types": "./dist/index.d.ts", - "default": "./dist/lightning.js" - } + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "require": "./dist/lightning.js" + }, + "./*.mjs": { + "types": "./dist/src/*.d.mts", + "import": "./dist/src/*.mjs" }, "./package.json": "./package.json" }, @@ -25,11 +24,11 @@ "devtools/**" ], "scripts": { - "build": "mkdir -p dist && rm -fr dist/* && concurrently -c \"auto\" \"npm:build:lightning\" \"npm:build:lightning.min\" \"npm:build:lightning.es5\" \"npm:build:lightning.es5.min\" \"npm:build:lightning-inspect.es5\" && npm run copy-extra-tsd-files", + "build": "mkdir -p dist && rm -fr dist/* && concurrently -c \"auto\" \"npm:build:lightning\" \"npm:build:lightning.min\" \"npm:build:lightning.es5\" \"npm:build:lightning.es5.min\" \"npm:build:lightning-inspect.es5\" && npm run src-to-dist", "release": "npm run build && npm publish --access public", "typedoc": "typedoc --tsconfig tsconfig.typedoc.json", "tsd": "tsd", - "copy-extra-tsd-files": "bash ./scripts/copy-extra-tsd-files.sh", + "src-to-dist": "bash ./scripts/src-to-dist.sh", "build:lightning-inspect.es5": "BUILD_INSPECTOR=true BUILD_ES5=true vite build --mode production", "build:lightning": "vite build --mode production", "build:lightning.min": "BUILD_MINIFY=true vite build --mode production", @@ -60,8 +59,8 @@ "terser": "^5.16.8", "tsd": "^0.21.0", "typedoc": "^0.23.10", + "typescript": "^4.9.5", "vite": "^4.0.4", - "vite-plugin-dts": "^2.0.2", "vitest": "^0.27.2" } } diff --git a/scripts/copy-extra-tsd-files.sh b/scripts/copy-extra-tsd-files.sh deleted file mode 100755 index 7c209270..00000000 --- a/scripts/copy-extra-tsd-files.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -# This script copies the extra manual .d.ts files from the root of the project -# to the dist/ directory. This is necessary because some of the .d.ts files are -# not copied by the `vite-plugin-dts` plugin -# (https://github.com/qmhc/vite-plugin-dts/issues/184) -# All of this may be removed if/when the issue is fixed. - -set -e # Exit with nonzero exit code if anything fails - -# Make sure working directory is the root of the repository -cd "$(dirname "$0")/.." - -# Copy the extra .d.ts files to the dist/ directory -cp -r ./src/types ./dist/src/ -cp ./src/internalTypes.d.mts ./dist/src/ -cp ./src/commonTypes.d.mts ./dist/src/ diff --git a/scripts/src-to-dist.sh b/scripts/src-to-dist.sh new file mode 100755 index 00000000..4dfd8fa5 --- /dev/null +++ b/scripts/src-to-dist.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# This script ensures that the entire project's JavaScript source files are available +# from the `./dist` directory. This is useful for two main reasons: +# 1. Allows users to utilize the TypeScript type definitions for Lightning +# 2. Allows users to import individual ES module files from Lightning, instead of +# using the bundled files generated by vite. This enables users to employ Tree-shaking +# to reduce the size of their bundle. +# +# This script is required because the project's source files are currently a mix +# of JavaScript (+ manually written type definition files) and TypeScript. +# If the project is ever converted entirely to TypeScript, this script will no longer +# be necessary as `tsc` will be able to handle the entire process. + +set -e # Exit with nonzero exit code if anything fails + +# Make sure working directory is the root of the repository +cd "$(dirname "$0")/.." + +# 1. Copy all the JavaScript source code (.js / .mjs) and +# all the manually written type definition files (.d.ts / .d.mts) +echo "Copying all JavaScript source code to ./dist..." +find . \ + -type f \ + \( -name "*.js" -o -name "*.mjs" -o -name "*.d.mts" -o -name "*.d.ts" \) \ + -not -name "*.test.*" \ + -path "./src/*" \ + -exec sh -c 'mkdir -p ./dist/$(dirname {}) && cp {} ./dist/{}' \; + +# 2. Compile all TypeScript source code (.ts / .mts) in the project +echo "Compiling all TypeScript source code to ./dist..." +tsc -P tsconfig.build.json + +echo "Done!" \ No newline at end of file diff --git a/src/textures/TextTextureRendererUtils.mjs b/src/textures/TextTextureRendererUtils.mts similarity index 61% rename from src/textures/TextTextureRendererUtils.mjs rename to src/textures/TextTextureRendererUtils.mts index 87870bea..05d888f3 100644 --- a/src/textures/TextTextureRendererUtils.mjs +++ b/src/textures/TextTextureRendererUtils.mts @@ -1,15 +1,39 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2020 Metrological + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * Returns CSS font setting string for use in canvas context. * - * @private - * @param {string | string[]} fontFace - * @param {string} fontStyle - * @param {number} fontSize - * @param {number} precision - * @param {string} defaultFontFace - * @returns {string} + * @param fontFace + * @param fontStyle + * @param fontSize + * @param precision + * @param defaultFontFace + * @returns */ -export function getFontSetting(fontFace, fontStyle, fontSize, precision, defaultFontFace) { +export function getFontSetting( + fontFace: string | string[], + fontStyle: string, + fontSize: number, + precision: number, + defaultFontFace: string +): string { let ff = fontFace; if (!Array.isArray(ff)) { @@ -37,37 +61,34 @@ export function getFontSetting(fontFace, fontStyle, fontSize, precision, default /** * Returns true if the given character is a zero-width space. * - * @param {string} space - * @returns {boolean} + * @param space */ -export function isZeroWidthSpace(space) { +export function isZeroWidthSpace(space: string): boolean { return space === '' || space === '\u200B'; } /** * Returns true if the given character is a zero-width space or a regular space. * - * @param {string} space - * @returns {boolean} + * @param space */ -export function isSpace(space) { +export function isSpace(space: string): boolean { return isZeroWidthSpace(space) || space === ' '; } /** * Converts a string into an array of tokens and the words between them. * - * @param {RegExp} tokenRegex - * @param {string} text - * @returns {string[]} + * @param tokenRegex + * @param text */ -export function tokenizeString(tokenRegex, text) { +export function tokenizeString(tokenRegex: RegExp, text: string): string[] { const delimeters = text.match(tokenRegex) || []; const words = text.split(tokenRegex) || []; - let final = []; + let final: string[] = []; for (let i = 0; i < words.length; i++) { - final.push(words[i], delimeters[i]) + final.push(words[i]!, delimeters[i]!) } final.pop() return final.filter((word) => word != ''); @@ -76,12 +97,11 @@ export function tokenizeString(tokenRegex, text) { /** * Measure the width of a string accounting for letter spacing. * - * @param {CanvasRenderingContext2D} context - * @param {string} word - * @param {number} space - * @returns + * @param context + * @param word + * @param space */ -export function measureText(context, word, space = 0) { +export function measureText(context: CanvasRenderingContext2D, word: string, space: number = 0): number { if (!space) { return context.measureText(word).width; } @@ -96,33 +116,43 @@ export function measureText(context, word, space = 0) { }, 0); } +export interface WrapTextResult { + l: string[]; + n: number[]; +} + /** * Applies newlines to a string to have it optimally fit into the horizontal * bounds set by the Text object's wordWrapWidth property. * - * @param {CanvasRenderingContext2D} context - * @param {string} text - * @param {number} wordWrapWidth - * @param {number} letterSpacing - * @param {number} indent - * @returns + * @param context + * @param text + * @param wordWrapWidth + * @param letterSpacing + * @param indent */ -export function wrapText(context, text, wordWrapWidth, letterSpacing, indent) { +export function wrapText( + context: CanvasRenderingContext2D, + text: string, + wordWrapWidth: number, + letterSpacing: number, + indent: number +): WrapTextResult { // Greedy wrapping algorithm that will wrap words as the line grows longer. // than its horizontal bounds. const spaceRegex = / |\u200B/g; let lines = text.split(/\r?\n/g); - let allLines = []; - let realNewlines = []; + let allLines: string[] = []; + let realNewlines: number[] = []; for (let i = 0; i < lines.length; i++) { - let resultLines = []; + let resultLines: string[] = []; let result = ''; let spaceLeft = wordWrapWidth - indent; - let words = lines[i].split(spaceRegex); - let spaces = lines[i].match(spaceRegex) || []; + let words = lines[i]!.split(spaceRegex); + let spaces = lines[i]!.match(spaceRegex) || []; for (let j = 0; j < words.length; j++) { const space = spaces[j - 1] || ''; - const word = words[j]; + const word = words[j]!; const wordWidth = measureText(context, word, letterSpacing); const wordWidthWithSpace = wordWidth + measureText(context, space, letterSpacing); if (j === 0 || wordWidthWithSpace > spaceLeft) { diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 00000000..93ae7d28 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,14 @@ +/* + * Production build tsconfig + */ +{ + "extends": "./tsconfig.json", + "include": [ + "./index.ts", "./src/**/*.ts", "./src/**/*.mts" + ], + "compilerOptions": { + "outDir": "./dist", + // Make sure we emit files from this tsconfig + "noEmit": false, + } +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 50769246..7cced730 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,28 +1,39 @@ { "include": [ - "./index.js", - "./index.d.ts", + "./index.ts", "./src/**/*.d.mts", "./src/**/*.d.ts", "./src/**/*.ts", "./src/**/*.mjs", - "./test-d/**/*.ts" + "./test-d/**/*.ts", + "vite.config.js" ], "compilerOptions": { + "rootDir": "./", "lib": ["ES2018", "DOM"], "outDir": "types", - "sourceMap": true, - "module": "Node16", - "target": "ES2020", + "module": "ESNext", + "target": "ESNext", "moduleResolution": "node", "allowJs": true, "esModuleInterop": true, - "allowSyntheticDefaultImports": true, + "declaration": true, + "sourceMap": true, + "declarationMap": true, + "isolatedModules": true, + + // Don't emit any files via the root tsconfig.json + // (this is a project-wide config and includes the test-d folder which + // we don't want to accidentally emit files for) + "noEmit": true, + + // Type Checking / Syntax Rules "strict": true, + "noUncheckedIndexedAccess": true, "noImplicitOverride": true, + "allowSyntheticDefaultImports": true, "resolveJsonModule": true, - "declaration": true, - "declarationMap": true, - "emitDeclarationOnly": true + // Add when upgrading past TypeScript 5.0: + // "verbatimModuleSyntax": true } } \ No newline at end of file diff --git a/vite.config.js b/vite.config.js index 36a1de3a..600ab3f8 100644 --- a/vite.config.js +++ b/vite.config.js @@ -4,11 +4,9 @@ import { resolve } from 'path' import { defineConfig } from 'vite' import { babel } from '@rollup/plugin-babel'; import { banner } from './banner.vite-plugin'; -import dts from 'vite-plugin-dts'; -// @ts-expect-error Ignore esModuleInterop error ts(1259) import cleanup from 'rollup-plugin-cleanup'; -// @ts-expect-error Ignore "Consider using --resolveJsonModule" error ts(2732) import packageJson from './package.json'; +import { fixTsImportsFromJs } from './fixTsImportsFromJs.vite-plugin'; const isEs5Build = process.env.BUILD_ES5 === 'true'; const isMinifiedBuild = process.env.BUILD_MINIFY === 'true'; @@ -31,7 +29,7 @@ if (isInspectorBuild) { export default defineConfig(() => { return { plugins: [ - useDts && dts(), + fixTsImportsFromJs(), /* Cleanup comments */ cleanup({ comments: 'none', From a03ec720da9cf80cc16daf2a323fd1ef1280ba6c Mon Sep 17 00:00:00 2001 From: Philippe Elsass Date: Mon, 3 Jul 2023 15:55:57 +0200 Subject: [PATCH 05/20] ES export proposal --- package.json | 6 +-- src/index.es.ts | 116 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 src/index.es.ts diff --git a/package.json b/package.json index 64d10261..4d42caaa 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,9 @@ "import": "./dist/index.js", "require": "./dist/lightning.js" }, - "./*.mjs": { - "types": "./dist/src/*.d.mts", - "import": "./dist/src/*.mjs" + "./es": { + "types": "./dist/src/index.es.d.ts", + "import": "./dist/src/index.es.js" }, "./package.json": "./package.json" }, diff --git a/src/index.es.ts b/src/index.es.ts new file mode 100644 index 00000000..793db65c --- /dev/null +++ b/src/index.es.ts @@ -0,0 +1,116 @@ +import Application from "./application/Application.mjs"; +import Component from "./application/Component.mjs"; +import Base from "./tree/Base.mjs"; +import Utils from "./tree/Utils.mjs"; +import StageUtils from "./tree/StageUtils.mjs"; +import Element from "./tree/Element.mjs"; +import ElementCore from "./tree/core/ElementCore.mjs"; +import ElementTexturizer from "./tree/core/ElementTexturizer.mjs"; +import Texture from "./tree/Texture.mjs"; + +import Tools from "./tools/Tools.mjs"; +import ObjMerger from "./tools/ObjMerger.mjs"; +import ObjectListProxy from "./tools/ObjectListProxy.mjs"; +import ObjectListWrapper from "./tools/ObjectListWrapper.mjs"; + +import RectangleTexture from "./textures/RectangleTexture.mjs"; +import NoiseTexture from "./textures/NoiseTexture.mjs"; +import TextTexture from "./textures/TextTexture.mjs"; +import ImageTexture from "./textures/ImageTexture.mjs"; +import HtmlTexture from "./textures/HtmlTexture.mjs"; +import StaticTexture from "./textures/StaticTexture.mjs"; +import StaticCanvasTexture from "./textures/StaticCanvasTexture.mjs"; +import SourceTexture from "./textures/SourceTexture.mjs"; + +import ListComponent from "./components/ListComponent.mjs"; +import FastBlurComponent from "./components/FastBlurComponent.mjs"; +import BloomComponent from "./components/BloomComponent.mjs"; +import SmoothScaleComponent from "./components/SmoothScaleComponent.mjs"; +import BorderComponent from "./components/BorderComponent.mjs"; +import EventEmitter from "./EventEmitter.mjs"; + +import WebGLShader from "./renderer/webgl/WebGLShader.mjs"; +import WebGLDefaultShader from "./renderer/webgl/shaders/DefaultShader.mjs"; +import { WebGLGrayscaleShader } from "./renderer/common/shaders/GrayscaleShader.mjs"; +import BoxBlurShader from "./renderer/webgl/shaders/BoxBlurShader.mjs"; +import DitheringShader from "./renderer/webgl/shaders/DitheringShader.mjs"; +import CircularPushShader from "./renderer/webgl/shaders/CircularPushShader.mjs"; +import InversionShader from "./renderer/webgl/shaders/InversionShader.mjs"; +import LinearBlurShader from "./renderer/webgl/shaders/LinearBlurShader.mjs"; +import OutlineShader from "./renderer/webgl/shaders/OutlineShader.mjs"; +import PixelateShader from "./renderer/webgl/shaders/PixelateShader.mjs"; +import RadialFilterShader from "./renderer/webgl/shaders/RadialFilterShader.mjs"; +import RoundedRectangleShader from "./renderer/webgl/shaders/RoundedRectangleShader.mjs"; +import FadeOutShader from "./renderer/webgl/shaders/FadeOutShader.mjs"; +import VignetteShader from "./renderer/webgl/shaders/VignetteShader.mjs"; +import SpinnerShader from "./renderer/webgl/shaders/SpinnerShader.mjs"; +import HoleShader from "./renderer/webgl/shaders/HoleShader.mjs"; +import RadialGradientShader from "./renderer/webgl/shaders/RadialGradientShader.mjs"; +import Light3dShader from "./renderer/webgl/shaders/Light3dShader.mjs"; +import PerspectiveShader from "./renderer/webgl/shaders/PerspectiveShader.mjs"; +import MagnifierShader from "./renderer/webgl/shaders/MagnifierShader.mjs"; + +import C2dShader from "./renderer/c2d/C2dShader.mjs"; +import C2dDefaultShader from "./renderer/c2d/shaders/DefaultShader.mjs"; +import { C2dGrayscaleShader } from "./renderer/common/shaders/GrayscaleShader.mjs"; +import C2dBlurShader from "./renderer/c2d/shaders/BlurShader.mjs"; +import SpinnerShader2 from "./renderer/webgl/shaders/SpinnerShader2.mjs"; + +import Stage from "./tree/Stage.mjs"; + +// tree-shakeable export +export { + Application, + Component, + Base, + Utils, + StageUtils, + Element, + Tools, + Stage, + ElementCore, + ElementTexturizer, + Texture, + EventEmitter, + WebGLGrayscaleShader, + BoxBlurShader, + DitheringShader, + CircularPushShader, + InversionShader, + LinearBlurShader, + OutlineShader, + PixelateShader, + RadialFilterShader, + RoundedRectangleShader, + SpinnerShader2, + FadeOutShader, + HoleShader, + VignetteShader, + SpinnerShader, + RadialGradientShader, + Light3dShader, + PerspectiveShader, + MagnifierShader, + WebGLShader, + WebGLDefaultShader, + C2dShader, + C2dDefaultShader, + C2dGrayscaleShader, + C2dBlurShader, + RectangleTexture, + NoiseTexture, + TextTexture, + ImageTexture, + HtmlTexture, + StaticTexture, + StaticCanvasTexture, + SourceTexture, + FastBlurComponent, + BloomComponent, + SmoothScaleComponent, + BorderComponent, + ListComponent, + ObjMerger, + ObjectListProxy, + ObjectListWrapper, +}; From f593701c05d378007c42f470e671062d1cdb89e4 Mon Sep 17 00:00:00 2001 From: Philippe Elsass Date: Mon, 10 Jul 2023 09:54:43 +0200 Subject: [PATCH 06/20] Combine index / index-es --- index.ts | 21 --------------------- package.json | 20 ++++++++++---------- src/{index.es.ts => index.ts} | 6 +++++- tsconfig.json | 1 - 4 files changed, 15 insertions(+), 33 deletions(-) delete mode 100644 index.ts rename src/{index.es.ts => index.ts} (97%) diff --git a/index.ts b/index.ts deleted file mode 100644 index fdf33ee4..00000000 --- a/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * If not stated otherwise in this file or this component's LICENSE file the - * following copyright and licenses apply: - * - * Copyright 2020 Metrological - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import lng from './src/lightning.mjs'; -export default lng; diff --git a/package.json b/package.json index 4d42caaa..ea1ed1b3 100644 --- a/package.json +++ b/package.json @@ -4,21 +4,21 @@ "version": "2.10.0", "license": "Apache-2.0", "type": "module", - "types": "dist/index.d.ts", - "module": "dist/index.js", - "main": "dist/lightning.js", + "types": "dist/src/index.d.ts", + "module": "dist/src/index.js", + "main": "dist/lightning.min.js", "exports": { ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.js", - "require": "./dist/lightning.js" - }, - "./es": { - "types": "./dist/src/index.es.d.ts", - "import": "./dist/src/index.es.js" + "types": "./dist/src/index.d.ts", + "import": "./dist/src/index.js", + "require": "./dist/lightning.min.js" }, "./package.json": "./package.json" }, + "sideEffects": [ + "dist/lightning.*", + "devtools/*" + ], "files": [ "dist/**", "devtools/**" diff --git a/src/index.es.ts b/src/index.ts similarity index 97% rename from src/index.es.ts rename to src/index.ts index 793db65c..074dcdd5 100644 --- a/src/index.es.ts +++ b/src/index.ts @@ -58,7 +58,11 @@ import SpinnerShader2 from "./renderer/webgl/shaders/SpinnerShader2.mjs"; import Stage from "./tree/Stage.mjs"; -// tree-shakeable export +// full export (no tree-shaking) +import lng from "./lightning.mjs"; +export default lng; + +// tree-shakeable exports export { Application, Component, diff --git a/tsconfig.json b/tsconfig.json index 7cced730..50ebb95d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,5 @@ { "include": [ - "./index.ts", "./src/**/*.d.mts", "./src/**/*.d.ts", "./src/**/*.ts", From 06ca79ccf2a8a80da8dd4e29b243ff33704b2039 Mon Sep 17 00:00:00 2001 From: Philippe Elsass Date: Mon, 10 Jul 2023 12:12:02 +0200 Subject: [PATCH 07/20] Let bundlers minify --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ea1ed1b3..17cbafc1 100644 --- a/package.json +++ b/package.json @@ -6,12 +6,12 @@ "type": "module", "types": "dist/src/index.d.ts", "module": "dist/src/index.js", - "main": "dist/lightning.min.js", + "main": "dist/lightning.js", "exports": { ".": { "types": "./dist/src/index.d.ts", "import": "./dist/src/index.js", - "require": "./dist/lightning.min.js" + "require": "./dist/lightning.js" }, "./package.json": "./package.json" }, From 3e89f6c691af8f2cc0ff698290cd7e277f3f09ad Mon Sep 17 00:00:00 2001 From: Philippe Elsass Date: Tue, 11 Jul 2023 12:25:24 +0200 Subject: [PATCH 08/20] Expose inspector, tree-shaking friendly --- devtools/lightning-inspect.d.ts | 25 +++++++++++++++++++++++++ devtools/lightning-inspect.js | 26 ++++++++++++++------------ package.json | 5 +++++ 3 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 devtools/lightning-inspect.d.ts diff --git a/devtools/lightning-inspect.d.ts b/devtools/lightning-inspect.d.ts new file mode 100644 index 00000000..90a14097 --- /dev/null +++ b/devtools/lightning-inspect.d.ts @@ -0,0 +1,25 @@ +import type { + Application, + Component, + Element, + ElementCore, + ElementTexturizer, + Stage, + Texture, +} from "../src"; + +declare interface ILng { + Application?: typeof Application; + Component?: typeof Component; + Element: typeof Element; + ElementCore: typeof ElementCore; + ElementTexturizer: typeof ElementTexturizer; + Stage: typeof Stage; + Texture: typeof Texture; +} + +declare global { + interface Window { + attachInspector(lng: ILng): void; + } +} diff --git a/devtools/lightning-inspect.js b/devtools/lightning-inspect.js index e1ba5238..c6ca3bf2 100644 --- a/devtools/lightning-inspect.js +++ b/devtools/lightning-inspect.js @@ -843,18 +843,20 @@ window.attachInspector = function({Application, Element, ElementCore, Stage, Com updateTextureAttribs(this) } - const _updateFocus = Application.prototype.__updateFocus - Application.prototype.__updateFocus = function() { - const prev = this._focusPath && this._focusPath.length ? this._focusPath[this._focusPath.length - 1] : null; - _updateFocus.apply(this, arguments) - const focused = this._focusPath && this._focusPath.length ? this._focusPath[this._focusPath.length - 1] : null; - - if (prev != focused) { - if (prev) { - val(prev, 'focused', false, false); - } - if (focused) { - val(focused, 'focused', true, false); + if (typeof Application !== "undefined") { + const _updateFocus = Application.prototype.__updateFocus + Application.prototype.__updateFocus = function() { + const prev = this._focusPath && this._focusPath.length ? this._focusPath[this._focusPath.length - 1] : null; + _updateFocus.apply(this, arguments) + const focused = this._focusPath && this._focusPath.length ? this._focusPath[this._focusPath.length - 1] : null; + + if (prev != focused) { + if (prev) { + val(prev, 'focused', false, false); + } + if (focused) { + val(focused, 'focused', true, false); + } } } } diff --git a/package.json b/package.json index 17cbafc1..d830ebb3 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,11 @@ "import": "./dist/src/index.js", "require": "./dist/lightning.js" }, + "./devtools": { + "types": "./devtools/lightning-inspect.d.ts", + "import": "./devtools/lightning-inspect.js", + "require": "./devtools/lightning-inspect.es5.js" + }, "./package.json": "./package.json" }, "sideEffects": [ From be3b5580d8df0595d807e995798d9b9dbdd52e5c Mon Sep 17 00:00:00 2001 From: Frank Weindel Date: Mon, 17 Jul 2023 19:03:18 +0200 Subject: [PATCH 09/20] Fix tsd tests after `index.js` was moved into `src` --- test-d/Application.test-d.ts | 2 +- test-d/Components/BloomComponent.test-d.ts | 2 +- test-d/Components/BorderComponent.test-d.ts | 2 +- test-d/Components/Component-state.test-d.ts | 2 +- test-d/Components/Component-types.test-d.ts | 2 +- test-d/Components/FastBlurComponent.test-d.ts | 2 +- test-d/Components/ListComponent.test-d.ts | 2 +- test-d/Components/SmoothScaleComponent.test-d.ts | 2 +- .../Components/component-generic-ref-type-subclassing.test-d.ts | 2 +- test-d/Components/component-mixin-support.test-d.ts | 2 +- test-d/Components/components-loose.test-d.ts | 2 +- test-d/Components/extendible-components.test-d.ts | 2 +- test-d/Elements/Element-Types.test-d.ts | 2 +- test-d/Elements/Element-inline-children.test-d.ts | 2 +- test-d/Elements/Element.test-d.ts | 2 +- test-d/Shaders/Shader.sample.test-d.ts | 2 +- test-d/Stage.test-d.ts | 2 +- test-d/Textures/Texture.sample.test-d.ts | 2 +- test-d/index.test-d.ts | 2 +- test-d/lng-create-myawesomeapp.test-d.ts | 2 +- test-d/types.test-d.ts | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/test-d/Application.test-d.ts b/test-d/Application.test-d.ts index 1cdc84a0..b89a2d03 100644 --- a/test-d/Application.test-d.ts +++ b/test-d/Application.test-d.ts @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import lng from '../index.js'; +import lng from '../src/index.js'; /** * Basic tests for the Application class */ diff --git a/test-d/Components/BloomComponent.test-d.ts b/test-d/Components/BloomComponent.test-d.ts index db9366a7..fd40cf49 100644 --- a/test-d/Components/BloomComponent.test-d.ts +++ b/test-d/Components/BloomComponent.test-d.ts @@ -17,7 +17,7 @@ * limitations under the License. */ import { expectType } from 'tsd'; -import lng from '../../index'; +import lng from '../../src/index.js'; namespace Container { export interface TemplateSpec extends lng.Component.TemplateSpec { diff --git a/test-d/Components/BorderComponent.test-d.ts b/test-d/Components/BorderComponent.test-d.ts index 58b94e3a..9be7a4ce 100644 --- a/test-d/Components/BorderComponent.test-d.ts +++ b/test-d/Components/BorderComponent.test-d.ts @@ -17,7 +17,7 @@ * limitations under the License. */ import { expectType } from 'tsd'; -import lng from '../../index'; +import lng from '../../src/index.js'; import BorderComponent from '../../src/components/BorderComponent.mjs'; namespace Container { diff --git a/test-d/Components/Component-state.test-d.ts b/test-d/Components/Component-state.test-d.ts index 5e112e40..79e1190c 100644 --- a/test-d/Components/Component-state.test-d.ts +++ b/test-d/Components/Component-state.test-d.ts @@ -22,7 +22,7 @@ * @module */ import { expectType } from 'tsd'; -import lng from '../../index.js'; +import lng from '../../src/index.js'; class MyComponent extends lng.Component { override _init() { diff --git a/test-d/Components/Component-types.test-d.ts b/test-d/Components/Component-types.test-d.ts index c730cac2..63b7c293 100644 --- a/test-d/Components/Component-types.test-d.ts +++ b/test-d/Components/Component-types.test-d.ts @@ -22,7 +22,7 @@ * @module */ import { expectNotType, expectType } from 'tsd'; -import lng from '../../index.js'; +import lng from '../../src/index.js'; import { TemplateRequireType } from '../../src/application/Component.mjs'; import { SmoothTemplate, TransitionsTemplate } from '../../src/tree/Element.mjs'; diff --git a/test-d/Components/FastBlurComponent.test-d.ts b/test-d/Components/FastBlurComponent.test-d.ts index f55be6bf..88a0c84b 100644 --- a/test-d/Components/FastBlurComponent.test-d.ts +++ b/test-d/Components/FastBlurComponent.test-d.ts @@ -17,7 +17,7 @@ * limitations under the License. */ import { expectType } from 'tsd'; -import lng from '../../index'; +import lng from '../../src/index.js'; namespace Container { export interface TemplateSpec extends lng.Component.TemplateSpec { diff --git a/test-d/Components/ListComponent.test-d.ts b/test-d/Components/ListComponent.test-d.ts index 92748007..d70141a1 100644 --- a/test-d/Components/ListComponent.test-d.ts +++ b/test-d/Components/ListComponent.test-d.ts @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import lng from '../../index'; +import lng from '../../src/index.js'; import { expectType } from 'tsd'; import TransitionSettings from '../../src/animation/TransitionSettings.mjs'; import AnimationSettings from '../../src/animation/AnimationSettings.mjs'; diff --git a/test-d/Components/SmoothScaleComponent.test-d.ts b/test-d/Components/SmoothScaleComponent.test-d.ts index ac7e5ed7..ab6a3c7e 100644 --- a/test-d/Components/SmoothScaleComponent.test-d.ts +++ b/test-d/Components/SmoothScaleComponent.test-d.ts @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import lng from '../../index'; +import lng from '../../src/index.js'; import { expectType } from 'tsd'; namespace Container { diff --git a/test-d/Components/component-generic-ref-type-subclassing.test-d.ts b/test-d/Components/component-generic-ref-type-subclassing.test-d.ts index c4d4a8f7..703c1ede 100644 --- a/test-d/Components/component-generic-ref-type-subclassing.test-d.ts +++ b/test-d/Components/component-generic-ref-type-subclassing.test-d.ts @@ -1,5 +1,5 @@ import { expectType } from 'tsd'; -import lng from '../../index.js'; +import lng from '../../src/index.js'; import { TemplateSpecTags, TemplateSpecRefs } from '../../src/tree/Element.mjs'; /// diff --git a/test-d/Components/component-mixin-support.test-d.ts b/test-d/Components/component-mixin-support.test-d.ts index 25104dec..4bcdea33 100644 --- a/test-d/Components/component-mixin-support.test-d.ts +++ b/test-d/Components/component-mixin-support.test-d.ts @@ -21,7 +21,7 @@ */ import { expectType } from 'tsd'; -import lng from '../../index.js'; +import lng from '../../src/index.js'; import TransitionSettings from '../../src/animation/TransitionSettings.mjs'; import Element from '../../src/tree/Element.mjs'; diff --git a/test-d/Components/components-loose.test-d.ts b/test-d/Components/components-loose.test-d.ts index 0749262d..9737fee1 100644 --- a/test-d/Components/components-loose.test-d.ts +++ b/test-d/Components/components-loose.test-d.ts @@ -19,7 +19,7 @@ /** * Tests for loosely typed Components with TemplateSpecLoose */ -import lng from '../../index.js'; +import lng from '../../src/index.js'; // Should be able to create a loose Component with unknown properties class MyLooseComponentA extends lng.Component { diff --git a/test-d/Components/extendible-components.test-d.ts b/test-d/Components/extendible-components.test-d.ts index 89244635..14261a33 100644 --- a/test-d/Components/extendible-components.test-d.ts +++ b/test-d/Components/extendible-components.test-d.ts @@ -20,7 +20,7 @@ * Tests for the ability to allow your strongly typed components to be extendible */ -import lng from '../../index.js'; +import lng from '../../src/index.js'; namespace Animal { export interface TemplateSpec extends lng.Component.TemplateSpec { diff --git a/test-d/Elements/Element-Types.test-d.ts b/test-d/Elements/Element-Types.test-d.ts index b99d5953..030681d0 100644 --- a/test-d/Elements/Element-Types.test-d.ts +++ b/test-d/Elements/Element-Types.test-d.ts @@ -22,7 +22,7 @@ * @module */ import { expectAssignable, expectType } from 'tsd'; -import lng from '../../index.js'; +import lng from '../../src/index.js'; import { CompileComponentTemplateSpecType } from '../../src/application/Component.mjs'; import { SignalMapType } from '../../src/internalTypes.mjs'; import { InlineElement, IsLooseTemplateSpec, SmoothTemplate, TemplateSpecTags, TemplateSpecRefs, TransformPossibleElement, TransitionsTemplate } from '../../src/tree/Element.mjs'; diff --git a/test-d/Elements/Element-inline-children.test-d.ts b/test-d/Elements/Element-inline-children.test-d.ts index b9bead54..9455daa0 100644 --- a/test-d/Elements/Element-inline-children.test-d.ts +++ b/test-d/Elements/Element-inline-children.test-d.ts @@ -21,7 +21,7 @@ * child Elements or Components in them */ import { expectType } from 'tsd'; -import lng from '../../index.js'; +import lng from '../../src/index.js'; import ListComponent from '../../src/components/ListComponent.mjs'; namespace MyElementTest { diff --git a/test-d/Elements/Element.test-d.ts b/test-d/Elements/Element.test-d.ts index 9ca42108..d807ca17 100644 --- a/test-d/Elements/Element.test-d.ts +++ b/test-d/Elements/Element.test-d.ts @@ -17,7 +17,7 @@ * limitations under the License. */ import { expectType } from 'tsd'; -import lng from '../../index.js'; +import lng from '../../src/index.js'; import ListComponent from '../../src/components/ListComponent.mjs'; import { InlineElement, SmoothTemplate } from '../../src/tree/Element.mjs'; diff --git a/test-d/Shaders/Shader.sample.test-d.ts b/test-d/Shaders/Shader.sample.test-d.ts index 77b2e960..1d49b709 100644 --- a/test-d/Shaders/Shader.sample.test-d.ts +++ b/test-d/Shaders/Shader.sample.test-d.ts @@ -21,7 +21,7 @@ * * @module */ -import Lightning from "../../index.js"; +import Lightning from "../../src/index.js"; export default class PerspectiveShader extends Lightning.shaders.WebGLDefaultShader { _fudge = 0.2; diff --git a/test-d/Stage.test-d.ts b/test-d/Stage.test-d.ts index 02c94999..39b7af78 100644 --- a/test-d/Stage.test-d.ts +++ b/test-d/Stage.test-d.ts @@ -20,7 +20,7 @@ * Tests for Stage */ import { expectNotType, expectType } from 'tsd'; -import lng from '../index.js'; +import lng from '../src/index.js'; const stage = new lng.Stage(); diff --git a/test-d/Textures/Texture.sample.test-d.ts b/test-d/Textures/Texture.sample.test-d.ts index 016b0cf5..b59b4ad7 100644 --- a/test-d/Textures/Texture.sample.test-d.ts +++ b/test-d/Textures/Texture.sample.test-d.ts @@ -21,7 +21,7 @@ * * @module */ -import Lightning from "../../index.js"; +import Lightning from "../../src/index.js"; type DrawFrameCallback = (canvas: HTMLCanvasElement) => void; export default class DynamicCanvasTexture extends Lightning.Texture { diff --git a/test-d/index.test-d.ts b/test-d/index.test-d.ts index 9c508db1..72c800db 100644 --- a/test-d/index.test-d.ts +++ b/test-d/index.test-d.ts @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import lng from '../index.js'; +import lng from '../src/index.js'; const element: lng.Element = {} as any; diff --git a/test-d/lng-create-myawesomeapp.test-d.ts b/test-d/lng-create-myawesomeapp.test-d.ts index ddd87570..45ffe2d4 100644 --- a/test-d/lng-create-myawesomeapp.test-d.ts +++ b/test-d/lng-create-myawesomeapp.test-d.ts @@ -21,7 +21,7 @@ */ // @ts-expect-error import { Utils } from '@lightningjs/sdk' -import lng from '../index.js'; +import lng from '../src/index.js'; export declare namespace App { export interface TemplateSpec extends lng.Component.TemplateSpec { diff --git a/test-d/types.test-d.ts b/test-d/types.test-d.ts index d76b3a3f..7a94506c 100644 --- a/test-d/types.test-d.ts +++ b/test-d/types.test-d.ts @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import lng from '../index.js'; +import lng from '../src/index.js'; // `types` namespace should only be accessible in a type context // @ts-expect-error From f899b62405469d1a54167b718c0ee4358acb2c29 Mon Sep 17 00:00:00 2001 From: Frank Weindel Date: Mon, 17 Jul 2023 19:05:18 +0200 Subject: [PATCH 10/20] Rename `devtools` package export to `inspector`... Also... - point the export for CommonJS to the ES6 code - Add license headers - Removed redundant inspector.d.mts --- devtools/lightning-inspect.d.ts | 20 +++++++++++++++++++- package.json | 4 ++-- src/index.ts | 18 ++++++++++++++++++ src/inspector.d.mts | 25 ------------------------- 4 files changed, 39 insertions(+), 28 deletions(-) delete mode 100644 src/inspector.d.mts diff --git a/devtools/lightning-inspect.d.ts b/devtools/lightning-inspect.d.ts index 90a14097..073da2c2 100644 --- a/devtools/lightning-inspect.d.ts +++ b/devtools/lightning-inspect.d.ts @@ -1,3 +1,21 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2023 Metrological + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import type { Application, Component, @@ -6,7 +24,7 @@ import type { ElementTexturizer, Stage, Texture, -} from "../src"; +} from "../dist/src"; declare interface ILng { Application?: typeof Application; diff --git a/package.json b/package.json index d830ebb3..3f5f3494 100644 --- a/package.json +++ b/package.json @@ -13,10 +13,10 @@ "import": "./dist/src/index.js", "require": "./dist/lightning.js" }, - "./devtools": { + "./inspector": { "types": "./devtools/lightning-inspect.d.ts", "import": "./devtools/lightning-inspect.js", - "require": "./devtools/lightning-inspect.es5.js" + "require": "./devtools/lightning-inspect.js" }, "./package.json": "./package.json" }, diff --git a/src/index.ts b/src/index.ts index 074dcdd5..ac20f652 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,21 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2023 Metrological + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import Application from "./application/Application.mjs"; import Component from "./application/Component.mjs"; import Base from "./tree/Base.mjs"; diff --git a/src/inspector.d.mts b/src/inspector.d.mts deleted file mode 100644 index b607c472..00000000 --- a/src/inspector.d.mts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * If not stated otherwise in this file or this component's LICENSE file the - * following copyright and licenses apply: - * - * Copyright 2022 Metrological - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import lng from './lightning.mjs'; - -declare global { - interface Window { - attachInspector?(Lightning: typeof lng): void; - } -} From d0d855d7de188c8acc4fc854f5f6824da8789a1a Mon Sep 17 00:00:00 2001 From: Frank Weindel Date: Mon, 17 Jul 2023 19:07:00 +0200 Subject: [PATCH 11/20] Add documentation for package exports / tree shaking --- docs/PackageExports/index.md | 49 ++++++++++++++++++++++++++++++++++++ docs/index.md | 1 + 2 files changed, 50 insertions(+) create mode 100644 docs/PackageExports/index.md diff --git a/docs/PackageExports/index.md b/docs/PackageExports/index.md new file mode 100644 index 00000000..fa9ba6dc --- /dev/null +++ b/docs/PackageExports/index.md @@ -0,0 +1,49 @@ +# Package Exports / Tree Shaking + +The Lightning Core NPM package exports both the Lightning Core library (the default package export: "@lightningjs/core") as well as the Lightning Inspector ("@lightningjs/core/inspector"). Both the [ES](https://nodejs.org/api/esm.html#modules-ecmascript-modules) and [CommonJS](https://nodejs.org/api/modules.html#modules-commonjs-modules) module styles are supported by both package exports. + +> CommonJS is currently provided mainly to support older build tooling that may still be in use by applications. It is recommended that you upgrade/configure your build tools/bundler to utilize the ES modules when possible. + +## Lightning Core (Tree Shakable ESM Exports) + +```js +// ESM (tree shakable named exports) +import { Application, Component } from "@lightningjs/core"; +``` + +Lightning Core has historically always been available as a single default exported object from which you can access all of the various Lightning classes. As of v2.12, when using the ESM style, each Lightning class is now also available as a seperate tree shakable named export. + +Exclusively using the named ESM exports in your application enables the potential for your chosen bundler to [tree shake](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking) Lightning's code so that the parts of Lightning that are not utilized by your application are left out of your bundle, reducing its size. + +> Important: In order for tree shaking to be successful, your entire application, including any dependencies that are also dependent on Lightning must also utilize the named ESM exports. At the time of this writing, no published Lightning-based NPM packages utilize the tree shakable exports. So if your application is dependent on any, your bundler will be unable to tree shake Lightning. + +## Lightning Core (Default Export) + +```js +// ESM (default export) +import Lightning from "@lightningjs/core"; + +// CommonJS +const Lightning = require("@lightningjs/core"); +``` + +The default export, as mentioned above, has historically been the main way users import Lightning Core. All of Lightning Core is available from this single exported object and as such, if imported, will prevent your chosen bundler from being able to tree shake Lightning. + +## Lightning Inspector + +```js +// ESM +import "@lightningjs/core/inspector"; + +// ESM (Dynamic) +await import("@lightningjs/core/inspector"); + +// CommonJS +require("@lightningjs/core/inspector"); +``` + +Outside of including the Lightning Inspector via a seperate `