@rindo/core 1.8.12 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +27 -27
- package/bin/cli.ts +20 -0
- package/bin/rindo +51 -22
- package/cli/index.cjs +1263 -0
- package/cli/index.d.ts +15 -0
- package/cli/index.js +1237 -0
- package/cli/package.json +14 -0
- package/compiler/lib.d.ts +24 -0
- package/compiler/lib.dom.d.ts +20230 -0
- package/compiler/lib.dom.iterable.d.ts +351 -0
- package/compiler/lib.es2015.collection.d.ts +89 -0
- package/compiler/lib.es2015.core.d.ts +517 -0
- package/compiler/lib.es2015.d.ts +30 -0
- package/compiler/lib.es2015.generator.d.ts +79 -0
- package/compiler/lib.es2015.iterable.d.ts +505 -0
- package/compiler/lib.es2015.promise.d.ts +150 -0
- package/compiler/lib.es2015.proxy.d.ts +41 -0
- package/compiler/lib.es2015.reflect.d.ts +123 -0
- package/compiler/lib.es2015.symbol.d.ts +48 -0
- package/compiler/lib.es2015.symbol.wellknown.d.ts +324 -0
- package/compiler/lib.es2016.array.include.d.ts +118 -0
- package/compiler/lib.es2016.d.ts +22 -0
- package/compiler/lib.es2016.full.d.ts +25 -0
- package/compiler/lib.es2017.d.ts +26 -0
- package/compiler/lib.es2017.full.d.ts +25 -0
- package/compiler/lib.es2017.intl.d.ts +32 -0
- package/compiler/lib.es2017.object.d.ts +51 -0
- package/compiler/lib.es2017.sharedmemory.d.ts +137 -0
- package/compiler/lib.es2017.string.d.ts +47 -0
- package/compiler/lib.es2017.typedarrays.d.ts +55 -0
- package/compiler/lib.es2018.asyncgenerator.d.ts +79 -0
- package/compiler/lib.es2018.asynciterable.d.ts +45 -0
- package/compiler/lib.es2018.d.ts +26 -0
- package/compiler/lib.es2018.full.d.ts +25 -0
- package/compiler/lib.es2018.intl.d.ts +61 -0
- package/compiler/lib.es2018.promise.d.ts +32 -0
- package/compiler/lib.es2018.regexp.d.ts +39 -0
- package/compiler/lib.es2019.array.d.ts +85 -0
- package/compiler/lib.es2019.d.ts +25 -0
- package/compiler/lib.es2019.full.d.ts +25 -0
- package/compiler/lib.es2019.object.d.ts +35 -0
- package/compiler/lib.es2019.string.d.ts +33 -0
- package/compiler/lib.es2019.symbol.d.ts +26 -0
- package/compiler/lib.es2020.bigint.d.ts +728 -0
- package/compiler/lib.es2020.d.ts +27 -0
- package/compiler/lib.es2020.full.d.ts +25 -0
- package/compiler/lib.es2020.intl.d.ts +310 -0
- package/compiler/lib.es2020.promise.d.ts +50 -0
- package/compiler/lib.es2020.sharedmemory.d.ts +99 -0
- package/compiler/lib.es2020.string.d.ts +30 -0
- package/compiler/lib.es2020.symbol.wellknown.d.ts +39 -0
- package/compiler/lib.es5.d.ts +4435 -0
- package/compiler/lib.es6.d.ts +25 -0
- package/compiler/lib.esnext.d.ts +25 -0
- package/compiler/lib.esnext.full.d.ts +25 -0
- package/compiler/lib.esnext.intl.d.ts +32 -0
- package/compiler/lib.esnext.promise.d.ts +43 -0
- package/compiler/lib.esnext.string.d.ts +35 -0
- package/compiler/lib.esnext.weakref.d.ts +75 -0
- package/compiler/lib.scripthost.d.ts +327 -0
- package/compiler/lib.webworker.d.ts +6042 -0
- package/compiler/lib.webworker.importscripts.d.ts +26 -0
- package/compiler/lib.webworker.iterable.d.ts +166 -0
- package/compiler/package.json +8 -6
- package/compiler/rindo.d.ts +95 -0
- package/compiler/rindo.js +65051 -6657
- package/compiler/rindo.min.js +4 -0
- package/dependencies.json +103 -0
- package/dev-server/client/app-error.d.ts +18 -0
- package/dev-server/client/events.d.ts +6 -0
- package/dev-server/client/hmr-components.d.ts +1 -0
- package/dev-server/client/hmr-external-styles.d.ts +1 -0
- package/dev-server/client/hmr-images.d.ts +1 -0
- package/dev-server/client/hmr-inline-styles.d.ts +1 -0
- package/dev-server/client/hmr-util.d.ts +9 -0
- package/dev-server/client/hmr-window.d.ts +10 -0
- package/dev-server/client/index.d.ts +6 -0
- package/dev-server/client/index.js +808 -0
- package/dev-server/client/logger.d.ts +5 -0
- package/dev-server/client/package.json +8 -0
- package/dev-server/client/progress.d.ts +3 -0
- package/dev-server/client/status.d.ts +4 -0
- package/dev-server/connector.html +6 -0
- package/dev-server/index.d.ts +3 -0
- package/dev-server/index.js +264 -0
- package/dev-server/open-in-editor-api.js +1 -0
- package/dev-server/package.json +8 -0
- package/dev-server/server-process.js +1738 -0
- package/dev-server/server-worker-thread.js +39 -0
- package/{dist/dev-server → dev-server}/templates/directory-index.html +132 -132
- package/{dist/dev-server → dev-server}/templates/initial-load.html +160 -160
- package/dev-server/ws.js +1 -0
- package/internal/app-data/index.cjs +90 -0
- package/internal/app-data/index.d.ts +4 -0
- package/internal/{client/build-conditionals.mjs → app-data/index.js} +25 -21
- package/internal/app-data/package.json +15 -0
- package/internal/client/css-shim.js +4 -0
- package/internal/client/{dom.rindo-client.mjs → dom.js} +73 -137
- package/{dist/client/index.mjs → internal/client/index.js} +863 -789
- package/internal/client/package.json +8 -0
- package/internal/client/patch-browser.js +120 -0
- package/internal/client/patch-esm.js +23 -0
- package/internal/client/polyfills/core-js.js +11 -10
- package/internal/client/polyfills/css-shim.js +1 -656
- package/internal/client/polyfills/dom.js +79 -146
- package/internal/client/polyfills/es5-html-element.js +1 -18
- package/internal/client/polyfills/index.js +34 -35
- package/internal/client/{shadow-css.rindo-client.mjs → shadow-css.js} +20 -17
- package/internal/hydrate/index.js +1097 -0
- package/internal/hydrate/package.json +7 -0
- package/internal/hydrate/runner.d.ts +217 -0
- package/internal/hydrate/runner.js +777 -0
- package/internal/hydrate/shadow-css.js +146 -0
- package/internal/index.d.ts +4 -18
- package/internal/index.js +1 -1
- package/internal/package.json +9 -6
- package/internal/rindo-core/index.cjs +1 -0
- package/internal/rindo-core/index.d.ts +51 -0
- package/internal/rindo-core/index.js +15 -0
- package/internal/rindo-ext-modules.d.ts +41 -0
- package/internal/rindo-private.d.ts +2128 -0
- package/internal/rindo-public-compiler.d.ts +2170 -0
- package/{dist/declarations/docs.d.ts → internal/rindo-public-docs.d.ts} +13 -1
- package/internal/rindo-public-runtime.d.ts +1555 -0
- package/internal/testing/index.js +1055 -0
- package/internal/testing/package.json +7 -0
- package/internal/testing/shadow-css.js +146 -0
- package/mock-doc/index.cjs +4610 -0
- package/mock-doc/index.d.ts +916 -0
- package/mock-doc/index.js +4574 -2
- package/mock-doc/package.json +15 -10
- package/package.json +132 -186
- package/readme.md +21 -174
- package/screenshot/compare/build/app.css +1 -1
- package/screenshot/compare/build/app.esm.js +1 -1
- package/screenshot/compare/build/app.js +33 -818
- package/screenshot/compare/build/{p-113f7459.js → p-081b0641.js} +1 -1
- package/screenshot/compare/build/p-227a1e18.entry.js +1 -0
- package/screenshot/compare/build/p-2c298727.entry.js +1 -0
- package/screenshot/compare/build/p-5479268c.entry.js +1 -0
- package/screenshot/compare/build/p-573ec8a4.entry.js +1 -0
- package/screenshot/compare/build/p-6ba08604.entry.js +1 -0
- package/screenshot/compare/build/p-6bc63295.entry.js +1 -0
- package/screenshot/compare/build/p-7a3759fd.entry.js +1 -0
- package/screenshot/compare/build/{p-ejpsp3kx.js → p-7b4e3ba7.js} +1 -1
- package/screenshot/compare/build/p-988eb362.css +1 -0
- package/screenshot/compare/build/p-9b6a9315.js +1 -0
- package/screenshot/compare/build/p-b4cc611c.entry.js +1 -0
- package/screenshot/compare/build/p-d1bf53f5.entry.js +1 -0
- package/screenshot/compare/build/{p-efb0eac6.js → p-e2efe0df.js} +1 -1
- package/screenshot/compare/build/p-e8ca6d97.entry.js +1 -0
- package/screenshot/compare/build/p-ec2f13e0.entry.js +1 -0
- package/screenshot/compare/build/p-f0b99977.entry.js +1 -0
- package/screenshot/compare/build/p-f4745c2f.entry.js +1 -0
- package/screenshot/compare/build/p-fbbae598.js +1 -0
- package/screenshot/compare/host.config.json +14 -14
- package/screenshot/compare/index.html +1 -1
- package/{dist/screenshot → screenshot}/connector-base.d.ts +1 -1
- package/{dist/screenshot → screenshot}/connector-local.d.ts +1 -1
- package/screenshot/connector.js +2 -3
- package/{dist/screenshot → screenshot}/index.d.ts +1 -1
- package/screenshot/index.js +659 -2
- package/screenshot/local-connector.js +2 -3
- package/screenshot/package.json +15 -13
- package/screenshot/pixel-match.js +62 -49
- package/screenshot/screenshot-compare.d.ts +3 -0
- package/{dist/screenshot → screenshot}/screenshot-fs.d.ts +1 -1
- package/sys/deno/index.js +1785 -0
- package/sys/deno/node-compat.js +2654 -0
- package/sys/deno/worker.js +44 -0
- package/sys/node/autoprefixer.js +8 -0
- package/sys/node/glob.js +1 -0
- package/sys/node/graceful-fs.js +1 -0
- package/sys/node/index.d.ts +18 -0
- package/sys/node/index.js +1386 -2
- package/sys/node/node-fetch.js +1 -0
- package/sys/node/package.json +8 -5
- package/sys/node/prompts.js +1 -0
- package/sys/node/worker.js +52 -0
- package/{dist/testing → testing}/index.d.ts +5 -6
- package/testing/index.js +4017 -2
- package/testing/jest/jest-config.d.ts +5 -0
- package/{dist/testing → testing}/jest/jest-environment.d.ts +4 -2
- package/{dist/testing → testing}/jest/jest-preprocessor.d.ts +1 -0
- package/{dist/testing → testing}/jest/jest-runner.d.ts +1 -1
- package/{dist/testing → testing}/jest/jest-screenshot.d.ts +1 -1
- package/{dist/testing → testing}/jest/jest-serializer.d.ts +1 -1
- package/testing/jest-environment.js +3 -3
- package/testing/jest-preprocessor.js +3 -3
- package/testing/jest-preset.js +32 -40
- package/testing/jest-runner.js +3 -3
- package/testing/jest-setuptestframework.js +3 -3
- package/{dist/testing → testing}/matchers/events.d.ts +9 -1
- package/{dist/testing → testing}/matchers/index.d.ts +3 -1
- package/{dist/testing → testing}/matchers/screenshot.d.ts +1 -1
- package/testing/mock-fetch.d.ts +11 -0
- package/testing/mocks.d.ts +14 -0
- package/testing/package.json +8 -6
- package/testing/puppeteer/index.d.ts +2 -0
- package/{dist/testing → testing}/puppeteer/puppeteer-browser.d.ts +3 -3
- package/{dist/testing → testing}/puppeteer/puppeteer-declarations.d.ts +18 -18
- package/{dist/testing → testing}/puppeteer/puppeteer-element.d.ts +7 -5
- package/testing/puppeteer/puppeteer-emulate.d.ts +2 -0
- package/{dist/testing → testing}/puppeteer/puppeteer-events.d.ts +9 -9
- package/testing/puppeteer/puppeteer-page.d.ts +2 -0
- package/testing/puppeteer/puppeteer-screenshot.d.ts +4 -0
- package/testing/reset-build-conditionals.d.ts +2 -0
- package/testing/spec-page.d.ts +2 -0
- package/testing/test-transpile.d.ts +2 -0
- package/{dist/testing → testing}/testing-logger.d.ts +10 -8
- package/testing/testing-sys.d.ts +1 -0
- package/{dist/testing → testing}/testing-utils.d.ts +3 -2
- package/testing/testing.d.ts +2 -0
- package/build-conditionals/index.d.ts +0 -2
- package/build-conditionals/index.mjs +0 -66
- package/build-conditionals/package.json +0 -6
- package/compiler/index.js +0 -2
- package/dist/cli/index.js +0 -6068
- package/dist/client/css-shim-14a9812e.js +0 -656
- package/dist/client/css-shim-69821662.js +0 -658
- package/dist/client/declarations/rindo.core.d.ts +0 -1347
- package/dist/client/dom-68c8fe31.js +0 -139
- package/dist/client/dom-af01458a.js +0 -137
- package/dist/client/index.js +0 -2937
- package/dist/client/polyfills/core-js.js +0 -10
- package/dist/client/polyfills/css-shim.js +0 -656
- package/dist/client/polyfills/dom.js +0 -146
- package/dist/client/polyfills/es5-html-element.js +0 -18
- package/dist/client/polyfills/index.js +0 -35
- package/dist/client/polyfills/promise.js +0 -9
- package/dist/client/polyfills/system.js +0 -6
- package/dist/client/shadow-css-6ef31c68.js +0 -386
- package/dist/client/shadow-css-8fd1a9e4.js +0 -388
- package/dist/compiler/app-core/app-es5-disabled.d.ts +0 -2
- package/dist/compiler/app-core/app-polyfills.d.ts +0 -3
- package/dist/compiler/app-core/build-conditionals.d.ts +0 -6
- package/dist/compiler/app-core/bundle-app-core.d.ts +0 -6
- package/dist/compiler/app-core/component-styles.d.ts +0 -4
- package/dist/compiler/app-core/format-component-runtime-meta.d.ts +0 -4
- package/dist/compiler/app-core/optimize-module.d.ts +0 -7
- package/dist/compiler/browser/build-conditionals-client.d.ts +0 -3
- package/dist/compiler/browser/compile-options.d.ts +0 -12
- package/dist/compiler/browser/compile.d.ts +0 -2
- package/dist/compiler/browser/create-compiler.d.ts +0 -14
- package/dist/compiler/browser/index.d.ts +0 -11
- package/dist/compiler/build/build-ctx.d.ts +0 -74
- package/dist/compiler/build/build-finish.d.ts +0 -3
- package/dist/compiler/build/build-hmr.d.ts +0 -2
- package/dist/compiler/build/build-results.d.ts +0 -2
- package/dist/compiler/build/build-stats.d.ts +0 -3
- package/dist/compiler/build/build.d.ts +0 -2
- package/dist/compiler/build/cache-stats.d.ts +0 -4
- package/dist/compiler/build/compiler-build-id.d.ts +0 -6
- package/dist/compiler/build/compiler-ctx.d.ts +0 -44
- package/dist/compiler/build/init-index-html.d.ts +0 -2
- package/dist/compiler/build/validate-files.d.ts +0 -2
- package/dist/compiler/build/write-build.d.ts +0 -2
- package/dist/compiler/cache.d.ts +0 -22
- package/dist/compiler/compiler.d.ts +0 -27
- package/dist/compiler/component-hydrate/bundle-hydrate-factory.d.ts +0 -3
- package/dist/compiler/component-hydrate/generate-hydrate-app.d.ts +0 -2
- package/dist/compiler/component-hydrate/hydrate-factory-closure.d.ts +0 -2
- package/dist/compiler/component-hydrate/update-to-hydrate-components.d.ts +0 -2
- package/dist/compiler/component-hydrate/write-hydrate-outputs.d.ts +0 -3
- package/dist/compiler/component-lazy/generate-cjs.d.ts +0 -3
- package/dist/compiler/component-lazy/generate-esm-browser.d.ts +0 -3
- package/dist/compiler/component-lazy/generate-esm.d.ts +0 -3
- package/dist/compiler/component-lazy/generate-lazy-app.d.ts +0 -3
- package/dist/compiler/component-lazy/generate-lazy-module.d.ts +0 -4
- package/dist/compiler/component-lazy/generate-system.d.ts +0 -3
- package/dist/compiler/component-lazy/update-to-lazy-component.d.ts +0 -2
- package/dist/compiler/component-lazy/write-lazy-entry-module.d.ts +0 -2
- package/dist/compiler/component-native/update-to-native-component.d.ts +0 -2
- package/dist/compiler/config/config-reload.d.ts +0 -3
- package/dist/compiler/config/config-utils.d.ts +0 -4
- package/dist/compiler/config/validate-config.d.ts +0 -4
- package/dist/compiler/config/validate-copy.d.ts +0 -2
- package/dist/compiler/config/validate-dev-server.d.ts +0 -2
- package/dist/compiler/config/validate-docs.d.ts +0 -2
- package/dist/compiler/config/validate-namespace.d.ts +0 -3
- package/dist/compiler/config/validate-output-stats.d.ts +0 -2
- package/dist/compiler/config/validate-outputs-angular.d.ts +0 -2
- package/dist/compiler/config/validate-outputs-custom.d.ts +0 -2
- package/dist/compiler/config/validate-outputs-dist-module.d.ts +0 -2
- package/dist/compiler/config/validate-outputs-dist.d.ts +0 -2
- package/dist/compiler/config/validate-outputs-hydrate-script.d.ts +0 -2
- package/dist/compiler/config/validate-outputs-www.d.ts +0 -2
- package/dist/compiler/config/validate-outputs.d.ts +0 -2
- package/dist/compiler/config/validate-paths.d.ts +0 -2
- package/dist/compiler/config/validate-plugins.d.ts +0 -2
- package/dist/compiler/config/validate-prerender.d.ts +0 -2
- package/dist/compiler/config/validate-rollup-config.d.ts +0 -2
- package/dist/compiler/config/validate-service-worker.d.ts +0 -2
- package/dist/compiler/config/validate-testing.d.ts +0 -2
- package/dist/compiler/config/validate-workers.d.ts +0 -2
- package/dist/compiler/copy/assets-copy-tasks.d.ts +0 -3
- package/dist/compiler/copy/hashed-copy.d.ts +0 -2
- package/dist/compiler/copy/local-copy-tasks.d.ts +0 -3
- package/dist/compiler/docs/constants.d.ts +0 -2
- package/dist/compiler/docs/custom/index.d.ts +0 -2
- package/dist/compiler/docs/docs.d.ts +0 -2
- package/dist/compiler/docs/generate-doc-data.d.ts +0 -3
- package/dist/compiler/docs/json/index.d.ts +0 -3
- package/dist/compiler/docs/readme/docs-util.d.ts +0 -13
- package/dist/compiler/docs/readme/index.d.ts +0 -3
- package/dist/compiler/docs/readme/markdown-css-props.d.ts +0 -2
- package/dist/compiler/docs/readme/markdown-dependencies.d.ts +0 -2
- package/dist/compiler/docs/readme/markdown-events.d.ts +0 -2
- package/dist/compiler/docs/readme/markdown-methods.d.ts +0 -2
- package/dist/compiler/docs/readme/markdown-props.d.ts +0 -2
- package/dist/compiler/docs/readme/markdown-slots.d.ts +0 -2
- package/dist/compiler/docs/readme/markdown-usage.d.ts +0 -6
- package/dist/compiler/docs/readme/output-docs.d.ts +0 -3
- package/dist/compiler/docs/style-docs.d.ts +0 -2
- package/dist/compiler/docs/vscode/index.d.ts +0 -2
- package/dist/compiler/entries/component-bundles.d.ts +0 -3
- package/dist/compiler/entries/component-graph.d.ts +0 -2
- package/dist/compiler/entries/default-bundles.d.ts +0 -3
- package/dist/compiler/entries/entry-modules.d.ts +0 -6
- package/dist/compiler/entries/resolve-component-dependencies.d.ts +0 -2
- package/dist/compiler/events.d.ts +0 -15
- package/dist/compiler/fs-watch/fs-watch-init.d.ts +0 -2
- package/dist/compiler/fs-watch/fs-watch-log.d.ts +0 -2
- package/dist/compiler/fs-watch/fs-watch-rebuild.d.ts +0 -7
- package/dist/compiler/html/inject-module-preloads.d.ts +0 -3
- package/dist/compiler/html/inject-sw-script.d.ts +0 -4
- package/dist/compiler/html/inline-esm-import.d.ts +0 -2
- package/dist/compiler/html/inline-style-sheets.d.ts +0 -2
- package/dist/compiler/html/update-global-styles-link.d.ts +0 -2
- package/dist/compiler/html/used-components.d.ts +0 -2
- package/dist/compiler/html/utils.d.ts +0 -2
- package/dist/compiler/html/validate-manifest-json.d.ts +0 -2
- package/dist/compiler/index.d.ts +0 -10
- package/dist/compiler/index.js +0 -18008
- package/dist/compiler/output-targets/empty-dir.d.ts +0 -6
- package/dist/compiler/output-targets/index.d.ts +0 -2
- package/dist/compiler/output-targets/output-angular.d.ts +0 -4
- package/dist/compiler/output-targets/output-app.d.ts +0 -4
- package/dist/compiler/output-targets/output-collection.d.ts +0 -3
- package/dist/compiler/output-targets/output-copy.d.ts +0 -2
- package/dist/compiler/output-targets/output-custom.d.ts +0 -2
- package/dist/compiler/output-targets/output-docs.d.ts +0 -2
- package/dist/compiler/output-targets/output-hydrate.d.ts +0 -2
- package/dist/compiler/output-targets/output-lazy-loader.d.ts +0 -2
- package/dist/compiler/output-targets/output-module.d.ts +0 -4
- package/dist/compiler/output-targets/output-prerender.d.ts +0 -2
- package/dist/compiler/output-targets/output-service-workers.d.ts +0 -2
- package/dist/compiler/output-targets/output-types.d.ts +0 -2
- package/dist/compiler/output-targets/output-utils.d.ts +0 -54
- package/dist/compiler/output-targets/output-www.d.ts +0 -2
- package/dist/compiler/plugin/plugin.d.ts +0 -6
- package/dist/compiler/prerender/crawl-urls.d.ts +0 -3
- package/dist/compiler/prerender/host-config.d.ts +0 -12
- package/dist/compiler/prerender/prerender-config.d.ts +0 -2
- package/dist/compiler/prerender/prerender-main.d.ts +0 -2
- package/dist/compiler/prerender/prerender-queue.d.ts +0 -3
- package/dist/compiler/prerender/prerender-template-html.d.ts +0 -2
- package/dist/compiler/prerender/prerendered-write-path.d.ts +0 -2
- package/dist/compiler/prerender/robots-txt.d.ts +0 -2
- package/dist/compiler/prerender/sitemap-xml.d.ts +0 -3
- package/dist/compiler/rollup-plugins/component-entry.d.ts +0 -3
- package/dist/compiler/rollup-plugins/css-transformer.d.ts +0 -3
- package/dist/compiler/rollup-plugins/global-scripts.d.ts +0 -4
- package/dist/compiler/rollup-plugins/image-plugin.d.ts +0 -3
- package/dist/compiler/rollup-plugins/in-memory-fs-read.d.ts +0 -3
- package/dist/compiler/rollup-plugins/loader.d.ts +0 -4
- package/dist/compiler/rollup-plugins/plugin-helper.d.ts +0 -5
- package/dist/compiler/rollup-plugins/rindo-build-conditionals.d.ts +0 -7
- package/dist/compiler/rollup-plugins/rindo-client.d.ts +0 -3
- package/dist/compiler/rollup-plugins/rindo-external-runtime.d.ts +0 -2
- package/dist/compiler/rollup-plugins/rindo-hydrate.d.ts +0 -3
- package/dist/compiler/rollup-plugins/rindo-public-plugin.d.ts +0 -2
- package/dist/compiler/service-worker/generate-sw.d.ts +0 -7
- package/dist/compiler/service-worker/service-worker-util.d.ts +0 -2
- package/dist/compiler/style/cached-styles.d.ts +0 -5
- package/dist/compiler/style/component-styles.d.ts +0 -2
- package/dist/compiler/style/css-imports.d.ts +0 -9
- package/dist/compiler/style/css-to-esm.d.ts +0 -5
- package/dist/compiler/style/generate-styles.d.ts +0 -2
- package/dist/compiler/style/global-styles.d.ts +0 -3
- package/dist/compiler/style/normalize-styles.d.ts +0 -2
- package/dist/compiler/style/optimize-css.d.ts +0 -2
- package/dist/compiler/style/scope-css.d.ts +0 -3
- package/dist/compiler/style/style-utils.d.ts +0 -10
- package/dist/compiler/transformers/add-component-meta-proxy.d.ts +0 -3
- package/dist/compiler/transformers/add-component-meta-static.d.ts +0 -4
- package/dist/compiler/transformers/add-imports.d.ts +0 -3
- package/dist/compiler/transformers/collections/add-external-import.d.ts +0 -2
- package/dist/compiler/transformers/collections/parse-collection-components.d.ts +0 -2
- package/dist/compiler/transformers/collections/parse-collection-deprecated.d.ts +0 -2
- package/dist/compiler/transformers/collections/parse-collection-manifest.d.ts +0 -7
- package/dist/compiler/transformers/collections/parse-collection-module.d.ts +0 -2
- package/dist/compiler/transformers/component-build-conditionals.d.ts +0 -2
- package/dist/compiler/transformers/component-hydrate/hydrate-component.d.ts +0 -3
- package/dist/compiler/transformers/component-hydrate/hydrate-runtime-cmp-meta.d.ts +0 -3
- package/dist/compiler/transformers/component-hydrate/tranform-to-hydrate-component.d.ts +0 -2
- package/dist/compiler/transformers/component-lazy/lazy-component.d.ts +0 -3
- package/dist/compiler/transformers/component-lazy/lazy-constructor.d.ts +0 -3
- package/dist/compiler/transformers/component-lazy/lazy-element-getter.d.ts +0 -3
- package/dist/compiler/transformers/component-lazy/transform-lazy-component.d.ts +0 -4
- package/dist/compiler/transformers/component-native/native-component.d.ts +0 -3
- package/dist/compiler/transformers/component-native/native-connected-callback.d.ts +0 -3
- package/dist/compiler/transformers/component-native/native-constructor.d.ts +0 -3
- package/dist/compiler/transformers/component-native/native-element-getter.d.ts +0 -3
- package/dist/compiler/transformers/component-native/native-static-style.d.ts +0 -3
- package/dist/compiler/transformers/component-native/tranform-to-native-component.d.ts +0 -4
- package/dist/compiler/transformers/core-runtime-apis.d.ts +0 -30
- package/dist/compiler/transformers/create-event.d.ts +0 -3
- package/dist/compiler/transformers/decorators-to-static/component-decorator.d.ts +0 -3
- package/dist/compiler/transformers/decorators-to-static/convert-decorators.d.ts +0 -3
- package/dist/compiler/transformers/decorators-to-static/decorator-utils.d.ts +0 -10
- package/dist/compiler/transformers/decorators-to-static/element-decorator.d.ts +0 -3
- package/dist/compiler/transformers/decorators-to-static/event-decorator.d.ts +0 -4
- package/dist/compiler/transformers/decorators-to-static/listen-decorator.d.ts +0 -6
- package/dist/compiler/transformers/decorators-to-static/method-decorator.d.ts +0 -3
- package/dist/compiler/transformers/decorators-to-static/prop-decorator.d.ts +0 -4
- package/dist/compiler/transformers/decorators-to-static/state-decorator.d.ts +0 -3
- package/dist/compiler/transformers/decorators-to-static/style-to-static.d.ts +0 -3
- package/dist/compiler/transformers/decorators-to-static/watch-decorator.d.ts +0 -3
- package/dist/compiler/transformers/define-custom-element.d.ts +0 -3
- package/dist/compiler/transformers/host-data-transform.d.ts +0 -3
- package/dist/compiler/transformers/legacy-props.d.ts +0 -3
- package/dist/compiler/transformers/remove-static-meta-properties.d.ts +0 -2
- package/dist/compiler/transformers/reserved-public-members.d.ts +0 -3
- package/dist/compiler/transformers/rindo-import-path.d.ts +0 -3
- package/dist/compiler/transformers/static-to-meta/call-expression.d.ts +0 -3
- package/dist/compiler/transformers/static-to-meta/class-methods.d.ts +0 -3
- package/dist/compiler/transformers/static-to-meta/component.d.ts +0 -3
- package/dist/compiler/transformers/static-to-meta/element-ref.d.ts +0 -2
- package/dist/compiler/transformers/static-to-meta/encapsulation.d.ts +0 -3
- package/dist/compiler/transformers/static-to-meta/events.d.ts +0 -3
- package/dist/compiler/transformers/static-to-meta/import.d.ts +0 -3
- package/dist/compiler/transformers/static-to-meta/listeners.d.ts +0 -3
- package/dist/compiler/transformers/static-to-meta/methods.d.ts +0 -3
- package/dist/compiler/transformers/static-to-meta/props.d.ts +0 -3
- package/dist/compiler/transformers/static-to-meta/states.d.ts +0 -3
- package/dist/compiler/transformers/static-to-meta/string-literal.d.ts +0 -3
- package/dist/compiler/transformers/static-to-meta/styles.d.ts +0 -3
- package/dist/compiler/transformers/static-to-meta/vdom.d.ts +0 -3
- package/dist/compiler/transformers/static-to-meta/visitor.d.ts +0 -3
- package/dist/compiler/transformers/static-to-meta/watchers.d.ts +0 -3
- package/dist/compiler/transformers/style-imports.d.ts +0 -3
- package/dist/compiler/transformers/transform-utils.d.ts +0 -31
- package/dist/compiler/transformers/update-component-class.d.ts +0 -3
- package/dist/compiler/transformers/update-rindo-core-import.d.ts +0 -3
- package/dist/compiler/transformers/watcher-meta-transform.d.ts +0 -3
- package/dist/compiler/transpile/compiler-options.d.ts +0 -4
- package/dist/compiler/transpile/transpile-app.d.ts +0 -2
- package/dist/compiler/transpile/transpile-module.d.ts +0 -5
- package/dist/compiler/transpile/transpile-service.d.ts +0 -3
- package/dist/compiler/transpile/transpile-to-es5-main.d.ts +0 -2
- package/dist/compiler/transpile/validate-types-main.d.ts +0 -2
- package/dist/compiler/types/generate-app-types.d.ts +0 -2
- package/dist/compiler/types/generate-component-types.d.ts +0 -8
- package/dist/compiler/types/generate-event-types.d.ts +0 -2
- package/dist/compiler/types/generate-method-types.d.ts +0 -2
- package/dist/compiler/types/generate-prop-types.d.ts +0 -2
- package/dist/compiler/types/generate-types.d.ts +0 -2
- package/dist/compiler/types/rindo-types.d.ts +0 -3
- package/dist/compiler/types/types-utils.d.ts +0 -4
- package/dist/compiler/types/update-import-refs.d.ts +0 -11
- package/dist/compiler/types/validate-package-json.d.ts +0 -9
- package/dist/declarations/assets.d.ts +0 -17
- package/dist/declarations/browser-compile.d.ts +0 -47
- package/dist/declarations/build-conditionals.d.ts +0 -91
- package/dist/declarations/build-events.d.ts +0 -19
- package/dist/declarations/build.d.ts +0 -247
- package/dist/declarations/cache.d.ts +0 -11
- package/dist/declarations/collection-manifest.d.ts +0 -106
- package/dist/declarations/collection.d.ts +0 -139
- package/dist/declarations/compiler.d.ts +0 -53
- package/dist/declarations/component-compiler-meta.d.ts +0 -198
- package/dist/declarations/component-constructor.d.ts +0 -61
- package/dist/declarations/component-interfaces.d.ts +0 -123
- package/dist/declarations/config.d.ts +0 -409
- package/dist/declarations/css-var-shim.d.ts +0 -9
- package/dist/declarations/decorators.d.ts +0 -150
- package/dist/declarations/dev-server.d.ts +0 -135
- package/dist/declarations/diagnostics.d.ts +0 -21
- package/dist/declarations/entry.d.ts +0 -28
- package/dist/declarations/events.d.ts +0 -13
- package/dist/declarations/file-system.d.ts +0 -91
- package/dist/declarations/fs-watch.d.ts +0 -15
- package/dist/declarations/host-element.d.ts +0 -53
- package/dist/declarations/hydrate.d.ts +0 -99
- package/dist/declarations/in-memory-fs.d.ts +0 -59
- package/dist/declarations/index.d.ts +0 -45
- package/dist/declarations/jsdoc.d.ts +0 -16
- package/dist/declarations/jsx.d.ts +0 -1050
- package/dist/declarations/logger.d.ts +0 -25
- package/dist/declarations/minify-js.d.ts +0 -11
- package/dist/declarations/module.d.ts +0 -35
- package/dist/declarations/optimize-css.d.ts +0 -12
- package/dist/declarations/output-targets.d.ts +0 -189
- package/dist/declarations/plugin.d.ts +0 -23
- package/dist/declarations/prerender.d.ts +0 -79
- package/dist/declarations/render.d.ts +0 -62
- package/dist/declarations/runtime.d.ts +0 -92
- package/dist/declarations/screenshots.d.ts +0 -192
- package/dist/declarations/server.d.ts +0 -19
- package/dist/declarations/style.d.ts +0 -35
- package/dist/declarations/system.d.ts +0 -174
- package/dist/declarations/testing.d.ts +0 -523
- package/dist/declarations/transpile.d.ts +0 -24
- package/dist/declarations/types.d.ts +0 -24
- package/dist/declarations/vdom.d.ts +0 -55
- package/dist/declarations/worker.d.ts +0 -33
- package/dist/dev-server/content-type-db.json +0 -1
- package/dist/dev-server/index.js +0 -887
- package/dist/dev-server/static/app-error.css +0 -257
- package/dist/dev-server/static/dev-server-client.html +0 -13
- package/dist/hydrate/index.d.ts +0 -101
- package/dist/hydrate/index.mjs +0 -1281
- package/dist/hydrate/platform.mjs +0 -347
- package/dist/index.d.ts +0 -99
- package/dist/index.js +0 -1
- package/dist/mock-doc/index.d.ts +0 -851
- package/dist/mock-doc/index.js +0 -3982
- package/dist/mock-doc/index.mjs +0 -3954
- package/dist/runtime/index.js +0 -2576
- package/dist/runtime/index.mjs +0 -2521
- package/dist/runtime/shadow-css-6ef31c68.js +0 -386
- package/dist/runtime/shadow-css-8fd1a9e4.js +0 -388
- package/dist/screenshot/index.js +0 -520
- package/dist/sys/node/graceful-fs.js +0 -975
- package/dist/sys/node/index.js +0 -33545
- package/dist/sys/node/node-fetch.js +0 -1779
- package/dist/sys/node/open-in-editor.js +0 -734
- package/dist/sys/node/sys-worker.js +0 -67035
- package/dist/sys/node/websocket.js +0 -3728
- package/dist/testing/build-conditionals.d.ts +0 -4
- package/dist/testing/build-conditionals.js +0 -43
- package/dist/testing/core.d.ts +0 -35
- package/dist/testing/core.js +0 -52
- package/dist/testing/index.js +0 -40511
- package/dist/testing/jest/jest-config.d.ts +0 -4
- package/dist/testing/mock-fetch.d.ts +0 -46
- package/dist/testing/mocks.d.ts +0 -12
- package/dist/testing/platform.d.ts +0 -23
- package/dist/testing/platform.js +0 -321
- package/dist/testing/puppeteer/puppeteer-emulate.d.ts +0 -2
- package/dist/testing/puppeteer/puppeteer-find.d.ts +0 -5
- package/dist/testing/puppeteer/puppeteer-page.d.ts +0 -2
- package/dist/testing/puppeteer/puppeteer-screenshot.d.ts +0 -4
- package/dist/testing/spec-page.d.ts +0 -5
- package/dist/testing/task-queue.d.ts +0 -15
- package/dist/testing/test-transpile.d.ts +0 -5
- package/dist/testing/testing-fs.d.ts +0 -31
- package/dist/testing/testing-sys.d.ts +0 -19
- package/dist/testing/testing.d.ts +0 -12
- package/dist/utils/index.js +0 -1575
- package/dist/utils/index.mjs +0 -1511
- package/internal/client/css-shim.rindo-client.mjs +0 -656
- package/internal/client/index.mjs +0 -2859
- package/internal/client/polyfills/promise.js +0 -9
- package/internal/images.d.ts +0 -5
- package/runtime/package.json +0 -5
- package/screenshot/compare/build/p-020f8d73.js +0 -1
- package/screenshot/compare/build/p-09qdknbg.system.entry.js +0 -1
- package/screenshot/compare/build/p-0a13mpsc.system.entry.js +0 -1
- package/screenshot/compare/build/p-168ec2c4.system.js +0 -1
- package/screenshot/compare/build/p-2ab1fdf1.system.js +0 -1
- package/screenshot/compare/build/p-2pxcsgrj.entry.js +0 -1
- package/screenshot/compare/build/p-42fb7034.system.js +0 -1
- package/screenshot/compare/build/p-54d9d7c2.system.js +0 -1
- package/screenshot/compare/build/p-67c1f911.js +0 -1
- package/screenshot/compare/build/p-68613371.system.js +0 -1
- package/screenshot/compare/build/p-7dvsjpu0.entry.js +0 -1
- package/screenshot/compare/build/p-aa67fb06.js +0 -1
- package/screenshot/compare/build/p-aeb3cec1.system.js +0 -1
- package/screenshot/compare/build/p-b6e44a24.js +0 -1
- package/screenshot/compare/build/p-c1c25b8a.js +0 -1
- package/screenshot/compare/build/p-c9bopbjy.system.entry.js +0 -1
- package/screenshot/compare/build/p-c9iqz1pp.system.entry.js +0 -1
- package/screenshot/compare/build/p-dizjz8rg.entry.js +0 -1
- package/screenshot/compare/build/p-dnta0rwp.system.entry.js +0 -1
- package/screenshot/compare/build/p-e9670d22.system.js +0 -1
- package/screenshot/compare/build/p-ei9jkpd0.system.entry.js +0 -1
- package/screenshot/compare/build/p-ejwcppol.entry.js +0 -1
- package/screenshot/compare/build/p-f6612d5d.system.js +0 -1
- package/screenshot/compare/build/p-foiivsfc.css +0 -1
- package/screenshot/compare/build/p-gpjjyogx.entry.js +0 -1
- package/screenshot/compare/build/p-howklem2.system.entry.js +0 -1
- package/screenshot/compare/build/p-knv9wvoc.entry.js +0 -1
- package/screenshot/compare/build/p-nsqsfhhy.entry.js +0 -1
- package/screenshot/compare/build/p-ojt278pp.entry.js +0 -1
- package/screenshot/compare/build/p-oywass99.entry.js +0 -1
- package/screenshot/compare/build/p-q3ujhub6.entry.js +0 -1
- package/screenshot/compare/build/p-qw4xnmxv.entry.js +0 -1
- package/screenshot/compare/build/p-t1wvevhc.system.entry.js +0 -1
- package/screenshot/compare/build/p-tnjarrex.system.entry.js +0 -1
- package/screenshot/compare/build/p-vhfpd6kk.system.entry.js +0 -1
- package/screenshot/compare/build/p-vk6rhemd.system.entry.js +0 -1
- package/screenshot/compare/build/p-w6bnm16k.entry.js +0 -1
- package/screenshot/compare/build/p-xje6d7zl.system.entry.js +0 -1
- package/screenshot/compare/build/p-y5jlrcha.system.entry.js +0 -1
- package/screenshot/compare/build/p-yh170wkt.entry.js +0 -1
- package/testing/jest.preprocessor.js +0 -7
- /package/{dist/dev-server → dev-server}/static/favicon.ico +0 -0
- /package/{dist/sys/node → dev-server}/visualstudio.vbs +0 -0
- /package/{dist/sys/node → dev-server}/xdg-open +0 -0
- /package/{dist/compiler/polyfills.d.ts → screenshot/compare/build/index.esm.js} +0 -0
- /package/{dist/screenshot → screenshot}/pixel-match.d.ts +0 -0
- /package/{dist/testing → testing}/jest/jest-setup-test-framework.d.ts +0 -0
- /package/{dist/testing → testing}/matchers/attributes.d.ts +0 -0
- /package/{dist/testing → testing}/matchers/class-list.d.ts +0 -0
- /package/{dist/testing → testing}/matchers/html.d.ts +0 -0
- /package/{dist/testing → testing}/matchers/text.d.ts +0 -0
package/dist/utils/index.js
DELETED
|
@@ -1,1575 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Default style mode id
|
|
7
|
-
*/
|
|
8
|
-
const DEFAULT_STYLE_MODE = '$';
|
|
9
|
-
/**
|
|
10
|
-
* Reusable empty obj/array
|
|
11
|
-
* Don't add values to these!!
|
|
12
|
-
*/
|
|
13
|
-
const EMPTY_OBJ = {};
|
|
14
|
-
/**
|
|
15
|
-
* Namespaces
|
|
16
|
-
*/
|
|
17
|
-
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
18
|
-
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
|
19
|
-
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
20
|
-
const XML_NS = 'http://www.w3.org/XML/1998/namespace';
|
|
21
|
-
/**
|
|
22
|
-
* File names and value
|
|
23
|
-
*/
|
|
24
|
-
const BANNER = `Built with http://rindojs.web.app`;
|
|
25
|
-
const COLLECTION_MANIFEST_FILE_NAME = 'collection-manifest.json';
|
|
26
|
-
|
|
27
|
-
const normalizePath = (str) => {
|
|
28
|
-
// Convert Windows backslash paths to slash paths: foo\\bar ➔ foo/bar
|
|
29
|
-
// https://github.com/sindresorhus/slash MIT
|
|
30
|
-
// By Sindre Sorhus
|
|
31
|
-
if (typeof str !== 'string') {
|
|
32
|
-
throw new Error(`invalid path to normalize`);
|
|
33
|
-
}
|
|
34
|
-
str = str.trim();
|
|
35
|
-
if (EXTENDED_PATH_REGEX.test(str) || NON_ASCII_REGEX.test(str)) {
|
|
36
|
-
return str;
|
|
37
|
-
}
|
|
38
|
-
str = str.replace(SLASH_REGEX, '/');
|
|
39
|
-
// always remove the trailing /
|
|
40
|
-
// this makes our file cache look ups consistent
|
|
41
|
-
if (str.charAt(str.length - 1) === '/') {
|
|
42
|
-
const colonIndex = str.indexOf(':');
|
|
43
|
-
if (colonIndex > -1) {
|
|
44
|
-
if (colonIndex < str.length - 2) {
|
|
45
|
-
str = str.substring(0, str.length - 1);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
else if (str.length > 1) {
|
|
49
|
-
str = str.substring(0, str.length - 1);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return str;
|
|
53
|
-
};
|
|
54
|
-
const EXTENDED_PATH_REGEX = /^\\\\\?\\/;
|
|
55
|
-
const NON_ASCII_REGEX = /[^\x00-\x80]+/;
|
|
56
|
-
const SLASH_REGEX = /\\/g;
|
|
57
|
-
|
|
58
|
-
const isDef = (v) => v != null;
|
|
59
|
-
const toLowerCase = (str) => str.toLowerCase();
|
|
60
|
-
const toDashCase = (str) => toLowerCase(str.replace(/([A-Z0-9])/g, g => ' ' + g[0]).trim().replace(/ /g, '-'));
|
|
61
|
-
const dashToPascalCase = (str) => toLowerCase(str).split('-').map(segment => segment.charAt(0).toUpperCase() + segment.slice(1)).join('');
|
|
62
|
-
const toTitleCase = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
63
|
-
const noop = () => { };
|
|
64
|
-
const isComplexType = (o) => {
|
|
65
|
-
// https://jsperf.com/typeof-fn-object/5
|
|
66
|
-
o = typeof o;
|
|
67
|
-
return o === 'object' || o === 'function';
|
|
68
|
-
};
|
|
69
|
-
const sortBy = (array, prop) => {
|
|
70
|
-
return array.slice().sort((a, b) => {
|
|
71
|
-
const nameA = prop(a);
|
|
72
|
-
const nameB = prop(b);
|
|
73
|
-
if (nameA < nameB)
|
|
74
|
-
return -1;
|
|
75
|
-
if (nameA > nameB)
|
|
76
|
-
return 1;
|
|
77
|
-
return 0;
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
const flatOne = (array) => {
|
|
81
|
-
if (array.flat) {
|
|
82
|
-
return array.flat(1);
|
|
83
|
-
}
|
|
84
|
-
return array.reduce((result, item) => {
|
|
85
|
-
result.push(...item);
|
|
86
|
-
return result;
|
|
87
|
-
}, []);
|
|
88
|
-
};
|
|
89
|
-
const unique = (array, predicate = (i) => i) => {
|
|
90
|
-
const set = new Set();
|
|
91
|
-
return array.filter(item => {
|
|
92
|
-
const key = predicate(item);
|
|
93
|
-
if (key == null) {
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
if (set.has(key)) {
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
set.add(key);
|
|
100
|
-
return true;
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
const fromEntries = (entries) => {
|
|
104
|
-
const object = {};
|
|
105
|
-
for (const [key, value] of entries) {
|
|
106
|
-
object[key] = value;
|
|
107
|
-
}
|
|
108
|
-
return object;
|
|
109
|
-
};
|
|
110
|
-
const relativeImport = (config, pathFrom, pathTo, ext, addPrefix = true) => {
|
|
111
|
-
let relativePath = config.sys.path.relative(config.sys.path.dirname(pathFrom), config.sys.path.dirname(pathTo));
|
|
112
|
-
if (addPrefix) {
|
|
113
|
-
if (relativePath === '') {
|
|
114
|
-
relativePath = '.';
|
|
115
|
-
}
|
|
116
|
-
else if (relativePath[0] !== '.') {
|
|
117
|
-
relativePath = './' + relativePath;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return normalizePath(`${relativePath}/${config.sys.path.basename(pathTo, ext)}`);
|
|
121
|
-
};
|
|
122
|
-
const pluck = (obj, keys) => {
|
|
123
|
-
return keys.reduce((final, key) => {
|
|
124
|
-
if (obj[key]) {
|
|
125
|
-
final[key] = obj[key];
|
|
126
|
-
}
|
|
127
|
-
return final;
|
|
128
|
-
}, {});
|
|
129
|
-
};
|
|
130
|
-
const isObject = (val) => {
|
|
131
|
-
return val != null && typeof val === 'object' && Array.isArray(val) === false;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
class InMemoryFileSystem {
|
|
135
|
-
constructor(disk, path) {
|
|
136
|
-
this.disk = disk;
|
|
137
|
-
this.path = path;
|
|
138
|
-
this.items = new Map();
|
|
139
|
-
}
|
|
140
|
-
async accessData(filePath) {
|
|
141
|
-
const item = this.getItem(filePath);
|
|
142
|
-
if (typeof item.exists === 'boolean') {
|
|
143
|
-
return {
|
|
144
|
-
exists: item.exists,
|
|
145
|
-
isDirectory: item.isDirectory,
|
|
146
|
-
isFile: item.isFile
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
const data = {
|
|
150
|
-
exists: false,
|
|
151
|
-
isDirectory: false,
|
|
152
|
-
isFile: false
|
|
153
|
-
};
|
|
154
|
-
try {
|
|
155
|
-
const s = await this.stat(filePath);
|
|
156
|
-
item.exists = true;
|
|
157
|
-
item.isDirectory = s.isDirectory;
|
|
158
|
-
item.isFile = s.isFile;
|
|
159
|
-
data.exists = item.exists;
|
|
160
|
-
data.isDirectory = item.isDirectory;
|
|
161
|
-
data.isFile = item.isFile;
|
|
162
|
-
}
|
|
163
|
-
catch (e) {
|
|
164
|
-
item.exists = false;
|
|
165
|
-
}
|
|
166
|
-
return data;
|
|
167
|
-
}
|
|
168
|
-
async access(filePath) {
|
|
169
|
-
const data = await this.accessData(filePath);
|
|
170
|
-
return data.exists;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Synchronous!!! Do not use!!!
|
|
174
|
-
* (Only typescript transpiling is allowed to use)
|
|
175
|
-
* @param filePath
|
|
176
|
-
*/
|
|
177
|
-
accessSync(filePath) {
|
|
178
|
-
const item = this.getItem(filePath);
|
|
179
|
-
if (typeof item.exists === 'boolean') {
|
|
180
|
-
return item.exists;
|
|
181
|
-
}
|
|
182
|
-
let hasAccess = false;
|
|
183
|
-
try {
|
|
184
|
-
const s = this.statSync(filePath);
|
|
185
|
-
item.exists = true;
|
|
186
|
-
item.isDirectory = s.isDirectory;
|
|
187
|
-
item.isFile = s.isFile;
|
|
188
|
-
hasAccess = true;
|
|
189
|
-
}
|
|
190
|
-
catch (e) {
|
|
191
|
-
item.exists = false;
|
|
192
|
-
}
|
|
193
|
-
return hasAccess;
|
|
194
|
-
}
|
|
195
|
-
async copyFile(src, dest) {
|
|
196
|
-
const item = this.getItem(src);
|
|
197
|
-
item.queueCopyFileToDest = dest;
|
|
198
|
-
}
|
|
199
|
-
async emptyDir(dirPath) {
|
|
200
|
-
const item = this.getItem(dirPath);
|
|
201
|
-
await this.removeDir(dirPath);
|
|
202
|
-
item.isFile = false;
|
|
203
|
-
item.isDirectory = true;
|
|
204
|
-
item.queueWriteToDisk = true;
|
|
205
|
-
item.queueDeleteFromDisk = false;
|
|
206
|
-
}
|
|
207
|
-
async readdir(dirPath, opts = {}) {
|
|
208
|
-
dirPath = normalizePath(dirPath);
|
|
209
|
-
const collectedPaths = [];
|
|
210
|
-
if (opts.inMemoryOnly === true) {
|
|
211
|
-
let inMemoryDir = dirPath;
|
|
212
|
-
if (!inMemoryDir.endsWith('/')) {
|
|
213
|
-
inMemoryDir += '/';
|
|
214
|
-
}
|
|
215
|
-
const inMemoryDirs = dirPath.split('/');
|
|
216
|
-
this.items.forEach((d, filePath) => {
|
|
217
|
-
if (!filePath.startsWith(dirPath)) {
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
const parts = filePath.split('/');
|
|
221
|
-
if (parts.length === inMemoryDirs.length + 1 || (opts.recursive && parts.length > inMemoryDirs.length)) {
|
|
222
|
-
if (d.exists) {
|
|
223
|
-
const item = {
|
|
224
|
-
absPath: filePath,
|
|
225
|
-
relPath: parts[inMemoryDirs.length],
|
|
226
|
-
isDirectory: d.isDirectory,
|
|
227
|
-
isFile: d.isFile
|
|
228
|
-
};
|
|
229
|
-
collectedPaths.push(item);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
// always a disk read
|
|
236
|
-
await this.readDirectory(dirPath, dirPath, opts, collectedPaths);
|
|
237
|
-
}
|
|
238
|
-
return collectedPaths.sort((a, b) => {
|
|
239
|
-
if (a.absPath < b.absPath)
|
|
240
|
-
return -1;
|
|
241
|
-
if (a.absPath > b.absPath)
|
|
242
|
-
return 1;
|
|
243
|
-
return 0;
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
async readDirectory(initPath, dirPath, opts, collectedPaths) {
|
|
247
|
-
// used internally only so we could easily recursively drill down
|
|
248
|
-
// loop through this directory and sub directories
|
|
249
|
-
// always a disk read!!
|
|
250
|
-
const dirItems = await this.disk.readdir(dirPath);
|
|
251
|
-
// cache some facts about this path
|
|
252
|
-
const item = this.getItem(dirPath);
|
|
253
|
-
item.exists = true;
|
|
254
|
-
item.isFile = false;
|
|
255
|
-
item.isDirectory = true;
|
|
256
|
-
await Promise.all(dirItems.map(async (dirItem) => {
|
|
257
|
-
// let's loop through each of the files we've found so far
|
|
258
|
-
// create an absolute path of the item inside of this directory
|
|
259
|
-
const absPath = normalizePath(this.path.join(dirPath, dirItem));
|
|
260
|
-
const relPath = normalizePath(this.path.relative(initPath, absPath));
|
|
261
|
-
// get the fs stats for the item, could be either a file or directory
|
|
262
|
-
const stats = await this.stat(absPath);
|
|
263
|
-
// cache some stats about this path
|
|
264
|
-
const subItem = this.getItem(absPath);
|
|
265
|
-
subItem.exists = true;
|
|
266
|
-
subItem.isDirectory = stats.isDirectory;
|
|
267
|
-
subItem.isFile = stats.isFile;
|
|
268
|
-
collectedPaths.push({
|
|
269
|
-
absPath: absPath,
|
|
270
|
-
relPath: relPath,
|
|
271
|
-
isDirectory: stats.isDirectory,
|
|
272
|
-
isFile: stats.isFile
|
|
273
|
-
});
|
|
274
|
-
if (opts.recursive === true && stats.isDirectory === true) {
|
|
275
|
-
// looks like it's yet another directory
|
|
276
|
-
// let's keep drilling down
|
|
277
|
-
await this.readDirectory(initPath, absPath, opts, collectedPaths);
|
|
278
|
-
}
|
|
279
|
-
}));
|
|
280
|
-
}
|
|
281
|
-
async readFile(filePath, opts) {
|
|
282
|
-
if (opts == null || (opts.useCache === true || opts.useCache === undefined)) {
|
|
283
|
-
const item = this.getItem(filePath);
|
|
284
|
-
if (item.exists && typeof item.fileText === 'string') {
|
|
285
|
-
return item.fileText;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
const fileContent = await this.disk.readFile(filePath);
|
|
289
|
-
const item = this.getItem(filePath);
|
|
290
|
-
if (fileContent.length < MAX_TEXT_CACHE) {
|
|
291
|
-
item.exists = true;
|
|
292
|
-
item.isFile = true;
|
|
293
|
-
item.isDirectory = false;
|
|
294
|
-
item.fileText = fileContent;
|
|
295
|
-
}
|
|
296
|
-
return fileContent;
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Synchronous!!! Do not use!!!
|
|
300
|
-
* (Only typescript transpiling is allowed to use)
|
|
301
|
-
* @param filePath
|
|
302
|
-
*/
|
|
303
|
-
readFileSync(filePath, opts) {
|
|
304
|
-
if (opts == null || (opts.useCache === true || opts.useCache === undefined)) {
|
|
305
|
-
const item = this.getItem(filePath);
|
|
306
|
-
if (item.exists && typeof item.fileText === 'string') {
|
|
307
|
-
return item.fileText;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
const fileContent = this.disk.readFileSync(filePath);
|
|
311
|
-
const item = this.getItem(filePath);
|
|
312
|
-
if (fileContent.length < MAX_TEXT_CACHE) {
|
|
313
|
-
item.exists = true;
|
|
314
|
-
item.isFile = true;
|
|
315
|
-
item.isDirectory = false;
|
|
316
|
-
item.fileText = fileContent;
|
|
317
|
-
}
|
|
318
|
-
return fileContent;
|
|
319
|
-
}
|
|
320
|
-
async remove(itemPath) {
|
|
321
|
-
const stats = await this.stat(itemPath);
|
|
322
|
-
if (stats.isDirectory === true) {
|
|
323
|
-
await this.removeDir(itemPath);
|
|
324
|
-
}
|
|
325
|
-
else if (stats.isFile === true) {
|
|
326
|
-
await this.removeItem(itemPath);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
async removeDir(dirPath) {
|
|
330
|
-
const item = this.getItem(dirPath);
|
|
331
|
-
item.isFile = false;
|
|
332
|
-
item.isDirectory = true;
|
|
333
|
-
if (!item.queueWriteToDisk) {
|
|
334
|
-
item.queueDeleteFromDisk = true;
|
|
335
|
-
}
|
|
336
|
-
try {
|
|
337
|
-
const dirItems = await this.readdir(dirPath, { recursive: true });
|
|
338
|
-
await Promise.all(dirItems.map(item => this.removeItem(item.absPath)));
|
|
339
|
-
}
|
|
340
|
-
catch (e) {
|
|
341
|
-
// do not throw error if the directory never existed
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
async removeItem(filePath) {
|
|
345
|
-
const item = this.getItem(filePath);
|
|
346
|
-
if (!item.queueWriteToDisk) {
|
|
347
|
-
item.queueDeleteFromDisk = true;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
async stat(itemPath) {
|
|
351
|
-
const item = this.getItem(itemPath);
|
|
352
|
-
if (typeof item.isDirectory !== 'boolean' || typeof item.isFile !== 'boolean') {
|
|
353
|
-
const s = await this.disk.stat(itemPath);
|
|
354
|
-
item.exists = true;
|
|
355
|
-
item.isDirectory = s.isDirectory();
|
|
356
|
-
item.isFile = s.isFile();
|
|
357
|
-
item.size = s.size;
|
|
358
|
-
}
|
|
359
|
-
return {
|
|
360
|
-
exists: !!item.exists,
|
|
361
|
-
isFile: !!item.isFile,
|
|
362
|
-
isDirectory: !!item.isDirectory,
|
|
363
|
-
size: typeof item.size === 'number' ? item.size : 0
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* Synchronous!!! Do not use!!!
|
|
368
|
-
* (Only typescript transpiling is allowed to use)
|
|
369
|
-
* @param itemPath
|
|
370
|
-
*/
|
|
371
|
-
statSync(itemPath) {
|
|
372
|
-
const item = this.getItem(itemPath);
|
|
373
|
-
if (typeof item.isDirectory !== 'boolean' || typeof item.isFile !== 'boolean') {
|
|
374
|
-
const s = this.disk.statSync(itemPath);
|
|
375
|
-
item.exists = true;
|
|
376
|
-
item.isDirectory = s.isDirectory();
|
|
377
|
-
item.isFile = s.isFile();
|
|
378
|
-
}
|
|
379
|
-
return {
|
|
380
|
-
isFile: item.isFile,
|
|
381
|
-
isDirectory: item.isDirectory
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
async writeFile(filePath, content, opts) {
|
|
385
|
-
if (typeof filePath !== 'string') {
|
|
386
|
-
throw new Error(`writeFile, invalid filePath: ${filePath}`);
|
|
387
|
-
}
|
|
388
|
-
if (typeof content !== 'string') {
|
|
389
|
-
throw new Error(`writeFile, invalid content: ${filePath}`);
|
|
390
|
-
}
|
|
391
|
-
const results = {
|
|
392
|
-
ignored: false,
|
|
393
|
-
changedContent: false,
|
|
394
|
-
queuedWrite: false
|
|
395
|
-
};
|
|
396
|
-
if (shouldIgnore(filePath) === true) {
|
|
397
|
-
results.ignored = true;
|
|
398
|
-
return results;
|
|
399
|
-
}
|
|
400
|
-
const item = this.getItem(filePath);
|
|
401
|
-
item.exists = true;
|
|
402
|
-
item.isFile = true;
|
|
403
|
-
item.isDirectory = false;
|
|
404
|
-
item.queueDeleteFromDisk = false;
|
|
405
|
-
results.changedContent = (item.fileText !== content);
|
|
406
|
-
results.queuedWrite = false;
|
|
407
|
-
item.fileText = content;
|
|
408
|
-
if (opts != null && opts.useCache === false) {
|
|
409
|
-
item.useCache = false;
|
|
410
|
-
}
|
|
411
|
-
if (opts != null && opts.inMemoryOnly === true) {
|
|
412
|
-
// we don't want to actually write this to disk
|
|
413
|
-
// just keep it in memory
|
|
414
|
-
if (item.queueWriteToDisk) {
|
|
415
|
-
// we already queued this file to write to disk
|
|
416
|
-
// in that case we still need to do it
|
|
417
|
-
results.queuedWrite = true;
|
|
418
|
-
}
|
|
419
|
-
else {
|
|
420
|
-
// we only want this in memory and
|
|
421
|
-
// it wasn't already queued to be written
|
|
422
|
-
item.queueWriteToDisk = false;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
else if (opts != null && opts.immediateWrite === true) {
|
|
426
|
-
// If this is an immediate write then write the file
|
|
427
|
-
// and do not add it to the queue
|
|
428
|
-
await this.ensureDir(filePath);
|
|
429
|
-
await this.disk.writeFile(filePath, item.fileText);
|
|
430
|
-
}
|
|
431
|
-
else {
|
|
432
|
-
// we want to write this to disk (eventually)
|
|
433
|
-
// but only if the content is different
|
|
434
|
-
// from our existing cached content
|
|
435
|
-
if (!item.queueWriteToDisk && results.changedContent === true) {
|
|
436
|
-
// not already queued to be written
|
|
437
|
-
// and the content is different
|
|
438
|
-
item.queueWriteToDisk = true;
|
|
439
|
-
results.queuedWrite = true;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
return results;
|
|
443
|
-
}
|
|
444
|
-
writeFiles(files, opts) {
|
|
445
|
-
return Promise.all(Object.keys(files).map(filePath => {
|
|
446
|
-
return this.writeFile(filePath, files[filePath], opts);
|
|
447
|
-
}));
|
|
448
|
-
}
|
|
449
|
-
async commit() {
|
|
450
|
-
const instructions = getCommitInstructions(this.path, this.items);
|
|
451
|
-
// ensure directories we need exist
|
|
452
|
-
const dirsAdded = await this.commitEnsureDirs(instructions.dirsToEnsure);
|
|
453
|
-
// write all queued the files
|
|
454
|
-
const filesWritten = await this.commitWriteFiles(instructions.filesToWrite);
|
|
455
|
-
// write all queued the files to copy
|
|
456
|
-
const filesCopied = await this.commitCopyFiles(instructions.filesToCopy);
|
|
457
|
-
// remove all the queued files to be deleted
|
|
458
|
-
const filesDeleted = await this.commitDeleteFiles(instructions.filesToDelete);
|
|
459
|
-
// remove all the queued dirs to be deleted
|
|
460
|
-
const dirsDeleted = await this.commitDeleteDirs(instructions.dirsToDelete);
|
|
461
|
-
instructions.filesToDelete.forEach(fileToDelete => {
|
|
462
|
-
this.clearFileCache(fileToDelete);
|
|
463
|
-
});
|
|
464
|
-
instructions.dirsToDelete.forEach(dirToDelete => {
|
|
465
|
-
this.clearDirCache(dirToDelete);
|
|
466
|
-
});
|
|
467
|
-
// return only the files that were
|
|
468
|
-
return {
|
|
469
|
-
filesCopied,
|
|
470
|
-
filesWritten,
|
|
471
|
-
filesDeleted,
|
|
472
|
-
dirsDeleted,
|
|
473
|
-
dirsAdded
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
async ensureDir(p) {
|
|
477
|
-
const allDirs = [];
|
|
478
|
-
while (true) {
|
|
479
|
-
p = this.path.dirname(p);
|
|
480
|
-
if (typeof p === 'string' && p.length > 0 && p !== '/' && p.endsWith(':/') === false && p.endsWith(':\\') === false) {
|
|
481
|
-
allDirs.push(p);
|
|
482
|
-
}
|
|
483
|
-
else {
|
|
484
|
-
break;
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
allDirs.reverse();
|
|
488
|
-
await this.commitEnsureDirs(allDirs);
|
|
489
|
-
}
|
|
490
|
-
async commitEnsureDirs(dirsToEnsure) {
|
|
491
|
-
const dirsAdded = [];
|
|
492
|
-
for (const dirPath of dirsToEnsure) {
|
|
493
|
-
const item = this.getItem(dirPath);
|
|
494
|
-
if (item.exists === true && item.isDirectory === true) {
|
|
495
|
-
// already cached that this path is indeed an existing directory
|
|
496
|
-
continue;
|
|
497
|
-
}
|
|
498
|
-
try {
|
|
499
|
-
// cache that we know this is a directory on disk
|
|
500
|
-
item.exists = true;
|
|
501
|
-
item.isDirectory = true;
|
|
502
|
-
item.isFile = false;
|
|
503
|
-
await this.disk.mkdir(dirPath);
|
|
504
|
-
dirsAdded.push(dirPath);
|
|
505
|
-
}
|
|
506
|
-
catch (e) { }
|
|
507
|
-
}
|
|
508
|
-
return dirsAdded;
|
|
509
|
-
}
|
|
510
|
-
commitCopyFiles(filesToCopy) {
|
|
511
|
-
const copiedFiles = Promise.all(filesToCopy.map(async (data) => {
|
|
512
|
-
const src = data[0];
|
|
513
|
-
const dest = data[1];
|
|
514
|
-
await this.disk.copyFile(src, dest);
|
|
515
|
-
return [src, dest];
|
|
516
|
-
}));
|
|
517
|
-
return copiedFiles;
|
|
518
|
-
}
|
|
519
|
-
commitWriteFiles(filesToWrite) {
|
|
520
|
-
const writtenFiles = Promise.all(filesToWrite.map(async (filePath) => {
|
|
521
|
-
if (typeof filePath !== 'string') {
|
|
522
|
-
throw new Error(`unable to writeFile without filePath`);
|
|
523
|
-
}
|
|
524
|
-
return this.commitWriteFile(filePath);
|
|
525
|
-
}));
|
|
526
|
-
return writtenFiles;
|
|
527
|
-
}
|
|
528
|
-
async commitWriteFile(filePath) {
|
|
529
|
-
const item = this.getItem(filePath);
|
|
530
|
-
if (item.fileText == null) {
|
|
531
|
-
throw new Error(`unable to find item fileText to write: ${filePath}`);
|
|
532
|
-
}
|
|
533
|
-
await this.disk.writeFile(filePath, item.fileText);
|
|
534
|
-
if (item.useCache === false) {
|
|
535
|
-
this.clearFileCache(filePath);
|
|
536
|
-
}
|
|
537
|
-
return filePath;
|
|
538
|
-
}
|
|
539
|
-
async commitDeleteFiles(filesToDelete) {
|
|
540
|
-
const deletedFiles = await Promise.all(filesToDelete.map(async (filePath) => {
|
|
541
|
-
if (typeof filePath !== 'string') {
|
|
542
|
-
throw new Error(`unable to unlink without filePath`);
|
|
543
|
-
}
|
|
544
|
-
await this.disk.unlink(filePath);
|
|
545
|
-
return filePath;
|
|
546
|
-
}));
|
|
547
|
-
return deletedFiles;
|
|
548
|
-
}
|
|
549
|
-
async commitDeleteDirs(dirsToDelete) {
|
|
550
|
-
const dirsDeleted = [];
|
|
551
|
-
for (const dirPath of dirsToDelete) {
|
|
552
|
-
try {
|
|
553
|
-
await this.disk.rmdir(dirPath);
|
|
554
|
-
}
|
|
555
|
-
catch (e) { }
|
|
556
|
-
dirsDeleted.push(dirPath);
|
|
557
|
-
}
|
|
558
|
-
return dirsDeleted;
|
|
559
|
-
}
|
|
560
|
-
clearDirCache(dirPath) {
|
|
561
|
-
dirPath = normalizePath(dirPath);
|
|
562
|
-
this.items.forEach((_, f) => {
|
|
563
|
-
const filePath = this.path.relative(dirPath, f).split('/')[0];
|
|
564
|
-
if (!filePath.startsWith('.') && !filePath.startsWith('/')) {
|
|
565
|
-
this.clearFileCache(f);
|
|
566
|
-
}
|
|
567
|
-
});
|
|
568
|
-
}
|
|
569
|
-
clearFileCache(filePath) {
|
|
570
|
-
filePath = normalizePath(filePath);
|
|
571
|
-
const item = this.items.get(filePath);
|
|
572
|
-
if (item != null && !item.queueWriteToDisk) {
|
|
573
|
-
this.items.delete(filePath);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
cancelDeleteFilesFromDisk(filePaths) {
|
|
577
|
-
filePaths.forEach(filePath => {
|
|
578
|
-
const item = this.getItem(filePath);
|
|
579
|
-
if (item.isFile === true && item.queueDeleteFromDisk === true) {
|
|
580
|
-
item.queueDeleteFromDisk = false;
|
|
581
|
-
}
|
|
582
|
-
});
|
|
583
|
-
}
|
|
584
|
-
cancelDeleteDirectoriesFromDisk(dirPaths) {
|
|
585
|
-
dirPaths.forEach(dirPath => {
|
|
586
|
-
const item = this.getItem(dirPath);
|
|
587
|
-
if (item.queueDeleteFromDisk === true) {
|
|
588
|
-
item.queueDeleteFromDisk = false;
|
|
589
|
-
}
|
|
590
|
-
});
|
|
591
|
-
}
|
|
592
|
-
getItem(itemPath) {
|
|
593
|
-
itemPath = normalizePath(itemPath);
|
|
594
|
-
let item = this.items.get(itemPath);
|
|
595
|
-
if (item != null) {
|
|
596
|
-
return item;
|
|
597
|
-
}
|
|
598
|
-
this.items.set(itemPath, item = {
|
|
599
|
-
exists: null,
|
|
600
|
-
fileText: null,
|
|
601
|
-
size: null,
|
|
602
|
-
mtimeMs: null,
|
|
603
|
-
isDirectory: null,
|
|
604
|
-
isFile: null,
|
|
605
|
-
queueCopyFileToDest: null,
|
|
606
|
-
queueDeleteFromDisk: null,
|
|
607
|
-
queueWriteToDisk: null,
|
|
608
|
-
useCache: null
|
|
609
|
-
});
|
|
610
|
-
return item;
|
|
611
|
-
}
|
|
612
|
-
clearCache() {
|
|
613
|
-
this.items.clear();
|
|
614
|
-
}
|
|
615
|
-
get keys() {
|
|
616
|
-
return Array.from(this.items.keys()).sort();
|
|
617
|
-
}
|
|
618
|
-
getMemoryStats() {
|
|
619
|
-
return `data length: ${this.items.size}`;
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
const getCommitInstructions = (path, d) => {
|
|
623
|
-
const instructions = {
|
|
624
|
-
filesToDelete: [],
|
|
625
|
-
filesToWrite: [],
|
|
626
|
-
filesToCopy: [],
|
|
627
|
-
dirsToDelete: [],
|
|
628
|
-
dirsToEnsure: []
|
|
629
|
-
};
|
|
630
|
-
d.forEach((item, itemPath) => {
|
|
631
|
-
if (item.queueWriteToDisk === true) {
|
|
632
|
-
if (item.isFile === true) {
|
|
633
|
-
instructions.filesToWrite.push(itemPath);
|
|
634
|
-
const dir = normalizePath(path.dirname(itemPath));
|
|
635
|
-
if (!instructions.dirsToEnsure.includes(dir)) {
|
|
636
|
-
instructions.dirsToEnsure.push(dir);
|
|
637
|
-
}
|
|
638
|
-
const dirDeleteIndex = instructions.dirsToDelete.indexOf(dir);
|
|
639
|
-
if (dirDeleteIndex > -1) {
|
|
640
|
-
instructions.dirsToDelete.splice(dirDeleteIndex, 1);
|
|
641
|
-
}
|
|
642
|
-
const fileDeleteIndex = instructions.filesToDelete.indexOf(itemPath);
|
|
643
|
-
if (fileDeleteIndex > -1) {
|
|
644
|
-
instructions.filesToDelete.splice(fileDeleteIndex, 1);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
else if (item.isDirectory === true) {
|
|
648
|
-
if (!instructions.dirsToEnsure.includes(itemPath)) {
|
|
649
|
-
instructions.dirsToEnsure.push(itemPath);
|
|
650
|
-
}
|
|
651
|
-
const dirDeleteIndex = instructions.dirsToDelete.indexOf(itemPath);
|
|
652
|
-
if (dirDeleteIndex > -1) {
|
|
653
|
-
instructions.dirsToDelete.splice(dirDeleteIndex, 1);
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
else if (item.queueDeleteFromDisk === true) {
|
|
658
|
-
if (item.isDirectory && !instructions.dirsToEnsure.includes(itemPath)) {
|
|
659
|
-
instructions.dirsToDelete.push(itemPath);
|
|
660
|
-
}
|
|
661
|
-
else if (item.isFile && !instructions.filesToWrite.includes(itemPath)) {
|
|
662
|
-
instructions.filesToDelete.push(itemPath);
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
else if (typeof item.queueCopyFileToDest === 'string') {
|
|
666
|
-
const src = itemPath;
|
|
667
|
-
const dest = item.queueCopyFileToDest;
|
|
668
|
-
instructions.filesToCopy.push([src, dest]);
|
|
669
|
-
const dir = normalizePath(path.dirname(dest));
|
|
670
|
-
if (!instructions.dirsToEnsure.includes(dir)) {
|
|
671
|
-
instructions.dirsToEnsure.push(dir);
|
|
672
|
-
}
|
|
673
|
-
const dirDeleteIndex = instructions.dirsToDelete.indexOf(dir);
|
|
674
|
-
if (dirDeleteIndex > -1) {
|
|
675
|
-
instructions.dirsToDelete.splice(dirDeleteIndex, 1);
|
|
676
|
-
}
|
|
677
|
-
const fileDeleteIndex = instructions.filesToDelete.indexOf(dest);
|
|
678
|
-
if (fileDeleteIndex > -1) {
|
|
679
|
-
instructions.filesToDelete.splice(fileDeleteIndex, 1);
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
item.queueDeleteFromDisk = false;
|
|
683
|
-
item.queueWriteToDisk = false;
|
|
684
|
-
});
|
|
685
|
-
// add all the ancestor directories for each directory too
|
|
686
|
-
for (let i = 0, ilen = instructions.dirsToEnsure.length; i < ilen; i++) {
|
|
687
|
-
const segments = instructions.dirsToEnsure[i].split('/');
|
|
688
|
-
for (let j = 2; j < segments.length; j++) {
|
|
689
|
-
const dir = segments.slice(0, j).join('/');
|
|
690
|
-
if (instructions.dirsToEnsure.includes(dir) === false) {
|
|
691
|
-
instructions.dirsToEnsure.push(dir);
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
// sort directories so shortest paths are ensured first
|
|
696
|
-
instructions.dirsToEnsure.sort((a, b) => {
|
|
697
|
-
const segmentsA = a.split('/').length;
|
|
698
|
-
const segmentsB = b.split('/').length;
|
|
699
|
-
if (segmentsA < segmentsB)
|
|
700
|
-
return -1;
|
|
701
|
-
if (segmentsA > segmentsB)
|
|
702
|
-
return 1;
|
|
703
|
-
if (a.length < b.length)
|
|
704
|
-
return -1;
|
|
705
|
-
if (a.length > b.length)
|
|
706
|
-
return 1;
|
|
707
|
-
return 0;
|
|
708
|
-
});
|
|
709
|
-
// sort directories so longest paths are removed first
|
|
710
|
-
instructions.dirsToDelete.sort((a, b) => {
|
|
711
|
-
const segmentsA = a.split('/').length;
|
|
712
|
-
const segmentsB = b.split('/').length;
|
|
713
|
-
if (segmentsA < segmentsB)
|
|
714
|
-
return 1;
|
|
715
|
-
if (segmentsA > segmentsB)
|
|
716
|
-
return -1;
|
|
717
|
-
if (a.length < b.length)
|
|
718
|
-
return 1;
|
|
719
|
-
if (a.length > b.length)
|
|
720
|
-
return -1;
|
|
721
|
-
return 0;
|
|
722
|
-
});
|
|
723
|
-
instructions.dirsToEnsure.forEach(dirToEnsure => {
|
|
724
|
-
const i = instructions.dirsToDelete.indexOf(dirToEnsure);
|
|
725
|
-
if (i > -1) {
|
|
726
|
-
instructions.dirsToDelete.splice(i, 1);
|
|
727
|
-
}
|
|
728
|
-
});
|
|
729
|
-
instructions.dirsToDelete = instructions.dirsToDelete.filter(dir => {
|
|
730
|
-
if (dir === '/' || dir.endsWith(':/') === true) {
|
|
731
|
-
return false;
|
|
732
|
-
}
|
|
733
|
-
return true;
|
|
734
|
-
});
|
|
735
|
-
instructions.dirsToEnsure = instructions.dirsToEnsure.filter(dir => {
|
|
736
|
-
const item = d.get(dir);
|
|
737
|
-
if (item != null && item.exists === true && item.isDirectory === true) {
|
|
738
|
-
return false;
|
|
739
|
-
}
|
|
740
|
-
if (dir === '/' || dir.endsWith(':/')) {
|
|
741
|
-
return false;
|
|
742
|
-
}
|
|
743
|
-
return true;
|
|
744
|
-
});
|
|
745
|
-
return instructions;
|
|
746
|
-
};
|
|
747
|
-
const shouldIgnore = (filePath) => {
|
|
748
|
-
filePath = filePath.trim().toLowerCase();
|
|
749
|
-
return IGNORE.some(ignoreFile => filePath.endsWith(ignoreFile));
|
|
750
|
-
};
|
|
751
|
-
const isTextFile = (filePath) => {
|
|
752
|
-
filePath = filePath.toLowerCase().trim();
|
|
753
|
-
return TXT_EXT.some(ext => filePath.endsWith(ext));
|
|
754
|
-
};
|
|
755
|
-
const TXT_EXT = [
|
|
756
|
-
'.ts', '.tsx', '.js', '.jsx', '.svg',
|
|
757
|
-
'.html', '.txt', '.md', '.markdown', '.json',
|
|
758
|
-
'.css', '.scss', '.sass', '.less', '.styl'
|
|
759
|
-
];
|
|
760
|
-
const IGNORE = [
|
|
761
|
-
'.ds_store',
|
|
762
|
-
'.gitignore',
|
|
763
|
-
'desktop.ini',
|
|
764
|
-
'thumbs.db'
|
|
765
|
-
];
|
|
766
|
-
// only cache if it's less than 5MB-ish (using .length as a rough guess)
|
|
767
|
-
// why 5MB? idk, seems like a good number for source text
|
|
768
|
-
// it's pretty darn large to cover almost ALL legitimate source files
|
|
769
|
-
// and anything larger is probably a REALLY large file and a rare case
|
|
770
|
-
// which we don't need to eat up memory for
|
|
771
|
-
const MAX_TEXT_CACHE = 5242880;
|
|
772
|
-
|
|
773
|
-
const normalizeDiagnostics = (compilerCtx, diagnostics) => {
|
|
774
|
-
const normalizedErrors = [];
|
|
775
|
-
const normalizedOthers = [];
|
|
776
|
-
const dups = new Set();
|
|
777
|
-
for (let i = 0; i < diagnostics.length; i++) {
|
|
778
|
-
const d = normalizeDiagnostic(compilerCtx, diagnostics[i]);
|
|
779
|
-
const key = d.absFilePath + d.code + d.messageText + d.type;
|
|
780
|
-
if (dups.has(key)) {
|
|
781
|
-
continue;
|
|
782
|
-
}
|
|
783
|
-
dups.add(key);
|
|
784
|
-
const total = normalizedErrors.length + normalizedOthers.length;
|
|
785
|
-
if (d.level === 'error') {
|
|
786
|
-
normalizedErrors.push(d);
|
|
787
|
-
}
|
|
788
|
-
else if (total < MAX_ERRORS) {
|
|
789
|
-
normalizedOthers.push(d);
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
return [
|
|
793
|
-
...normalizedErrors,
|
|
794
|
-
...normalizedOthers
|
|
795
|
-
];
|
|
796
|
-
};
|
|
797
|
-
const normalizeDiagnostic = (compilerCtx, diagnostic) => {
|
|
798
|
-
if (diagnostic.messageText) {
|
|
799
|
-
if (typeof diagnostic.messageText.message === 'string') {
|
|
800
|
-
diagnostic.messageText = diagnostic.messageText.message;
|
|
801
|
-
}
|
|
802
|
-
else if (typeof diagnostic.messageText === 'string' && diagnostic.messageText.indexOf('Error: ') === 0) {
|
|
803
|
-
diagnostic.messageText = diagnostic.messageText.substr(7);
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
if (diagnostic.messageText) {
|
|
807
|
-
if (diagnostic.messageText.includes(`Cannot find name 'h'`)) {
|
|
808
|
-
diagnostic.header = `Missing "h" import for JSX types`;
|
|
809
|
-
diagnostic.messageText = `In order to load accurate JSX types for components, the "h" function must be imported from "@rindo/core" by each component using JSX. For example: import { Component, h } from '@rindo/core';`;
|
|
810
|
-
try {
|
|
811
|
-
const sourceText = compilerCtx.fs.readFileSync(diagnostic.absFilePath);
|
|
812
|
-
const srcLines = splitLineBreaks(sourceText);
|
|
813
|
-
for (let i = 0; i < srcLines.length; i++) {
|
|
814
|
-
const srcLine = srcLines[i];
|
|
815
|
-
if (srcLine.includes('@rindo/core')) {
|
|
816
|
-
const msgLines = [];
|
|
817
|
-
const beforeLineIndex = i - 1;
|
|
818
|
-
if (beforeLineIndex > -1) {
|
|
819
|
-
const beforeLine = {
|
|
820
|
-
lineIndex: beforeLineIndex,
|
|
821
|
-
lineNumber: beforeLineIndex + 1,
|
|
822
|
-
text: srcLines[beforeLineIndex],
|
|
823
|
-
errorCharStart: -1,
|
|
824
|
-
errorLength: -1
|
|
825
|
-
};
|
|
826
|
-
msgLines.push(beforeLine);
|
|
827
|
-
}
|
|
828
|
-
const errorLine = {
|
|
829
|
-
lineIndex: i,
|
|
830
|
-
lineNumber: i + 1,
|
|
831
|
-
text: srcLine,
|
|
832
|
-
errorCharStart: 0,
|
|
833
|
-
errorLength: -1
|
|
834
|
-
};
|
|
835
|
-
msgLines.push(errorLine);
|
|
836
|
-
diagnostic.lineNumber = errorLine.lineNumber;
|
|
837
|
-
diagnostic.columnNumber = srcLine.indexOf('}');
|
|
838
|
-
const afterLineIndex = i + 1;
|
|
839
|
-
if (afterLineIndex < srcLines.length) {
|
|
840
|
-
const afterLine = {
|
|
841
|
-
lineIndex: afterLineIndex,
|
|
842
|
-
lineNumber: afterLineIndex + 1,
|
|
843
|
-
text: srcLines[afterLineIndex],
|
|
844
|
-
errorCharStart: -1,
|
|
845
|
-
errorLength: -1
|
|
846
|
-
};
|
|
847
|
-
msgLines.push(afterLine);
|
|
848
|
-
}
|
|
849
|
-
diagnostic.lines = msgLines;
|
|
850
|
-
break;
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
catch (e) { }
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
return diagnostic;
|
|
858
|
-
};
|
|
859
|
-
const splitLineBreaks = (sourceText) => {
|
|
860
|
-
if (typeof sourceText !== 'string')
|
|
861
|
-
return [];
|
|
862
|
-
sourceText = sourceText.replace(/\\r/g, '\n');
|
|
863
|
-
return sourceText.split('\n');
|
|
864
|
-
};
|
|
865
|
-
const escapeHtml = (unsafe) => {
|
|
866
|
-
if (unsafe === undefined)
|
|
867
|
-
return 'undefined';
|
|
868
|
-
if (unsafe === null)
|
|
869
|
-
return 'null';
|
|
870
|
-
if (typeof unsafe !== 'string') {
|
|
871
|
-
unsafe = unsafe.toString();
|
|
872
|
-
}
|
|
873
|
-
return unsafe
|
|
874
|
-
.replace(/&/g, '&')
|
|
875
|
-
.replace(/</g, '<')
|
|
876
|
-
.replace(/>/g, '>')
|
|
877
|
-
.replace(/"/g, '"')
|
|
878
|
-
.replace(/'/g, ''');
|
|
879
|
-
};
|
|
880
|
-
const MAX_ERRORS = 25;
|
|
881
|
-
|
|
882
|
-
function loadMinifyJsDiagnostics(sourceText, result, diagnostics) {
|
|
883
|
-
if (!result || !result.error) {
|
|
884
|
-
return;
|
|
885
|
-
}
|
|
886
|
-
const d = {
|
|
887
|
-
level: 'error',
|
|
888
|
-
type: 'build',
|
|
889
|
-
language: 'javascript',
|
|
890
|
-
header: 'Minify JS',
|
|
891
|
-
code: '',
|
|
892
|
-
messageText: result.error.message,
|
|
893
|
-
absFilePath: null,
|
|
894
|
-
relFilePath: null,
|
|
895
|
-
lines: []
|
|
896
|
-
};
|
|
897
|
-
if (typeof result.error.line === 'number' && result.error.line > -1) {
|
|
898
|
-
const srcLines = splitLineBreaks(sourceText);
|
|
899
|
-
const errorLine = {
|
|
900
|
-
lineIndex: result.error.line - 1,
|
|
901
|
-
lineNumber: result.error.line,
|
|
902
|
-
text: srcLines[result.error.line - 1],
|
|
903
|
-
errorCharStart: result.error.col,
|
|
904
|
-
errorLength: 0
|
|
905
|
-
};
|
|
906
|
-
d.lineNumber = errorLine.lineNumber;
|
|
907
|
-
d.columnNumber = errorLine.errorCharStart;
|
|
908
|
-
const highlightLine = errorLine.text.substr(d.columnNumber);
|
|
909
|
-
for (let i = 0; i < highlightLine.length; i++) {
|
|
910
|
-
if (CHAR_BREAK.includes(highlightLine.charAt(i))) {
|
|
911
|
-
break;
|
|
912
|
-
}
|
|
913
|
-
errorLine.errorLength++;
|
|
914
|
-
}
|
|
915
|
-
d.lines.push(errorLine);
|
|
916
|
-
if (errorLine.errorLength === 0 && errorLine.errorCharStart > 0) {
|
|
917
|
-
errorLine.errorLength = 1;
|
|
918
|
-
errorLine.errorCharStart--;
|
|
919
|
-
}
|
|
920
|
-
if (errorLine.lineIndex > 0) {
|
|
921
|
-
const previousLine = {
|
|
922
|
-
lineIndex: errorLine.lineIndex - 1,
|
|
923
|
-
lineNumber: errorLine.lineNumber - 1,
|
|
924
|
-
text: srcLines[errorLine.lineIndex - 1],
|
|
925
|
-
errorCharStart: -1,
|
|
926
|
-
errorLength: -1
|
|
927
|
-
};
|
|
928
|
-
d.lines.unshift(previousLine);
|
|
929
|
-
}
|
|
930
|
-
if (errorLine.lineIndex + 1 < srcLines.length) {
|
|
931
|
-
const nextLine = {
|
|
932
|
-
lineIndex: errorLine.lineIndex + 1,
|
|
933
|
-
lineNumber: errorLine.lineNumber + 1,
|
|
934
|
-
text: srcLines[errorLine.lineIndex + 1],
|
|
935
|
-
errorCharStart: -1,
|
|
936
|
-
errorLength: -1
|
|
937
|
-
};
|
|
938
|
-
d.lines.push(nextLine);
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
diagnostics.push(d);
|
|
942
|
-
}
|
|
943
|
-
const CHAR_BREAK = [' ', '=', '.', ',', '?', ':', ';', '(', ')', '{', '}', '[', ']', '|', `'`, `"`, '`'];
|
|
944
|
-
|
|
945
|
-
const buildError = (diagnostics) => {
|
|
946
|
-
const diagnostic = {
|
|
947
|
-
level: 'error',
|
|
948
|
-
type: 'build',
|
|
949
|
-
header: 'Build Error',
|
|
950
|
-
messageText: 'build error',
|
|
951
|
-
relFilePath: null,
|
|
952
|
-
absFilePath: null,
|
|
953
|
-
lines: []
|
|
954
|
-
};
|
|
955
|
-
diagnostics.push(diagnostic);
|
|
956
|
-
return diagnostic;
|
|
957
|
-
};
|
|
958
|
-
const buildWarn = (diagnostics) => {
|
|
959
|
-
const diagnostic = {
|
|
960
|
-
level: 'warn',
|
|
961
|
-
type: 'build',
|
|
962
|
-
header: 'Build Warn',
|
|
963
|
-
messageText: 'build warn',
|
|
964
|
-
relFilePath: null,
|
|
965
|
-
absFilePath: null,
|
|
966
|
-
lines: []
|
|
967
|
-
};
|
|
968
|
-
diagnostics.push(diagnostic);
|
|
969
|
-
return diagnostic;
|
|
970
|
-
};
|
|
971
|
-
const buildJsonFileError = (compilerCtx, diagnostics, jsonFilePath, msg, pkgKey) => {
|
|
972
|
-
const err = buildError(diagnostics);
|
|
973
|
-
err.messageText = msg;
|
|
974
|
-
err.absFilePath = jsonFilePath;
|
|
975
|
-
if (typeof pkgKey === 'string') {
|
|
976
|
-
try {
|
|
977
|
-
const jsonStr = compilerCtx.fs.readFileSync(jsonFilePath);
|
|
978
|
-
const lines = jsonStr.replace(/\r/g, '\n').split('\n');
|
|
979
|
-
for (let i = 0; i < lines.length; i++) {
|
|
980
|
-
const txtLine = lines[i];
|
|
981
|
-
const txtIndex = txtLine.indexOf(pkgKey);
|
|
982
|
-
if (txtIndex > -1) {
|
|
983
|
-
const warnLine = {
|
|
984
|
-
lineIndex: i,
|
|
985
|
-
lineNumber: i + 1,
|
|
986
|
-
text: txtLine,
|
|
987
|
-
errorCharStart: txtIndex,
|
|
988
|
-
errorLength: pkgKey.length
|
|
989
|
-
};
|
|
990
|
-
err.lineNumber = warnLine.lineNumber;
|
|
991
|
-
err.columnNumber = txtIndex + 1;
|
|
992
|
-
err.lines.push(warnLine);
|
|
993
|
-
if (i >= 0) {
|
|
994
|
-
const beforeWarnLine = {
|
|
995
|
-
lineIndex: warnLine.lineIndex - 1,
|
|
996
|
-
lineNumber: warnLine.lineNumber - 1,
|
|
997
|
-
text: lines[i - 1],
|
|
998
|
-
errorCharStart: -1,
|
|
999
|
-
errorLength: -1
|
|
1000
|
-
};
|
|
1001
|
-
err.lines.unshift(beforeWarnLine);
|
|
1002
|
-
}
|
|
1003
|
-
if (i < lines.length) {
|
|
1004
|
-
const afterWarnLine = {
|
|
1005
|
-
lineIndex: warnLine.lineIndex + 1,
|
|
1006
|
-
lineNumber: warnLine.lineNumber + 1,
|
|
1007
|
-
text: lines[i + 1],
|
|
1008
|
-
errorCharStart: -1,
|
|
1009
|
-
errorLength: -1
|
|
1010
|
-
};
|
|
1011
|
-
err.lines.push(afterWarnLine);
|
|
1012
|
-
}
|
|
1013
|
-
break;
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
catch (e) { }
|
|
1018
|
-
}
|
|
1019
|
-
return err;
|
|
1020
|
-
};
|
|
1021
|
-
const catchError = (diagnostics, err, msg) => {
|
|
1022
|
-
const diagnostic = {
|
|
1023
|
-
level: 'error',
|
|
1024
|
-
type: 'build',
|
|
1025
|
-
header: 'Build Error',
|
|
1026
|
-
messageText: 'build error',
|
|
1027
|
-
relFilePath: null,
|
|
1028
|
-
absFilePath: null,
|
|
1029
|
-
lines: []
|
|
1030
|
-
};
|
|
1031
|
-
if (typeof msg === 'string') {
|
|
1032
|
-
diagnostic.messageText = msg;
|
|
1033
|
-
}
|
|
1034
|
-
else if (err != null) {
|
|
1035
|
-
if (err.stack != null) {
|
|
1036
|
-
diagnostic.messageText = err.stack.toString();
|
|
1037
|
-
}
|
|
1038
|
-
else {
|
|
1039
|
-
if (err.message != null) {
|
|
1040
|
-
diagnostic.messageText = err.message.toString();
|
|
1041
|
-
}
|
|
1042
|
-
else {
|
|
1043
|
-
diagnostic.messageText = err.toString();
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
if (diagnostics != null && !shouldIgnoreError(diagnostic.messageText)) {
|
|
1048
|
-
diagnostics.push(diagnostic);
|
|
1049
|
-
}
|
|
1050
|
-
return diagnostic;
|
|
1051
|
-
};
|
|
1052
|
-
const hasError = (diagnostics) => {
|
|
1053
|
-
if (diagnostics == null || diagnostics.length === 0) {
|
|
1054
|
-
return false;
|
|
1055
|
-
}
|
|
1056
|
-
return diagnostics.some(d => d.level === 'error' && d.type !== 'runtime');
|
|
1057
|
-
};
|
|
1058
|
-
const hasWarning = (diagnostics) => {
|
|
1059
|
-
if (diagnostics == null || diagnostics.length === 0) {
|
|
1060
|
-
return false;
|
|
1061
|
-
}
|
|
1062
|
-
return diagnostics.some(d => d.level === 'warn');
|
|
1063
|
-
};
|
|
1064
|
-
const shouldIgnoreError = (msg) => {
|
|
1065
|
-
return (msg === TASK_CANCELED_MSG);
|
|
1066
|
-
};
|
|
1067
|
-
const TASK_CANCELED_MSG = `task canceled`;
|
|
1068
|
-
|
|
1069
|
-
const loadRollupDiagnostics = (compilerCtx, buildCtx, rollupError) => {
|
|
1070
|
-
const diagnostic = {
|
|
1071
|
-
level: 'error',
|
|
1072
|
-
type: 'bundling',
|
|
1073
|
-
language: 'javascript',
|
|
1074
|
-
code: rollupError.code,
|
|
1075
|
-
header: `Rollup: ${formatErrorCode(rollupError.code)}`,
|
|
1076
|
-
messageText: rollupError.message || '',
|
|
1077
|
-
relFilePath: null,
|
|
1078
|
-
absFilePath: null,
|
|
1079
|
-
lines: []
|
|
1080
|
-
};
|
|
1081
|
-
if (rollupError.plugin) {
|
|
1082
|
-
diagnostic.messageText += ` (plugin: ${rollupError.plugin}${rollupError.hook ? `, ${rollupError.hook}` : ''})`;
|
|
1083
|
-
}
|
|
1084
|
-
if (rollupError.loc != null && typeof rollupError.loc.file === 'string') {
|
|
1085
|
-
diagnostic.absFilePath = rollupError.loc.file;
|
|
1086
|
-
try {
|
|
1087
|
-
const sourceText = compilerCtx.fs.readFileSync(diagnostic.absFilePath);
|
|
1088
|
-
try {
|
|
1089
|
-
const srcLines = splitLineBreaks(sourceText);
|
|
1090
|
-
const errorLine = {
|
|
1091
|
-
lineIndex: rollupError.loc.line - 1,
|
|
1092
|
-
lineNumber: rollupError.loc.line,
|
|
1093
|
-
text: srcLines[rollupError.loc.line - 1],
|
|
1094
|
-
errorCharStart: rollupError.loc.column,
|
|
1095
|
-
errorLength: 0
|
|
1096
|
-
};
|
|
1097
|
-
diagnostic.lineNumber = errorLine.lineNumber;
|
|
1098
|
-
diagnostic.columnNumber = errorLine.errorCharStart;
|
|
1099
|
-
const highlightLine = errorLine.text.substr(rollupError.loc.column);
|
|
1100
|
-
for (let i = 0; i < highlightLine.length; i++) {
|
|
1101
|
-
if (charBreak.has(highlightLine.charAt(i))) {
|
|
1102
|
-
break;
|
|
1103
|
-
}
|
|
1104
|
-
errorLine.errorLength++;
|
|
1105
|
-
}
|
|
1106
|
-
diagnostic.lines.push(errorLine);
|
|
1107
|
-
if (errorLine.errorLength === 0 && errorLine.errorCharStart > 0) {
|
|
1108
|
-
errorLine.errorLength = 1;
|
|
1109
|
-
errorLine.errorCharStart--;
|
|
1110
|
-
}
|
|
1111
|
-
if (errorLine.lineIndex > 0) {
|
|
1112
|
-
const previousLine = {
|
|
1113
|
-
lineIndex: errorLine.lineIndex - 1,
|
|
1114
|
-
lineNumber: errorLine.lineNumber - 1,
|
|
1115
|
-
text: srcLines[errorLine.lineIndex - 1],
|
|
1116
|
-
errorCharStart: -1,
|
|
1117
|
-
errorLength: -1
|
|
1118
|
-
};
|
|
1119
|
-
diagnostic.lines.unshift(previousLine);
|
|
1120
|
-
}
|
|
1121
|
-
if (errorLine.lineIndex + 1 < srcLines.length) {
|
|
1122
|
-
const nextLine = {
|
|
1123
|
-
lineIndex: errorLine.lineIndex + 1,
|
|
1124
|
-
lineNumber: errorLine.lineNumber + 1,
|
|
1125
|
-
text: srcLines[errorLine.lineIndex + 1],
|
|
1126
|
-
errorCharStart: -1,
|
|
1127
|
-
errorLength: -1
|
|
1128
|
-
};
|
|
1129
|
-
diagnostic.lines.push(nextLine);
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
catch (e) {
|
|
1133
|
-
diagnostic.messageText = `Error parsing: ${diagnostic.absFilePath}, line: ${rollupError.loc.line}, column: ${rollupError.loc.column}`;
|
|
1134
|
-
diagnostic.debugText = sourceText;
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
catch (e) { }
|
|
1138
|
-
}
|
|
1139
|
-
buildCtx.diagnostics.push(diagnostic);
|
|
1140
|
-
};
|
|
1141
|
-
const createOnWarnFn = (diagnostics, bundleModulesFiles) => {
|
|
1142
|
-
const previousWarns = new Set();
|
|
1143
|
-
return function onWarningMessage(warning) {
|
|
1144
|
-
if (warning == null || ignoreWarnCodes.has(warning.code) || previousWarns.has(warning.message)) {
|
|
1145
|
-
return;
|
|
1146
|
-
}
|
|
1147
|
-
previousWarns.add(warning.message);
|
|
1148
|
-
let label = '';
|
|
1149
|
-
if (bundleModulesFiles) {
|
|
1150
|
-
label = bundleModulesFiles.reduce((cmps, m) => {
|
|
1151
|
-
cmps.push(...m.cmps);
|
|
1152
|
-
return cmps;
|
|
1153
|
-
}, []).join(', ').trim();
|
|
1154
|
-
if (label.length) {
|
|
1155
|
-
label += ': ';
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
const diagnostic = buildWarn(diagnostics);
|
|
1159
|
-
diagnostic.header = `Bundling Warning ${warning.code}`;
|
|
1160
|
-
diagnostic.messageText = label + (warning.message || warning);
|
|
1161
|
-
};
|
|
1162
|
-
};
|
|
1163
|
-
const ignoreWarnCodes = new Set([
|
|
1164
|
-
'THIS_IS_UNDEFINED',
|
|
1165
|
-
'NON_EXISTENT_EXPORT',
|
|
1166
|
-
'CIRCULAR_DEPENDENCY',
|
|
1167
|
-
'EMPTY_BUNDLE',
|
|
1168
|
-
'UNUSED_EXTERNAL_IMPORT'
|
|
1169
|
-
]);
|
|
1170
|
-
const charBreak = new Set([' ', '=', '.', ',', '?', ':', ';', '(', ')', '{', '}', '[', ']', '|', `'`, `"`, '`']);
|
|
1171
|
-
const formatErrorCode = (errorCode) => {
|
|
1172
|
-
if (typeof errorCode === 'string') {
|
|
1173
|
-
return errorCode.split('_').map(c => {
|
|
1174
|
-
return toTitleCase(c.toLowerCase());
|
|
1175
|
-
}).join(' ');
|
|
1176
|
-
}
|
|
1177
|
-
return errorCode || '';
|
|
1178
|
-
};
|
|
1179
|
-
|
|
1180
|
-
const augmentDiagnosticWithNode = (config, d, node) => {
|
|
1181
|
-
if (!node) {
|
|
1182
|
-
return d;
|
|
1183
|
-
}
|
|
1184
|
-
const sourceFile = node.getSourceFile();
|
|
1185
|
-
if (!sourceFile) {
|
|
1186
|
-
return d;
|
|
1187
|
-
}
|
|
1188
|
-
d.absFilePath = normalizePath(sourceFile.fileName);
|
|
1189
|
-
d.relFilePath = normalizePath(config.sys.path.relative(config.rootDir, sourceFile.fileName));
|
|
1190
|
-
const sourceText = sourceFile.text;
|
|
1191
|
-
const srcLines = splitLineBreaks(sourceText);
|
|
1192
|
-
const start = node.getStart();
|
|
1193
|
-
const end = node.getEnd();
|
|
1194
|
-
const posStart = sourceFile.getLineAndCharacterOfPosition(start);
|
|
1195
|
-
const errorLine = {
|
|
1196
|
-
lineIndex: posStart.line,
|
|
1197
|
-
lineNumber: posStart.line + 1,
|
|
1198
|
-
text: srcLines[posStart.line],
|
|
1199
|
-
errorCharStart: posStart.character,
|
|
1200
|
-
errorLength: Math.max(end - start, 1)
|
|
1201
|
-
};
|
|
1202
|
-
d.lineNumber = errorLine.lineNumber;
|
|
1203
|
-
d.columnNumber = errorLine.errorCharStart + 1;
|
|
1204
|
-
d.lines.push(errorLine);
|
|
1205
|
-
if (errorLine.errorLength === 0 && errorLine.errorCharStart > 0) {
|
|
1206
|
-
errorLine.errorLength = 1;
|
|
1207
|
-
errorLine.errorCharStart--;
|
|
1208
|
-
}
|
|
1209
|
-
if (errorLine.lineIndex > 0) {
|
|
1210
|
-
const previousLine = {
|
|
1211
|
-
lineIndex: errorLine.lineIndex - 1,
|
|
1212
|
-
lineNumber: errorLine.lineNumber - 1,
|
|
1213
|
-
text: srcLines[errorLine.lineIndex - 1],
|
|
1214
|
-
errorCharStart: -1,
|
|
1215
|
-
errorLength: -1
|
|
1216
|
-
};
|
|
1217
|
-
d.lines.unshift(previousLine);
|
|
1218
|
-
}
|
|
1219
|
-
if (errorLine.lineIndex + 1 < srcLines.length) {
|
|
1220
|
-
const nextLine = {
|
|
1221
|
-
lineIndex: errorLine.lineIndex + 1,
|
|
1222
|
-
lineNumber: errorLine.lineNumber + 1,
|
|
1223
|
-
text: srcLines[errorLine.lineIndex + 1],
|
|
1224
|
-
errorCharStart: -1,
|
|
1225
|
-
errorLength: -1
|
|
1226
|
-
};
|
|
1227
|
-
d.lines.push(nextLine);
|
|
1228
|
-
}
|
|
1229
|
-
return d;
|
|
1230
|
-
};
|
|
1231
|
-
/**
|
|
1232
|
-
* Ok, so formatting overkill, we know. But whatever, it makes for great
|
|
1233
|
-
* error reporting within a terminal. So, yeah, let's code it up, shall we?
|
|
1234
|
-
*/
|
|
1235
|
-
const loadTypeScriptDiagnostics = (tsDiagnostics) => {
|
|
1236
|
-
const diagnostics = [];
|
|
1237
|
-
const maxErrors = Math.min(tsDiagnostics.length, 50);
|
|
1238
|
-
for (let i = 0; i < maxErrors; i++) {
|
|
1239
|
-
diagnostics.push(loadTypeScriptDiagnostic(tsDiagnostics[i]));
|
|
1240
|
-
}
|
|
1241
|
-
return diagnostics;
|
|
1242
|
-
};
|
|
1243
|
-
const loadTypeScriptDiagnostic = (tsDiagnostic) => {
|
|
1244
|
-
const d = {
|
|
1245
|
-
level: 'warn',
|
|
1246
|
-
type: 'typescript',
|
|
1247
|
-
language: 'typescript',
|
|
1248
|
-
header: 'TypeScript',
|
|
1249
|
-
code: tsDiagnostic.code.toString(),
|
|
1250
|
-
messageText: flattenDiagnosticMessageText(tsDiagnostic, tsDiagnostic.messageText),
|
|
1251
|
-
relFilePath: null,
|
|
1252
|
-
absFilePath: null,
|
|
1253
|
-
lines: []
|
|
1254
|
-
};
|
|
1255
|
-
if (tsDiagnostic.category === 1) {
|
|
1256
|
-
d.level = 'error';
|
|
1257
|
-
}
|
|
1258
|
-
if (tsDiagnostic.file) {
|
|
1259
|
-
d.absFilePath = tsDiagnostic.file.fileName;
|
|
1260
|
-
const sourceText = tsDiagnostic.file.text;
|
|
1261
|
-
const srcLines = splitLineBreaks(sourceText);
|
|
1262
|
-
const posData = tsDiagnostic.file.getLineAndCharacterOfPosition(tsDiagnostic.start);
|
|
1263
|
-
const errorLine = {
|
|
1264
|
-
lineIndex: posData.line,
|
|
1265
|
-
lineNumber: posData.line + 1,
|
|
1266
|
-
text: srcLines[posData.line],
|
|
1267
|
-
errorCharStart: posData.character,
|
|
1268
|
-
errorLength: Math.max(tsDiagnostic.length, 1)
|
|
1269
|
-
};
|
|
1270
|
-
d.lineNumber = errorLine.lineNumber;
|
|
1271
|
-
d.columnNumber = errorLine.errorCharStart + 1;
|
|
1272
|
-
d.lines.push(errorLine);
|
|
1273
|
-
if (errorLine.errorLength === 0 && errorLine.errorCharStart > 0) {
|
|
1274
|
-
errorLine.errorLength = 1;
|
|
1275
|
-
errorLine.errorCharStart--;
|
|
1276
|
-
}
|
|
1277
|
-
if (errorLine.lineIndex > 0) {
|
|
1278
|
-
const previousLine = {
|
|
1279
|
-
lineIndex: errorLine.lineIndex - 1,
|
|
1280
|
-
lineNumber: errorLine.lineNumber - 1,
|
|
1281
|
-
text: srcLines[errorLine.lineIndex - 1],
|
|
1282
|
-
errorCharStart: -1,
|
|
1283
|
-
errorLength: -1
|
|
1284
|
-
};
|
|
1285
|
-
d.lines.unshift(previousLine);
|
|
1286
|
-
}
|
|
1287
|
-
if (errorLine.lineIndex + 1 < srcLines.length) {
|
|
1288
|
-
const nextLine = {
|
|
1289
|
-
lineIndex: errorLine.lineIndex + 1,
|
|
1290
|
-
lineNumber: errorLine.lineNumber + 1,
|
|
1291
|
-
text: srcLines[errorLine.lineIndex + 1],
|
|
1292
|
-
errorCharStart: -1,
|
|
1293
|
-
errorLength: -1
|
|
1294
|
-
};
|
|
1295
|
-
d.lines.push(nextLine);
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
return d;
|
|
1299
|
-
};
|
|
1300
|
-
const flattenDiagnosticMessageText = (tsDiagnostic, diag) => {
|
|
1301
|
-
if (typeof diag === 'string') {
|
|
1302
|
-
return diag;
|
|
1303
|
-
}
|
|
1304
|
-
else if (diag === undefined) {
|
|
1305
|
-
return '';
|
|
1306
|
-
}
|
|
1307
|
-
const ignoreCodes = [];
|
|
1308
|
-
const isRindoConfig = tsDiagnostic.file.fileName.includes('rindo.config');
|
|
1309
|
-
if (isRindoConfig) {
|
|
1310
|
-
ignoreCodes.push(2322);
|
|
1311
|
-
}
|
|
1312
|
-
let result = '';
|
|
1313
|
-
if (!ignoreCodes.includes(diag.code)) {
|
|
1314
|
-
result = diag.messageText;
|
|
1315
|
-
if (diag.next) {
|
|
1316
|
-
for (const kid of diag.next) {
|
|
1317
|
-
result += flattenDiagnosticMessageText(tsDiagnostic, kid);
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
}
|
|
1321
|
-
if (isRindoConfig) {
|
|
1322
|
-
result = result.replace(`type 'RindoConfig'`, `Rindo Config`);
|
|
1323
|
-
result = result.replace(`Object literal may only specify known properties, but `, ``);
|
|
1324
|
-
result = result.replace(`Object literal may only specify known properties, and `, ``);
|
|
1325
|
-
}
|
|
1326
|
-
return result.trim();
|
|
1327
|
-
};
|
|
1328
|
-
|
|
1329
|
-
const getFileExt = (fileName) => {
|
|
1330
|
-
if (typeof fileName === 'string') {
|
|
1331
|
-
const parts = fileName.split('.');
|
|
1332
|
-
if (parts.length > 1) {
|
|
1333
|
-
return parts[parts.length - 1].toLowerCase();
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
return null;
|
|
1337
|
-
};
|
|
1338
|
-
/**
|
|
1339
|
-
* Test if a file is a typescript source file, such as .ts or .tsx.
|
|
1340
|
-
* However, d.ts files and spec.ts files return false.
|
|
1341
|
-
* @param filePath
|
|
1342
|
-
*/
|
|
1343
|
-
const isTsFile = (filePath) => {
|
|
1344
|
-
const parts = filePath.toLowerCase().split('.');
|
|
1345
|
-
if (parts.length > 1) {
|
|
1346
|
-
if (parts[parts.length - 1] === 'ts' || parts[parts.length - 1] === 'tsx') {
|
|
1347
|
-
if (parts.length > 2 && (parts[parts.length - 2] === 'd' || parts[parts.length - 2] === 'spec')) {
|
|
1348
|
-
return false;
|
|
1349
|
-
}
|
|
1350
|
-
return true;
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
return false;
|
|
1354
|
-
};
|
|
1355
|
-
const isDtsFile = (filePath) => {
|
|
1356
|
-
const parts = filePath.toLowerCase().split('.');
|
|
1357
|
-
if (parts.length > 2) {
|
|
1358
|
-
return (parts[parts.length - 2] === 'd' && parts[parts.length - 1] === 'ts');
|
|
1359
|
-
}
|
|
1360
|
-
return false;
|
|
1361
|
-
};
|
|
1362
|
-
const isJsFile = (filePath) => {
|
|
1363
|
-
const parts = filePath.toLowerCase().split('.');
|
|
1364
|
-
if (parts.length > 1) {
|
|
1365
|
-
if (parts[parts.length - 1] === 'js') {
|
|
1366
|
-
if (parts.length > 2 && parts[parts.length - 2] === 'spec') {
|
|
1367
|
-
return false;
|
|
1368
|
-
}
|
|
1369
|
-
return true;
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
return false;
|
|
1373
|
-
};
|
|
1374
|
-
const hasFileExtension = (filePath, extensions) => {
|
|
1375
|
-
filePath = filePath.toLowerCase();
|
|
1376
|
-
return extensions.some(ext => filePath.endsWith('.' + ext));
|
|
1377
|
-
};
|
|
1378
|
-
const isCssFile = (filePath) => {
|
|
1379
|
-
return hasFileExtension(filePath, ['css']);
|
|
1380
|
-
};
|
|
1381
|
-
const isHtmlFile = (filePath) => {
|
|
1382
|
-
return hasFileExtension(filePath, ['html', 'htm']);
|
|
1383
|
-
};
|
|
1384
|
-
/**
|
|
1385
|
-
* Only web development text files, like ts, tsx,
|
|
1386
|
-
* js, html, css, scss, etc.
|
|
1387
|
-
* @param filePath
|
|
1388
|
-
*/
|
|
1389
|
-
const isWebDevFile = (filePath) => {
|
|
1390
|
-
return (hasFileExtension(filePath, WEB_DEV_EXT) || isTsFile(filePath));
|
|
1391
|
-
};
|
|
1392
|
-
const WEB_DEV_EXT = ['js', 'jsx', 'html', 'htm', 'css', 'scss', 'sass', 'less', 'styl', 'pcss'];
|
|
1393
|
-
const generatePreamble = (config, opts = {}) => {
|
|
1394
|
-
let preamble = [];
|
|
1395
|
-
if (config.preamble) {
|
|
1396
|
-
preamble = config.preamble.split('\n');
|
|
1397
|
-
}
|
|
1398
|
-
if (typeof opts.prefix === 'string') {
|
|
1399
|
-
opts.prefix.split('\n').forEach(c => {
|
|
1400
|
-
preamble.push(c);
|
|
1401
|
-
});
|
|
1402
|
-
}
|
|
1403
|
-
if (opts.defaultBanner === true) {
|
|
1404
|
-
preamble.push(BANNER);
|
|
1405
|
-
}
|
|
1406
|
-
if (typeof opts.suffix === 'string') {
|
|
1407
|
-
opts.suffix.split('\n').forEach(c => {
|
|
1408
|
-
preamble.push(c);
|
|
1409
|
-
});
|
|
1410
|
-
}
|
|
1411
|
-
if (preamble.length > 1) {
|
|
1412
|
-
preamble = preamble.map(l => ` * ${l}`);
|
|
1413
|
-
preamble.unshift(`/*!`);
|
|
1414
|
-
preamble.push(` */`);
|
|
1415
|
-
return preamble.join('\n');
|
|
1416
|
-
}
|
|
1417
|
-
if (opts.defaultBanner === true) {
|
|
1418
|
-
return `/*! ${BANNER} */`;
|
|
1419
|
-
}
|
|
1420
|
-
return '';
|
|
1421
|
-
};
|
|
1422
|
-
const isDocsPublic = (jsDocs) => {
|
|
1423
|
-
return !(jsDocs && jsDocs.tags.some((s) => s.name === 'internal'));
|
|
1424
|
-
};
|
|
1425
|
-
const lineBreakRegex = /\r?\n|\r/g;
|
|
1426
|
-
function getTextDocs(docs) {
|
|
1427
|
-
if (docs == null) {
|
|
1428
|
-
return '';
|
|
1429
|
-
}
|
|
1430
|
-
return `${docs.text.replace(lineBreakRegex, ' ')}
|
|
1431
|
-
${docs.tags
|
|
1432
|
-
.filter(tag => tag.name !== 'internal')
|
|
1433
|
-
.map(tag => `@${tag.name} ${(tag.text || '').replace(lineBreakRegex, ' ')}`)
|
|
1434
|
-
.join('\n')}`.trim();
|
|
1435
|
-
}
|
|
1436
|
-
const getDependencies = (buildCtx) => {
|
|
1437
|
-
if (buildCtx.packageJson != null && buildCtx.packageJson.dependencies != null) {
|
|
1438
|
-
return Object.keys(buildCtx.packageJson.dependencies)
|
|
1439
|
-
.filter(pkgName => !SKIP_DEPS.includes(pkgName));
|
|
1440
|
-
}
|
|
1441
|
-
return [];
|
|
1442
|
-
};
|
|
1443
|
-
const hasDependency = (buildCtx, depName) => {
|
|
1444
|
-
return getDependencies(buildCtx).includes(depName);
|
|
1445
|
-
};
|
|
1446
|
-
const getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
|
|
1447
|
-
const readPackageJson = async (config, compilerCtx, buildCtx) => {
|
|
1448
|
-
const pkgJsonPath = config.sys.path.join(config.rootDir, 'package.json');
|
|
1449
|
-
let pkgJson;
|
|
1450
|
-
try {
|
|
1451
|
-
pkgJson = await compilerCtx.fs.readFile(pkgJsonPath);
|
|
1452
|
-
}
|
|
1453
|
-
catch (e) {
|
|
1454
|
-
if (!config.outputTargets.some(o => o.type.includes('dist'))) {
|
|
1455
|
-
const diagnostic = buildError(buildCtx.diagnostics);
|
|
1456
|
-
diagnostic.header = `Missing "package.json"`;
|
|
1457
|
-
diagnostic.messageText = `Valid "package.json" file is required for distribution: ${pkgJsonPath}`;
|
|
1458
|
-
}
|
|
1459
|
-
return null;
|
|
1460
|
-
}
|
|
1461
|
-
let pkgData;
|
|
1462
|
-
try {
|
|
1463
|
-
pkgData = JSON.parse(pkgJson);
|
|
1464
|
-
}
|
|
1465
|
-
catch (e) {
|
|
1466
|
-
const diagnostic = buildError(buildCtx.diagnostics);
|
|
1467
|
-
diagnostic.header = `Error parsing "package.json"`;
|
|
1468
|
-
diagnostic.messageText = `${pkgJsonPath}, ${e}`;
|
|
1469
|
-
diagnostic.absFilePath = pkgJsonPath;
|
|
1470
|
-
return null;
|
|
1471
|
-
}
|
|
1472
|
-
buildCtx.packageJsonFilePath = pkgJsonPath;
|
|
1473
|
-
return pkgData;
|
|
1474
|
-
};
|
|
1475
|
-
const SKIP_DEPS = ['@rindo/core'];
|
|
1476
|
-
|
|
1477
|
-
const validateComponentTag = (tag) => {
|
|
1478
|
-
if (tag !== tag.trim()) {
|
|
1479
|
-
return `Tag can not contain white spaces`;
|
|
1480
|
-
}
|
|
1481
|
-
if (tag !== tag.toLowerCase()) {
|
|
1482
|
-
return `Tag can not contain upper case characters`;
|
|
1483
|
-
}
|
|
1484
|
-
if (typeof tag !== 'string') {
|
|
1485
|
-
return `Tag "${tag}" must be a string type`;
|
|
1486
|
-
}
|
|
1487
|
-
if (tag.length === 0) {
|
|
1488
|
-
return `Received empty tag value`;
|
|
1489
|
-
}
|
|
1490
|
-
if (tag.indexOf(' ') > -1) {
|
|
1491
|
-
return `"${tag}" tag cannot contain a space`;
|
|
1492
|
-
}
|
|
1493
|
-
if (tag.indexOf(',') > -1) {
|
|
1494
|
-
return `"${tag}" tag cannot be used for multiple tags`;
|
|
1495
|
-
}
|
|
1496
|
-
const invalidChars = tag.replace(/\w|-/g, '');
|
|
1497
|
-
if (invalidChars !== '') {
|
|
1498
|
-
return `"${tag}" tag contains invalid characters: ${invalidChars}`;
|
|
1499
|
-
}
|
|
1500
|
-
if (tag.indexOf('-') === -1) {
|
|
1501
|
-
return `"${tag}" tag must contain a dash (-) to work as a valid web component`;
|
|
1502
|
-
}
|
|
1503
|
-
if (tag.indexOf('--') > -1) {
|
|
1504
|
-
return `"${tag}" tag cannot contain multiple dashes (--) next to each other`;
|
|
1505
|
-
}
|
|
1506
|
-
if (tag.indexOf('-') === 0) {
|
|
1507
|
-
return `"${tag}" tag cannot start with a dash (-)`;
|
|
1508
|
-
}
|
|
1509
|
-
if (tag.lastIndexOf('-') === tag.length - 1) {
|
|
1510
|
-
return `"${tag}" tag cannot end with a dash (-)`;
|
|
1511
|
-
}
|
|
1512
|
-
return undefined;
|
|
1513
|
-
};
|
|
1514
|
-
|
|
1515
|
-
exports.BANNER = BANNER;
|
|
1516
|
-
exports.COLLECTION_MANIFEST_FILE_NAME = COLLECTION_MANIFEST_FILE_NAME;
|
|
1517
|
-
exports.DEFAULT_STYLE_MODE = DEFAULT_STYLE_MODE;
|
|
1518
|
-
exports.EMPTY_OBJ = EMPTY_OBJ;
|
|
1519
|
-
exports.HTML_NS = HTML_NS;
|
|
1520
|
-
exports.InMemoryFileSystem = InMemoryFileSystem;
|
|
1521
|
-
exports.MAX_ERRORS = MAX_ERRORS;
|
|
1522
|
-
exports.SVG_NS = SVG_NS;
|
|
1523
|
-
exports.TASK_CANCELED_MSG = TASK_CANCELED_MSG;
|
|
1524
|
-
exports.XLINK_NS = XLINK_NS;
|
|
1525
|
-
exports.XML_NS = XML_NS;
|
|
1526
|
-
exports.augmentDiagnosticWithNode = augmentDiagnosticWithNode;
|
|
1527
|
-
exports.buildError = buildError;
|
|
1528
|
-
exports.buildJsonFileError = buildJsonFileError;
|
|
1529
|
-
exports.buildWarn = buildWarn;
|
|
1530
|
-
exports.catchError = catchError;
|
|
1531
|
-
exports.createOnWarnFn = createOnWarnFn;
|
|
1532
|
-
exports.dashToPascalCase = dashToPascalCase;
|
|
1533
|
-
exports.escapeHtml = escapeHtml;
|
|
1534
|
-
exports.flatOne = flatOne;
|
|
1535
|
-
exports.fromEntries = fromEntries;
|
|
1536
|
-
exports.generatePreamble = generatePreamble;
|
|
1537
|
-
exports.getCommitInstructions = getCommitInstructions;
|
|
1538
|
-
exports.getDependencies = getDependencies;
|
|
1539
|
-
exports.getDynamicImportFunction = getDynamicImportFunction;
|
|
1540
|
-
exports.getFileExt = getFileExt;
|
|
1541
|
-
exports.getTextDocs = getTextDocs;
|
|
1542
|
-
exports.hasDependency = hasDependency;
|
|
1543
|
-
exports.hasError = hasError;
|
|
1544
|
-
exports.hasFileExtension = hasFileExtension;
|
|
1545
|
-
exports.hasWarning = hasWarning;
|
|
1546
|
-
exports.isComplexType = isComplexType;
|
|
1547
|
-
exports.isCssFile = isCssFile;
|
|
1548
|
-
exports.isDef = isDef;
|
|
1549
|
-
exports.isDocsPublic = isDocsPublic;
|
|
1550
|
-
exports.isDtsFile = isDtsFile;
|
|
1551
|
-
exports.isHtmlFile = isHtmlFile;
|
|
1552
|
-
exports.isJsFile = isJsFile;
|
|
1553
|
-
exports.isObject = isObject;
|
|
1554
|
-
exports.isTextFile = isTextFile;
|
|
1555
|
-
exports.isTsFile = isTsFile;
|
|
1556
|
-
exports.isWebDevFile = isWebDevFile;
|
|
1557
|
-
exports.loadMinifyJsDiagnostics = loadMinifyJsDiagnostics;
|
|
1558
|
-
exports.loadRollupDiagnostics = loadRollupDiagnostics;
|
|
1559
|
-
exports.loadTypeScriptDiagnostic = loadTypeScriptDiagnostic;
|
|
1560
|
-
exports.loadTypeScriptDiagnostics = loadTypeScriptDiagnostics;
|
|
1561
|
-
exports.noop = noop;
|
|
1562
|
-
exports.normalizeDiagnostics = normalizeDiagnostics;
|
|
1563
|
-
exports.normalizePath = normalizePath;
|
|
1564
|
-
exports.pluck = pluck;
|
|
1565
|
-
exports.readPackageJson = readPackageJson;
|
|
1566
|
-
exports.relativeImport = relativeImport;
|
|
1567
|
-
exports.shouldIgnore = shouldIgnore;
|
|
1568
|
-
exports.shouldIgnoreError = shouldIgnoreError;
|
|
1569
|
-
exports.sortBy = sortBy;
|
|
1570
|
-
exports.splitLineBreaks = splitLineBreaks;
|
|
1571
|
-
exports.toDashCase = toDashCase;
|
|
1572
|
-
exports.toLowerCase = toLowerCase;
|
|
1573
|
-
exports.toTitleCase = toTitleCase;
|
|
1574
|
-
exports.unique = unique;
|
|
1575
|
-
exports.validateComponentTag = validateComponentTag;
|