@rindo/core 1.8.12 → 1.17.4
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/bin/rindo +53 -19
- package/cli/index.cjs.js +524 -0
- package/cli/index.d.ts +15 -0
- package/cli/index.js +500 -0
- package/cli/package.json +9 -0
- package/compiler/package.json +8 -6
- package/compiler/rindo.d.ts +111 -0
- package/compiler/rindo.js +62852 -6655
- package/compiler/rindo.min.js +17 -0
- package/dependencies.json +80 -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 +785 -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/content-type-db.json +1 -0
- package/dev-server/index.d.ts +6 -0
- package/dev-server/index.js +260 -0
- package/dev-server/open-in-editor-api.js +1 -0
- package/dev-server/package.json +8 -0
- package/dev-server/server-worker.js +1570 -0
- package/{dist/dev-server → dev-server}/static/favicon.ico +0 -0
- package/{dist/dev-server → dev-server}/templates/directory-index.html +132 -132
- package/dev-server/templates/initial-load.html +160 -0
- package/{dist/sys/node → dev-server}/visualstudio.vbs +0 -0
- package/dev-server/ws.js +1 -0
- package/{dist/sys/node → dev-server}/xdg-open +0 -0
- package/internal/app-data/index.cjs.js +88 -0
- package/internal/app-data/index.d.ts +3 -0
- package/internal/{client/build-conditionals.mjs → app-data/index.js} +24 -21
- package/internal/app-data/package.json +9 -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} +736 -736
- package/internal/client/package.json +7 -0
- package/internal/client/patch.js +136 -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 +6 -7
- package/internal/client/{shadow-css.rindo-client.mjs → shadow-css.js} +14 -17
- package/internal/hydrate/index.js +1073 -0
- package/internal/hydrate/package.json +7 -0
- package/internal/hydrate/runner.d.ts +205 -0
- package/internal/hydrate/runner.js +748 -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 +8 -6
- package/internal/rindo-core/index.d.ts +2 -0
- package/{dist → internal/rindo-core}/index.js +0 -0
- package/internal/rindo-ext-modules.d.ts +39 -0
- package/internal/rindo-private.d.ts +2183 -0
- package/internal/rindo-public-compiler.d.ts +2094 -0
- package/{dist/declarations/docs.d.ts → internal/rindo-public-docs.d.ts} +13 -1
- package/internal/rindo-public-runtime.d.ts +1552 -0
- package/internal/testing/index.js +1032 -0
- package/internal/testing/package.json +7 -0
- package/internal/testing/shadow-css.js +146 -0
- package/mock-doc/index.cjs.js +4500 -0
- package/mock-doc/index.d.ts +905 -0
- package/mock-doc/index.js +4464 -2
- package/mock-doc/package.json +9 -10
- package/package.json +84 -137
- package/readme.md +3 -82
- package/screenshot/compare/build/app.css +1 -1
- package/screenshot/compare/build/app.esm.js +1 -1
- package/screenshot/compare/build/app.js +27 -812
- package/{dist/compiler/polyfills.d.ts → screenshot/compare/build/index.esm.js} +0 -0
- 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 +642 -2
- package/screenshot/local-connector.js +2 -3
- package/screenshot/package.json +8 -13
- package/{dist/screenshot → screenshot}/pixel-match.d.ts +0 -0
- package/screenshot/pixel-match.js +22 -6
- package/screenshot/screenshot-compare.d.ts +3 -0
- package/{dist/screenshot → screenshot}/screenshot-fs.d.ts +1 -1
- package/sys/node/autoprefixer.js +1 -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 +1402 -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 +33 -0
- package/{dist/testing → testing}/index.d.ts +5 -6
- package/testing/index.js +3903 -2
- package/testing/jest/jest-config.d.ts +92 -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/{dist/testing → testing}/jest/jest-setup-test-framework.d.ts +0 -0
- package/testing/jest-environment.js +3 -3
- package/testing/jest-preprocessor.js +3 -3
- package/testing/jest-preset.js +20 -28
- package/testing/jest-runner.js +3 -3
- package/testing/jest-setuptestframework.js +3 -3
- 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/events.d.ts +9 -1
- package/{dist/testing → testing}/matchers/html.d.ts +0 -0
- package/{dist/testing → testing}/matchers/index.d.ts +3 -1
- package/{dist/testing → testing}/matchers/screenshot.d.ts +1 -1
- package/{dist/testing → testing}/matchers/text.d.ts +0 -0
- 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 +2 -2
- package/{dist/testing → testing}/puppeteer/puppeteer-declarations.d.ts +9 -9
- package/{dist/testing → testing}/puppeteer/puppeteer-element.d.ts +5 -3
- package/testing/puppeteer/puppeteer-emulate.d.ts +2 -0
- package/{dist/testing → testing}/puppeteer/puppeteer-events.d.ts +7 -7
- 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/dev-server/templates/initial-load.html +0 -160
- 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/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
|
@@ -0,0 +1,748 @@
|
|
|
1
|
+
function createWindowFromHtml(e, t) {
|
|
2
|
+
let r = templateWindows.get(t);
|
|
3
|
+
return null == r && (r = new MockWindow(e), templateWindows.set(t, r)), cloneWindow(r);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
function normalizeHydrateOptions(e) {
|
|
7
|
+
const t = Object.assign({
|
|
8
|
+
serializeToHtml: !1,
|
|
9
|
+
destroyWindow: !1,
|
|
10
|
+
destroyDocument: !1
|
|
11
|
+
}, e || {});
|
|
12
|
+
return "boolean" != typeof t.clientHydrateAnnotations && (t.clientHydrateAnnotations = !0),
|
|
13
|
+
"boolean" != typeof t.constrainTimeouts && (t.constrainTimeouts = !0), "number" != typeof t.maxHydrateCount && (t.maxHydrateCount = 300),
|
|
14
|
+
"boolean" != typeof t.runtimeLogging && (t.runtimeLogging = !1), "number" != typeof t.timeout && (t.timeout = 15e3),
|
|
15
|
+
Array.isArray(t.excludeComponents) ? t.excludeComponents = t.excludeComponents.filter(filterValidTags).map(mapValidTags) : t.excludeComponents = [],
|
|
16
|
+
Array.isArray(t.staticComponents) ? t.staticComponents = t.staticComponents.filter(filterValidTags).map(mapValidTags) : t.staticComponents = [],
|
|
17
|
+
t;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function filterValidTags(e) {
|
|
21
|
+
return "string" == typeof e && e.includes("-");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function mapValidTags(e) {
|
|
25
|
+
return e.trim().toLowerCase();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function generateHydrateResults(e) {
|
|
29
|
+
"string" != typeof e.url && (e.url = "https://hydrate-rindojs.web.app/");
|
|
30
|
+
const t = {
|
|
31
|
+
diagnostics: [],
|
|
32
|
+
url: e.url,
|
|
33
|
+
host: null,
|
|
34
|
+
hostname: null,
|
|
35
|
+
href: null,
|
|
36
|
+
pathname: null,
|
|
37
|
+
port: null,
|
|
38
|
+
search: null,
|
|
39
|
+
hash: null,
|
|
40
|
+
html: null,
|
|
41
|
+
httpStatus: null,
|
|
42
|
+
hydratedCount: 0,
|
|
43
|
+
anchors: [],
|
|
44
|
+
components: [],
|
|
45
|
+
imgs: [],
|
|
46
|
+
scripts: [],
|
|
47
|
+
styles: [],
|
|
48
|
+
title: null
|
|
49
|
+
};
|
|
50
|
+
try {
|
|
51
|
+
const r = new URL(e.url, "https://hydrate-rindojs.web.app/");
|
|
52
|
+
t.url = r.href, t.host = r.host, t.hostname = r.hostname, t.href = r.href, t.port = r.port,
|
|
53
|
+
t.pathname = r.pathname, t.search = r.search, t.hash = r.hash;
|
|
54
|
+
} catch (e) {
|
|
55
|
+
renderCatchError(t, e);
|
|
56
|
+
}
|
|
57
|
+
return t;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function renderBuildDiagnostic(e, t, r, s) {
|
|
61
|
+
const n = {
|
|
62
|
+
level: t,
|
|
63
|
+
type: "build",
|
|
64
|
+
header: r,
|
|
65
|
+
messageText: s,
|
|
66
|
+
relFilePath: null,
|
|
67
|
+
absFilePath: null,
|
|
68
|
+
lines: []
|
|
69
|
+
};
|
|
70
|
+
return e.pathname ? "/" !== e.pathname && (n.header += ": " + e.pathname) : e.url && (n.header += ": " + e.url),
|
|
71
|
+
e.diagnostics.push(n), n;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function renderBuildError(e, t) {
|
|
75
|
+
return renderBuildDiagnostic(e, "error", "Hydrate Error", t);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function renderCatchError(e, t) {
|
|
79
|
+
const r = renderBuildError(e, null);
|
|
80
|
+
return null != t && (null != t.stack ? r.messageText = t.stack.toString() : null != t.message ? r.messageText = t.message.toString() : r.messageText = t.toString()),
|
|
81
|
+
r;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function runtimeLog(e, t, r) {
|
|
85
|
+
global.console[t].apply(global.console, [ `[ ${e} ${t} ] `, ...r ]);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function collectAttributes(e) {
|
|
89
|
+
const t = {}, r = e.attributes;
|
|
90
|
+
for (let e = 0, s = r.length; e < s; e++) {
|
|
91
|
+
const s = r.item(e), n = s.nodeName.toLowerCase();
|
|
92
|
+
if (SKIP_ATTRS.has(n)) continue;
|
|
93
|
+
const o = s.nodeValue;
|
|
94
|
+
"class" === n && "" === o || (t[n] = o);
|
|
95
|
+
}
|
|
96
|
+
return t;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function patchDomImplementation(e, t) {
|
|
100
|
+
let r;
|
|
101
|
+
if (null != e.defaultView ? (t.destroyWindow = !0, patchWindow(e.defaultView), r = e.defaultView) : (t.destroyWindow = !0,
|
|
102
|
+
t.destroyDocument = !1, r = new MockWindow(!1)), r.document !== e && (r.document = e),
|
|
103
|
+
e.defaultView !== r && (e.defaultView = r), "function" != typeof e.documentElement.constructor.prototype.getRootNode && (e.createElement("unknown-element").constructor.prototype.getRootNode = getRootNode),
|
|
104
|
+
"function" == typeof e.createEvent) {
|
|
105
|
+
const t = e.createEvent("CustomEvent").constructor;
|
|
106
|
+
r.CustomEvent !== t && (r.CustomEvent = t);
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
e.baseURI;
|
|
110
|
+
} catch (t) {
|
|
111
|
+
Object.defineProperty(e, "baseURI", {
|
|
112
|
+
get() {
|
|
113
|
+
const t = e.querySelector("base[href]");
|
|
114
|
+
return t ? new URL(t.getAttribute("href"), r.location.href).href : r.location.href;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return r;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function getRootNode(e) {
|
|
122
|
+
const t = null != e && !0 === e.composed;
|
|
123
|
+
let r = this;
|
|
124
|
+
for (;null != r.parentNode; ) r = r.parentNode, !0 === t && null == r.parentNode && null != r.host && (r = r.host);
|
|
125
|
+
return r;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function renderToString(e, t) {
|
|
129
|
+
const r = normalizeHydrateOptions(t);
|
|
130
|
+
return r.serializeToHtml = !0, new Promise(t => {
|
|
131
|
+
const s = generateHydrateResults(r);
|
|
132
|
+
if (hasError(s.diagnostics)) t(s); else if ("string" == typeof e) try {
|
|
133
|
+
r.destroyWindow = !0, r.destroyDocument = !0, render(new MockWindow(e), r, s, t);
|
|
134
|
+
} catch (e) {
|
|
135
|
+
renderCatchError(s, e), t(s);
|
|
136
|
+
} else if (isValidDocument(e)) try {
|
|
137
|
+
r.destroyDocument = !1, render(patchDomImplementation(e, r), r, s, t);
|
|
138
|
+
} catch (e) {
|
|
139
|
+
renderCatchError(s, e), t(s);
|
|
140
|
+
} else renderBuildError(s, 'Invalid html or document. Must be either a valid "html" string, or DOM "document".'),
|
|
141
|
+
t(s);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function hydrateDocument(e, t) {
|
|
146
|
+
const r = normalizeHydrateOptions(t);
|
|
147
|
+
return r.serializeToHtml = !1, new Promise(t => {
|
|
148
|
+
const s = generateHydrateResults(r);
|
|
149
|
+
if (hasError(s.diagnostics)) t(s); else if ("string" == typeof e) try {
|
|
150
|
+
r.destroyWindow = !0, r.destroyDocument = !0, render(new MockWindow(e), r, s, t);
|
|
151
|
+
} catch (e) {
|
|
152
|
+
renderCatchError(s, e), t(s);
|
|
153
|
+
} else if (isValidDocument(e)) try {
|
|
154
|
+
r.destroyDocument = !1, render(patchDomImplementation(e, r), r, s, t);
|
|
155
|
+
} catch (e) {
|
|
156
|
+
renderCatchError(s, e), t(s);
|
|
157
|
+
} else renderBuildError(s, 'Invalid html or document. Must be either a valid "html" string, or DOM "document".'),
|
|
158
|
+
t(s);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function render(e, t, r, s) {
|
|
163
|
+
if (process.__rindoErrors || (process.__rindoErrors = !0, process.on("unhandledRejection", e => {
|
|
164
|
+
console.log("unhandledRejection", e);
|
|
165
|
+
})), function n(e, t, r) {
|
|
166
|
+
try {
|
|
167
|
+
e.location.href = t.url;
|
|
168
|
+
} catch (e) {
|
|
169
|
+
renderCatchError(r, e);
|
|
170
|
+
}
|
|
171
|
+
if ("string" == typeof t.userAgent) try {
|
|
172
|
+
e.navigator.userAgent = t.userAgent;
|
|
173
|
+
} catch (e) {}
|
|
174
|
+
if ("string" == typeof t.cookie) try {
|
|
175
|
+
e.document.cookie = t.cookie;
|
|
176
|
+
} catch (e) {}
|
|
177
|
+
if ("string" == typeof t.referrer) try {
|
|
178
|
+
e.document.referrer = t.referrer;
|
|
179
|
+
} catch (e) {}
|
|
180
|
+
if ("string" == typeof t.direction) try {
|
|
181
|
+
e.document.documentElement.setAttribute("dir", t.direction);
|
|
182
|
+
} catch (e) {}
|
|
183
|
+
if ("string" == typeof t.language) try {
|
|
184
|
+
e.document.documentElement.setAttribute("lang", t.language);
|
|
185
|
+
} catch (e) {}
|
|
186
|
+
try {
|
|
187
|
+
e.customElements = null;
|
|
188
|
+
} catch (e) {}
|
|
189
|
+
return t.constrainTimeouts && constrainTimeouts(e), function s(e, t, r) {
|
|
190
|
+
try {
|
|
191
|
+
const s = e.location.pathname;
|
|
192
|
+
e.console.error = (...e) => {
|
|
193
|
+
renderCatchError(r, [ ...e ].join(", ")), t.runtimeLogging && runtimeLog(s, "error", e);
|
|
194
|
+
}, e.console.debug = (...e) => {
|
|
195
|
+
renderBuildDiagnostic(r, "debug", "Hydrate Debug", [ ...e ].join(", ")), t.runtimeLogging && runtimeLog(s, "debug", e);
|
|
196
|
+
}, t.runtimeLogging && [ "log", "warn", "assert", "info", "trace" ].forEach(t => {
|
|
197
|
+
e.console[t] = (...e) => {
|
|
198
|
+
runtimeLog(s, t, e);
|
|
199
|
+
};
|
|
200
|
+
});
|
|
201
|
+
} catch (e) {
|
|
202
|
+
renderCatchError(r, e);
|
|
203
|
+
}
|
|
204
|
+
}(e, t, r), e;
|
|
205
|
+
}(e, t, r), "function" == typeof t.beforeHydrate) try {
|
|
206
|
+
const n = t.beforeHydrate(e.document);
|
|
207
|
+
isPromise(n) ? n.then(() => {
|
|
208
|
+
hydrateFactory(e, t, r, afterHydrate, s);
|
|
209
|
+
}) : hydrateFactory(e, t, r, afterHydrate, s);
|
|
210
|
+
} catch (n) {
|
|
211
|
+
renderCatchError(r, n), finalizeHydrate(e, e.document, t, r, s);
|
|
212
|
+
} else hydrateFactory(e, t, r, afterHydrate, s);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function afterHydrate(e, t, r, s) {
|
|
216
|
+
if ("function" == typeof t.afterHydrate) try {
|
|
217
|
+
const n = t.afterHydrate(e.document);
|
|
218
|
+
isPromise(n) ? n.then(() => {
|
|
219
|
+
finalizeHydrate(e, e.document, t, r, s);
|
|
220
|
+
}) : finalizeHydrate(e, e.document, t, r, s);
|
|
221
|
+
} catch (n) {
|
|
222
|
+
renderCatchError(r, n), finalizeHydrate(e, e.document, t, r, s);
|
|
223
|
+
} else finalizeHydrate(e, e.document, t, r, s);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function finalizeHydrate(e, t, r, s, n) {
|
|
227
|
+
try {
|
|
228
|
+
if (function e(t, r, s) {
|
|
229
|
+
const n = r.children;
|
|
230
|
+
for (let r = 0, o = n.length; r < o; r++) {
|
|
231
|
+
const o = n[r], i = o.nodeName.toLowerCase();
|
|
232
|
+
if (i.includes("-")) {
|
|
233
|
+
const e = t.components.find(e => e.tag === i);
|
|
234
|
+
null != e && (e.count++, s > e.depth && (e.depth = s));
|
|
235
|
+
} else switch (i) {
|
|
236
|
+
case "a":
|
|
237
|
+
const e = collectAttributes(o);
|
|
238
|
+
e.href = o.href, "string" == typeof e.href && (t.anchors.some(t => t.href === e.href) || t.anchors.push(e));
|
|
239
|
+
break;
|
|
240
|
+
|
|
241
|
+
case "img":
|
|
242
|
+
const r = collectAttributes(o);
|
|
243
|
+
r.src = o.src, "string" == typeof r.src && (t.imgs.some(e => e.src === r.src) || t.imgs.push(r));
|
|
244
|
+
break;
|
|
245
|
+
|
|
246
|
+
case "link":
|
|
247
|
+
const s = collectAttributes(o);
|
|
248
|
+
s.href = o.href, "string" == typeof s.rel && "stylesheet" === s.rel.toLowerCase() && "string" == typeof s.href && (t.styles.some(e => e.link === s.href) || (delete s.rel,
|
|
249
|
+
delete s.type, t.styles.push(s)));
|
|
250
|
+
break;
|
|
251
|
+
|
|
252
|
+
case "script":
|
|
253
|
+
const n = collectAttributes(o);
|
|
254
|
+
n.src = o.src, "string" == typeof n.src && (t.scripts.some(e => e.src === n.src) || t.scripts.push(n));
|
|
255
|
+
}
|
|
256
|
+
e(t, o, ++s);
|
|
257
|
+
}
|
|
258
|
+
}(s, t.documentElement, 0), !1 !== r.removeUnusedStyles) try {
|
|
259
|
+
((e, t) => {
|
|
260
|
+
try {
|
|
261
|
+
const r = e.head.querySelectorAll("style[data-styles]"), s = r.length;
|
|
262
|
+
if (s > 0) {
|
|
263
|
+
const n = (e => {
|
|
264
|
+
const t = {
|
|
265
|
+
attrs: new Set,
|
|
266
|
+
classNames: new Set,
|
|
267
|
+
ids: new Set,
|
|
268
|
+
tags: new Set
|
|
269
|
+
};
|
|
270
|
+
return collectUsedSelectors(t, e), t;
|
|
271
|
+
})(e.documentElement);
|
|
272
|
+
for (let e = 0; e < s; e++) removeUnusedStyleText(n, t, r[e]);
|
|
273
|
+
}
|
|
274
|
+
} catch (e) {
|
|
275
|
+
((e, t, r) => {
|
|
276
|
+
const s = {
|
|
277
|
+
level: "error",
|
|
278
|
+
type: "build",
|
|
279
|
+
header: "Build Error",
|
|
280
|
+
messageText: "build error",
|
|
281
|
+
relFilePath: null,
|
|
282
|
+
absFilePath: null,
|
|
283
|
+
lines: []
|
|
284
|
+
};
|
|
285
|
+
null != t && (null != t.stack ? s.messageText = t.stack.toString() : null != t.message ? s.messageText = t.message.toString() : s.messageText = t.toString()),
|
|
286
|
+
null == e || shouldIgnoreError(s.messageText) || e.push(s);
|
|
287
|
+
})(t, e);
|
|
288
|
+
}
|
|
289
|
+
})(t, s.diagnostics);
|
|
290
|
+
} catch (e) {
|
|
291
|
+
renderCatchError(s, e);
|
|
292
|
+
}
|
|
293
|
+
if ("string" == typeof r.title) try {
|
|
294
|
+
t.title = r.title;
|
|
295
|
+
} catch (e) {
|
|
296
|
+
renderCatchError(s, e);
|
|
297
|
+
}
|
|
298
|
+
s.title = t.title, r.removeScripts && function e(t) {
|
|
299
|
+
const r = t.children;
|
|
300
|
+
for (let t = r.length - 1; t >= 0; t--) {
|
|
301
|
+
const s = r[t];
|
|
302
|
+
e(s), ("SCRIPT" === s.nodeName || "LINK" === s.nodeName && "modulepreload" === s.getAttribute("rel")) && s.remove();
|
|
303
|
+
}
|
|
304
|
+
}(t.documentElement);
|
|
305
|
+
try {
|
|
306
|
+
((e, t) => {
|
|
307
|
+
let r = e.head.querySelector('link[rel="canonical"]');
|
|
308
|
+
"string" == typeof t ? (null == r && (r = e.createElement("link"), r.setAttribute("rel", "canonical"),
|
|
309
|
+
e.head.appendChild(r)), r.setAttribute("href", t)) : null != r && (r.getAttribute("href") || r.parentNode.removeChild(r));
|
|
310
|
+
})(t, r.canonicalUrl);
|
|
311
|
+
} catch (e) {
|
|
312
|
+
renderCatchError(s, e);
|
|
313
|
+
}
|
|
314
|
+
try {
|
|
315
|
+
(e => {
|
|
316
|
+
const t = e.head;
|
|
317
|
+
let r = t.querySelector("meta[charset]");
|
|
318
|
+
null == r ? (r = e.createElement("meta"), r.setAttribute("charset", "utf-8")) : r.remove(),
|
|
319
|
+
t.insertBefore(r, t.firstChild);
|
|
320
|
+
})(t);
|
|
321
|
+
} catch (e) {}
|
|
322
|
+
hasError(s.diagnostics) || (s.httpStatus = 200);
|
|
323
|
+
try {
|
|
324
|
+
const e = t.head.querySelector('meta[http-equiv="status"]');
|
|
325
|
+
if (null != e) {
|
|
326
|
+
const t = e.getAttribute("content");
|
|
327
|
+
t && t.length > 0 && (s.httpStatus = parseInt(t, 10));
|
|
328
|
+
}
|
|
329
|
+
} catch (e) {}
|
|
330
|
+
r.clientHydrateAnnotations && t.documentElement.classList.add("hydrated"), r.serializeToHtml && (s.html = serializeDocumentToString(t, r));
|
|
331
|
+
} catch (e) {
|
|
332
|
+
renderCatchError(s, e);
|
|
333
|
+
}
|
|
334
|
+
if (r.destroyWindow) try {
|
|
335
|
+
r.destroyDocument || (e.document = null, t.defaultView = null), e.close();
|
|
336
|
+
} catch (e) {
|
|
337
|
+
renderCatchError(s, e);
|
|
338
|
+
}
|
|
339
|
+
n(s);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
function serializeDocumentToString(e, t) {
|
|
343
|
+
return serializeNodeToHtml(e, {
|
|
344
|
+
approximateLineWidth: t.approximateLineWidth,
|
|
345
|
+
outerHtml: !1,
|
|
346
|
+
prettyHtml: t.prettyHtml,
|
|
347
|
+
removeAttributeQuotes: t.removeAttributeQuotes,
|
|
348
|
+
removeBooleanAttributeQuotes: t.removeBooleanAttributeQuotes,
|
|
349
|
+
removeEmptyAttributes: t.removeEmptyAttributes,
|
|
350
|
+
removeHtmlComments: t.removeHtmlComments,
|
|
351
|
+
serializeShadowRoot: !1
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
function isValidDocument(e) {
|
|
356
|
+
return null != e && 9 === e.nodeType && null != e.documentElement && 1 === e.documentElement.nodeType && null != e.body && 1 === e.body.nodeType;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
import { MockWindow, cloneWindow, constrainTimeouts, patchWindow, serializeNodeToHtml } from "@rindo/core/mock-doc";
|
|
360
|
+
|
|
361
|
+
import { hydrateFactory } from "@rindo/core/hydrate-factory";
|
|
362
|
+
|
|
363
|
+
const templateWindows = new Map, IS_NODE_ENV = !("undefined" == typeof global || "function" != typeof require || !global.process || "string" != typeof __filename || global.origin && "string" == typeof global.origin), isPromise = (global.process.platform,
|
|
364
|
+
IS_NODE_ENV && global.process.platform, process.cwd, process.exit, e => !!e && ("object" == typeof e || "function" == typeof e) && "function" == typeof e.then), hasError = e => null != e && 0 !== e.length && e.some(e => "error" === e.level && "runtime" !== e.type), shouldIgnoreError = e => e === TASK_CANCELED_MSG, TASK_CANCELED_MSG = "task canceled", SKIP_ATTRS = new Set([ "s-id", "c-id" ]), collectUsedSelectors = (e, t) => {
|
|
365
|
+
if (null != t && 1 === t.nodeType) {
|
|
366
|
+
const r = t.children, s = t.nodeName.toLowerCase();
|
|
367
|
+
e.tags.add(s);
|
|
368
|
+
const n = t.attributes;
|
|
369
|
+
for (let r = 0, s = n.length; r < s; r++) {
|
|
370
|
+
const s = n.item(r), o = s.name.toLowerCase();
|
|
371
|
+
if (e.attrs.add(o), "class" === o) {
|
|
372
|
+
const r = t.classList;
|
|
373
|
+
for (let t = 0, s = r.length; t < s; t++) e.classNames.add(r.item(t));
|
|
374
|
+
} else "id" === o && e.ids.add(s.value);
|
|
375
|
+
}
|
|
376
|
+
if (r) for (let t = 0, s = r.length; t < s; t++) collectUsedSelectors(e, r[t]);
|
|
377
|
+
}
|
|
378
|
+
}, parseCss = (e, t) => {
|
|
379
|
+
let r = 1, s = 1;
|
|
380
|
+
const n = [], o = e => {
|
|
381
|
+
const t = e.match(/\n/g);
|
|
382
|
+
t && (r += t.length);
|
|
383
|
+
const n = e.lastIndexOf("\n");
|
|
384
|
+
s = ~n ? e.length - n : s + e.length;
|
|
385
|
+
}, i = () => {
|
|
386
|
+
const e = {
|
|
387
|
+
line: r,
|
|
388
|
+
column: s
|
|
389
|
+
};
|
|
390
|
+
return t => (t.position = new A(e), m(), t);
|
|
391
|
+
}, a = o => {
|
|
392
|
+
const i = e.split("\n"), a = {
|
|
393
|
+
level: "error",
|
|
394
|
+
type: "css",
|
|
395
|
+
language: "css",
|
|
396
|
+
header: "CSS Parse",
|
|
397
|
+
messageText: o,
|
|
398
|
+
absFilePath: t,
|
|
399
|
+
lines: [ {
|
|
400
|
+
lineIndex: r - 1,
|
|
401
|
+
lineNumber: r,
|
|
402
|
+
errorCharStart: s,
|
|
403
|
+
text: e[r - 1]
|
|
404
|
+
} ]
|
|
405
|
+
};
|
|
406
|
+
if (r > 1) {
|
|
407
|
+
const t = {
|
|
408
|
+
lineIndex: r - 1,
|
|
409
|
+
lineNumber: r - 1,
|
|
410
|
+
text: e[r - 2],
|
|
411
|
+
errorCharStart: -1,
|
|
412
|
+
errorLength: -1
|
|
413
|
+
};
|
|
414
|
+
a.lines.unshift(t);
|
|
415
|
+
}
|
|
416
|
+
if (r + 2 < i.length) {
|
|
417
|
+
const e = {
|
|
418
|
+
lineIndex: r,
|
|
419
|
+
lineNumber: r + 1,
|
|
420
|
+
text: i[r],
|
|
421
|
+
errorCharStart: -1,
|
|
422
|
+
errorLength: -1
|
|
423
|
+
};
|
|
424
|
+
a.lines.push(e);
|
|
425
|
+
}
|
|
426
|
+
return n.push(a), null;
|
|
427
|
+
}, l = () => u(/^{\s*/), c = () => u(/^}/), u = t => {
|
|
428
|
+
const r = t.exec(e);
|
|
429
|
+
if (!r) return;
|
|
430
|
+
const s = r[0];
|
|
431
|
+
return o(s), e = e.slice(s.length), r;
|
|
432
|
+
}, d = () => {
|
|
433
|
+
let t;
|
|
434
|
+
const r = [];
|
|
435
|
+
for (m(), h(r); e.length && "}" !== e.charAt(0) && (t = w() || z()); ) !1 !== t && (r.push(t),
|
|
436
|
+
h(r));
|
|
437
|
+
return r;
|
|
438
|
+
}, m = () => u(/^\s*/), h = e => {
|
|
439
|
+
let t;
|
|
440
|
+
for (e = e || []; t = p(); ) !1 !== t && e.push(t);
|
|
441
|
+
return e;
|
|
442
|
+
}, p = () => {
|
|
443
|
+
const t = i();
|
|
444
|
+
if ("/" !== e.charAt(0) || "*" !== e.charAt(1)) return null;
|
|
445
|
+
let r = 2;
|
|
446
|
+
for (;"" !== e.charAt(r) && ("*" !== e.charAt(r) || "/" !== e.charAt(r + 1)); ) ++r;
|
|
447
|
+
if (r += 2, "" === e.charAt(r - 1)) return a("End of comment missing");
|
|
448
|
+
const n = e.slice(2, r - 2);
|
|
449
|
+
return s += 2, o(n), e = e.slice(r), s += 2, t({
|
|
450
|
+
type: "comment",
|
|
451
|
+
comment: n
|
|
452
|
+
});
|
|
453
|
+
}, f = () => {
|
|
454
|
+
const e = u(/^([^{]+)/);
|
|
455
|
+
return e ? trim(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, "").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, (function(e) {
|
|
456
|
+
return e.replace(/,/g, "");
|
|
457
|
+
})).split(/\s*(?![^(]*\)),\s*/).map((function(e) {
|
|
458
|
+
return e.replace(/\u200C/g, ",");
|
|
459
|
+
})) : null;
|
|
460
|
+
}, g = () => {
|
|
461
|
+
const e = i();
|
|
462
|
+
let t = u(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
|
|
463
|
+
if (!t) return null;
|
|
464
|
+
if (t = trim(t[0]), !u(/^:\s*/)) return a("property missing ':'");
|
|
465
|
+
const r = u(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/), s = e({
|
|
466
|
+
type: "declaration",
|
|
467
|
+
property: t.replace(commentre, ""),
|
|
468
|
+
value: r ? trim(r[0]).replace(commentre, "") : ""
|
|
469
|
+
});
|
|
470
|
+
return u(/^[;\s]*/), s;
|
|
471
|
+
}, y = () => {
|
|
472
|
+
const e = [];
|
|
473
|
+
if (!l()) return a("missing '{'");
|
|
474
|
+
let t;
|
|
475
|
+
for (h(e); t = g(); ) !1 !== t && (e.push(t), h(e));
|
|
476
|
+
return c() ? e : a("missing '}'");
|
|
477
|
+
}, C = () => {
|
|
478
|
+
let e;
|
|
479
|
+
const t = [], r = i();
|
|
480
|
+
for (;e = u(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/); ) t.push(e[1]), u(/^,\s*/);
|
|
481
|
+
return t.length ? r({
|
|
482
|
+
type: "keyframe",
|
|
483
|
+
values: t,
|
|
484
|
+
declarations: y()
|
|
485
|
+
}) : null;
|
|
486
|
+
}, S = e => {
|
|
487
|
+
const t = new RegExp("^@" + e + "\\s*([^;]+);");
|
|
488
|
+
return () => {
|
|
489
|
+
const r = i(), s = u(t);
|
|
490
|
+
if (!s) return null;
|
|
491
|
+
const n = {
|
|
492
|
+
type: e
|
|
493
|
+
};
|
|
494
|
+
return n[e] = s[1].trim(), r(n);
|
|
495
|
+
};
|
|
496
|
+
}, E = S("import"), b = S("charset"), T = S("namespace"), w = () => "@" !== e[0] ? null : (() => {
|
|
497
|
+
const e = i();
|
|
498
|
+
let t = u(/^@([-\w]+)?keyframes\s*/);
|
|
499
|
+
if (!t) return null;
|
|
500
|
+
const r = t[1];
|
|
501
|
+
if (t = u(/^([-\w]+)\s*/), !t) return a("@keyframes missing name");
|
|
502
|
+
const s = t[1];
|
|
503
|
+
if (!l()) return a("@keyframes missing '{'");
|
|
504
|
+
let n, o = h();
|
|
505
|
+
for (;n = C(); ) o.push(n), o = o.concat(h());
|
|
506
|
+
return c() ? e({
|
|
507
|
+
type: "keyframes",
|
|
508
|
+
name: s,
|
|
509
|
+
vendor: r,
|
|
510
|
+
keyframes: o
|
|
511
|
+
}) : a("@keyframes missing '}'");
|
|
512
|
+
})() || (() => {
|
|
513
|
+
const e = i(), t = u(/^@media *([^{]+)/);
|
|
514
|
+
if (!t) return null;
|
|
515
|
+
const r = trim(t[1]);
|
|
516
|
+
if (!l()) return a("@media missing '{'");
|
|
517
|
+
const s = h().concat(d());
|
|
518
|
+
return c() ? e({
|
|
519
|
+
type: "media",
|
|
520
|
+
media: r,
|
|
521
|
+
rules: s
|
|
522
|
+
}) : a("@media missing '}'");
|
|
523
|
+
})() || (() => {
|
|
524
|
+
const e = i(), t = u(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);
|
|
525
|
+
return t ? e({
|
|
526
|
+
type: "custom-media",
|
|
527
|
+
name: trim(t[1]),
|
|
528
|
+
media: trim(t[2])
|
|
529
|
+
}) : null;
|
|
530
|
+
})() || (() => {
|
|
531
|
+
const e = i(), t = u(/^@supports *([^{]+)/);
|
|
532
|
+
if (!t) return null;
|
|
533
|
+
const r = trim(t[1]);
|
|
534
|
+
if (!l()) return a("@supports missing '{'");
|
|
535
|
+
const s = h().concat(d());
|
|
536
|
+
return c() ? e({
|
|
537
|
+
type: "supports",
|
|
538
|
+
supports: r,
|
|
539
|
+
rules: s
|
|
540
|
+
}) : a("@supports missing '}'");
|
|
541
|
+
})() || E() || b() || T() || (() => {
|
|
542
|
+
const e = i(), t = u(/^@([-\w]+)?document *([^{]+)/);
|
|
543
|
+
if (!t) return null;
|
|
544
|
+
const r = trim(t[1]), s = trim(t[2]);
|
|
545
|
+
if (!l()) return a("@document missing '{'");
|
|
546
|
+
const n = h().concat(d());
|
|
547
|
+
return c() ? e({
|
|
548
|
+
type: "document",
|
|
549
|
+
document: s,
|
|
550
|
+
vendor: r,
|
|
551
|
+
rules: n
|
|
552
|
+
}) : a("@document missing '}'");
|
|
553
|
+
})() || (() => {
|
|
554
|
+
const e = i();
|
|
555
|
+
if (!u(/^@page */)) return null;
|
|
556
|
+
const t = f() || [];
|
|
557
|
+
if (!l()) return a("@page missing '{'");
|
|
558
|
+
let r, s = h();
|
|
559
|
+
for (;r = g(); ) s.push(r), s = s.concat(h());
|
|
560
|
+
return c() ? e({
|
|
561
|
+
type: "page",
|
|
562
|
+
selectors: t,
|
|
563
|
+
declarations: s
|
|
564
|
+
}) : a("@page missing '}'");
|
|
565
|
+
})() || (() => {
|
|
566
|
+
const e = i();
|
|
567
|
+
if (!u(/^@host\s*/)) return null;
|
|
568
|
+
if (!l()) return a("@host missing '{'");
|
|
569
|
+
const t = h().concat(d());
|
|
570
|
+
return c() ? e({
|
|
571
|
+
type: "host",
|
|
572
|
+
rules: t
|
|
573
|
+
}) : a("@host missing '}'");
|
|
574
|
+
})() || (() => {
|
|
575
|
+
const e = i();
|
|
576
|
+
if (!u(/^@font-face\s*/)) return null;
|
|
577
|
+
if (!l()) return a("@font-face missing '{'");
|
|
578
|
+
let t, r = h();
|
|
579
|
+
for (;t = g(); ) r.push(t), r = r.concat(h());
|
|
580
|
+
return c() ? e({
|
|
581
|
+
type: "font-face",
|
|
582
|
+
declarations: r
|
|
583
|
+
}) : a("@font-face missing '}'");
|
|
584
|
+
})(), z = () => {
|
|
585
|
+
const e = i(), t = f();
|
|
586
|
+
return t ? (h(), e({
|
|
587
|
+
type: "rule",
|
|
588
|
+
selectors: t,
|
|
589
|
+
declarations: y()
|
|
590
|
+
})) : a("selector missing");
|
|
591
|
+
};
|
|
592
|
+
class A {
|
|
593
|
+
constructor(e) {
|
|
594
|
+
this.start = e, this.end = {
|
|
595
|
+
line: r,
|
|
596
|
+
column: s
|
|
597
|
+
}, this.source = t;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return A.prototype.content = e, Object.assign({
|
|
601
|
+
diagnostics: n
|
|
602
|
+
}, addParent((() => {
|
|
603
|
+
const e = d();
|
|
604
|
+
return {
|
|
605
|
+
type: "stylesheet",
|
|
606
|
+
stylesheet: {
|
|
607
|
+
source: t,
|
|
608
|
+
rules: e
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
})()));
|
|
612
|
+
}, trim = e => e ? e.trim() : "", addParent = (e, t) => {
|
|
613
|
+
const r = e && "string" == typeof e.type, s = r ? e : t;
|
|
614
|
+
for (const t in e) {
|
|
615
|
+
const r = e[t];
|
|
616
|
+
Array.isArray(r) ? r.forEach((function(e) {
|
|
617
|
+
addParent(e, s);
|
|
618
|
+
})) : r && "object" == typeof r && addParent(r, s);
|
|
619
|
+
}
|
|
620
|
+
return r && Object.defineProperty(e, "parent", {
|
|
621
|
+
configurable: !0,
|
|
622
|
+
writable: !0,
|
|
623
|
+
enumerable: !1,
|
|
624
|
+
value: t || null
|
|
625
|
+
}), e;
|
|
626
|
+
}, commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g, getCssSelectors = e => {
|
|
627
|
+
SELECTORS.all.length = SELECTORS.tags.length = SELECTORS.classNames.length = SELECTORS.ids.length = SELECTORS.attrs.length = 0;
|
|
628
|
+
const t = (e = e.replace(/\./g, " .").replace(/\#/g, " #").replace(/\[/g, " [").replace(/\>/g, " > ").replace(/\+/g, " + ").replace(/\~/g, " ~ ").replace(/\*/g, " * ").replace(/\:not\((.*?)\)/g, " ")).split(" ");
|
|
629
|
+
for (let e = 0, r = t.length; e < r; e++) t[e] = t[e].split(":")[0], 0 !== t[e].length && ("." === t[e].charAt(0) ? SELECTORS.classNames.push(t[e].substr(1)) : "#" === t[e].charAt(0) ? SELECTORS.ids.push(t[e].substr(1)) : "[" === t[e].charAt(0) ? (t[e] = t[e].substr(1).split("=")[0].split("]")[0].trim(),
|
|
630
|
+
SELECTORS.attrs.push(t[e].toLowerCase())) : /[a-z]/g.test(t[e].charAt(0)) && SELECTORS.tags.push(t[e].toLowerCase()));
|
|
631
|
+
return SELECTORS.classNames = SELECTORS.classNames.sort((e, t) => e.length < t.length ? -1 : e.length > t.length ? 1 : 0),
|
|
632
|
+
SELECTORS;
|
|
633
|
+
}, SELECTORS = {
|
|
634
|
+
all: [],
|
|
635
|
+
tags: [],
|
|
636
|
+
classNames: [],
|
|
637
|
+
ids: [],
|
|
638
|
+
attrs: []
|
|
639
|
+
}, serializeCssVisitNode = (e, t, r, s) => {
|
|
640
|
+
const n = t.type;
|
|
641
|
+
return "declaration" === n ? serializeCssDeclaration(t, r, s) : "rule" === n ? serializeCssRule(e, t) : "comment" === n ? "!" === t.comment[0] ? `/*${t.comment}*/` : "" : "media" === n ? serializeCssMedia(e, t) : "keyframes" === n ? serializeCssKeyframes(e, t) : "keyframe" === n ? serializeCssKeyframe(e, t) : "font-face" === n ? serializeCssFontFace(e, t) : "supports" === n ? serializeCssSupports(e, t) : "import" === n ? "@import " + t.import + ";" : "charset" === n ? "@charset " + t.charset + ";" : "page" === n ? serializeCssPage(e, t) : "host" === n ? "@host{" + serializeCssMapVisit(e, t.rules) + "}" : "custom-media" === n ? "@custom-media " + t.name + " " + t.media + ";" : "document" === n ? serializeCssDocument(e, t) : "namespace" === n ? "@namespace " + t.namespace + ";" : "";
|
|
642
|
+
}, serializeCssRule = (e, t) => {
|
|
643
|
+
const r = t.declarations, s = e.usedSelectors, n = t.selectors.slice();
|
|
644
|
+
if (null == r || 0 === r.length) return "";
|
|
645
|
+
if (s) {
|
|
646
|
+
let t, r, o = !0;
|
|
647
|
+
for (t = n.length - 1; t >= 0; t--) {
|
|
648
|
+
const i = getCssSelectors(n[t]);
|
|
649
|
+
o = !0;
|
|
650
|
+
let a = i.classNames.length;
|
|
651
|
+
if (a > 0 && e.hasUsedClassNames) for (r = 0; r < a; r++) if (!s.classNames.has(i.classNames[r])) {
|
|
652
|
+
o = !1;
|
|
653
|
+
break;
|
|
654
|
+
}
|
|
655
|
+
if (o && e.hasUsedTags && (a = i.tags.length, a > 0)) for (r = 0; r < a; r++) if (!s.tags.has(i.tags[r])) {
|
|
656
|
+
o = !1;
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
if (o && e.hasUsedAttrs && (a = i.attrs.length, a > 0)) for (r = 0; r < a; r++) if (!s.attrs.has(i.attrs[r])) {
|
|
660
|
+
o = !1;
|
|
661
|
+
break;
|
|
662
|
+
}
|
|
663
|
+
if (o && e.hasUsedIds && (a = i.ids.length, a > 0)) for (r = 0; r < a; r++) if (!s.ids.has(i.ids[r])) {
|
|
664
|
+
o = !1;
|
|
665
|
+
break;
|
|
666
|
+
}
|
|
667
|
+
o || n.splice(t, 1);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
if (0 === n.length) return "";
|
|
671
|
+
const o = [];
|
|
672
|
+
let i = "";
|
|
673
|
+
for (const e of t.selectors) i = removeSelectorWhitespace(e), o.includes(i) || o.push(i);
|
|
674
|
+
return `${o}{${serializeCssMapVisit(e, r)}}`;
|
|
675
|
+
}, serializeCssDeclaration = (e, t, r) => "" === e.value ? "" : r - 1 === t ? e.property + ":" + e.value : e.property + ":" + e.value + ";", serializeCssMedia = (e, t) => {
|
|
676
|
+
const r = serializeCssMapVisit(e, t.rules);
|
|
677
|
+
return "" === r ? "" : "@media " + removeMediaWhitespace(t.media) + "{" + r + "}";
|
|
678
|
+
}, serializeCssKeyframes = (e, t) => {
|
|
679
|
+
const r = serializeCssMapVisit(e, t.keyframes);
|
|
680
|
+
return "" === r ? "" : "@" + (t.vendor || "") + "keyframes " + t.name + "{" + r + "}";
|
|
681
|
+
}, serializeCssKeyframe = (e, t) => t.values.join(",") + "{" + serializeCssMapVisit(e, t.declarations) + "}", serializeCssFontFace = (e, t) => {
|
|
682
|
+
const r = serializeCssMapVisit(e, t.declarations);
|
|
683
|
+
return "" === r ? "" : "@font-face{" + r + "}";
|
|
684
|
+
}, serializeCssSupports = (e, t) => {
|
|
685
|
+
const r = serializeCssMapVisit(e, t.rules);
|
|
686
|
+
return "" === r ? "" : "@supports " + t.supports + "{" + r + "}";
|
|
687
|
+
}, serializeCssPage = (e, t) => "@page " + t.selectors.join(", ") + "{" + serializeCssMapVisit(e, t.declarations) + "}", serializeCssDocument = (e, t) => {
|
|
688
|
+
const r = serializeCssMapVisit(e, t.rules), s = "@" + (t.vendor || "") + "document " + t.document;
|
|
689
|
+
return "" === r ? "" : s + "{" + r + "}";
|
|
690
|
+
}, serializeCssMapVisit = (e, t) => {
|
|
691
|
+
let r = "";
|
|
692
|
+
if (t) for (let s = 0, n = t.length; s < n; s++) r += serializeCssVisitNode(e, t[s], s, n);
|
|
693
|
+
return r;
|
|
694
|
+
}, removeSelectorWhitespace = e => {
|
|
695
|
+
let t = "", r = "", s = !1;
|
|
696
|
+
for (let n = 0, o = (e = e.trim()).length; n < o; n++) if (r = e[n], "[" === r && "\\" !== t[t.length - 1] ? s = !0 : "]" === r && "\\" !== t[t.length - 1] && (s = !1),
|
|
697
|
+
!s && CSS_WS_REG.test(r)) {
|
|
698
|
+
if (CSS_NEXT_CHAR_REG.test(e[n + 1])) continue;
|
|
699
|
+
if (CSS_PREV_CHAR_REG.test(t[t.length - 1])) continue;
|
|
700
|
+
t += " ";
|
|
701
|
+
} else t += r;
|
|
702
|
+
return t;
|
|
703
|
+
}, removeMediaWhitespace = e => {
|
|
704
|
+
let t = "", r = "";
|
|
705
|
+
for (let s = 0, n = (e = e.trim()).length; s < n; s++) if (r = e[s], CSS_WS_REG.test(r)) {
|
|
706
|
+
if (CSS_WS_REG.test(t[t.length - 1])) continue;
|
|
707
|
+
t += " ";
|
|
708
|
+
} else t += r;
|
|
709
|
+
return t;
|
|
710
|
+
}, CSS_WS_REG = /\s/, CSS_NEXT_CHAR_REG = /[>\(\)\~\,\+\s]/, CSS_PREV_CHAR_REG = /[>\(\~\,\+]/, removeUnusedStyleText = (e, t, r) => {
|
|
711
|
+
try {
|
|
712
|
+
const s = parseCss(r.innerHTML);
|
|
713
|
+
if (t.push(...s.diagnostics), hasError(t)) return;
|
|
714
|
+
try {
|
|
715
|
+
r.innerHTML = ((e, t) => {
|
|
716
|
+
const r = t.usedSelectors || null, s = {
|
|
717
|
+
usedSelectors: r || null,
|
|
718
|
+
hasUsedAttrs: !!r && r.attrs.size > 0,
|
|
719
|
+
hasUsedClassNames: !!r && r.classNames.size > 0,
|
|
720
|
+
hasUsedIds: !!r && r.ids.size > 0,
|
|
721
|
+
hasUsedTags: !!r && r.tags.size > 0
|
|
722
|
+
}, n = e.rules;
|
|
723
|
+
if (!n) return "";
|
|
724
|
+
const o = n.length, i = [];
|
|
725
|
+
for (let e = 0; e < o; e++) i.push(serializeCssVisitNode(s, n[e], e, o));
|
|
726
|
+
return i.join("");
|
|
727
|
+
})(s.stylesheet, {
|
|
728
|
+
usedSelectors: e
|
|
729
|
+
});
|
|
730
|
+
} catch (e) {
|
|
731
|
+
t.push({
|
|
732
|
+
level: "warn",
|
|
733
|
+
type: "css",
|
|
734
|
+
header: "CSS Stringify",
|
|
735
|
+
messageText: e
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
} catch (e) {
|
|
739
|
+
t.push({
|
|
740
|
+
level: "warn",
|
|
741
|
+
type: "css",
|
|
742
|
+
header: "CSS Parse",
|
|
743
|
+
messageText: e
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
export { createWindowFromHtml, hydrateDocument, renderToString, serializeDocumentToString };
|