@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,785 @@
|
|
|
1
|
+
var appErrorCss = "#dev-server-modal * { box-sizing: border-box !important; } #dev-server-modal { direction: ltr !important; display: block !important; position: absolute !important; top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important; z-index: 100000; margin: 0 !important; padding: 0 !important; font-family: -apple-system, 'Roboto', BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol' !important; font-size: 14px !important; line-height: 1.5 !important; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; text-size-adjust: none; word-wrap: break-word; color: #333 !important; background-color: white !important; box-sizing: border-box !important; overflow: hidden; user-select: auto; } #dev-server-modal-inner { position: relative !important; padding: 0 0 30px 0 !important; width: 100% !important; height: 100%; overflow-x: hidden; overflow-y: scroll; -webkit-overflow-scrolling: touch; } .dev-server-diagnostic { margin: 20px !important; border: 1px solid #ddd !important; border-radius: 3px !important; } .dev-server-diagnostic-masthead { padding: 8px 12px 12px 12px !important; } .dev-server-diagnostic-title { margin: 0 !important; font-weight: bold !important; color: #222 !important; } .dev-server-diagnostic-message { margin-top: 4px !important; color: #555 !important; } .dev-server-diagnostic-file { position: relative !important; border-top: 1px solid #ddd !important; } .dev-server-diagnostic-file-header { display: block !important; padding: 5px 10px !important; color: #555 !important; border-bottom: 1px solid #ddd !important; border-top-left-radius: 2px !important; border-top-right-radius: 2px !important; background-color: #f9f9f9 !important; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; font-size: 12px !important; } a.dev-server-diagnostic-file-header { color: #0000ee !important; text-decoration: underline !important; } a.dev-server-diagnostic-file-header:hover { text-decoration: none !important; background-color: #f4f4f4 !important; } .dev-server-diagnostic-file-name { font-weight: bold !important; } .dev-server-diagnostic-blob { overflow-x: auto !important; overflow-y: hidden !important; border-bottom-right-radius: 3px !important; border-bottom-left-radius: 3px !important; } .dev-server-diagnostic-table { margin: 0 !important; padding: 0 !important; border-spacing: 0 !important; border-collapse: collapse !important; border-width: 0 !important; border-style: none !important; -moz-tab-size: 2; tab-size: 2; } .dev-server-diagnostic-table td, .dev-server-diagnostic-table th { padding: 0 !important; border-width: 0 !important; border-style: none !important; } td.dev-server-diagnostic-blob-num { padding-right: 10px !important; padding-left: 10px !important; width: 1% !important; min-width: 50px !important; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; font-size: 12px !important; line-height: 20px !important; color: rgba(0, 0, 0, 0.3) !important; text-align: right !important; white-space: nowrap !important; vertical-align: top !important; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; border: solid #eee !important; border-width: 0 1px 0 0 !important; } td.dev-server-diagnostic-blob-num::before { content: attr(data-line-number) !important; } .dev-server-diagnostic-error-line td.dev-server-diagnostic-blob-num { background-color: #ffdddd !important; border-color: #ffc9c9 !important; } .dev-server-diagnostic-error-line td.dev-server-diagnostic-blob-code { background: rgba(255, 221, 221, 0.25) !important; z-index: -1; } .dev-server-diagnostic-open-in-editor td.dev-server-diagnostic-blob-num:hover { cursor: pointer; background-color: #ffffe3 !important; font-weight: bold; } .dev-server-diagnostic-open-in-editor.dev-server-diagnostic-error-line td.dev-server-diagnostic-blob-num:hover { background-color: #ffdada !important; } td.dev-server-diagnostic-blob-code { position: relative !important; padding-right: 10px !important; padding-left: 10px !important; line-height: 20px !important; vertical-align: top !important; overflow: visible !important; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important; font-size: 12px !important; color: #333 !important; word-wrap: normal !important; white-space: pre !important; } td.dev-server-diagnostic-blob-code::before { content: '' !important; } .dev-server-diagnostic-error-chr { position: relative !important; } .dev-server-diagnostic-error-chr::before { position: absolute !important; z-index: -1; top: -3px !important; left: 0px !important; width: 8px !important; height: 20px !important; background-color: #ffdddd !important; content: '' !important; } /** * GitHub Gist Theme * Author : Louis Barranqueiro - https://github.com/LouisBarranqueiro * https://highlightjs.org/ */ .hljs-comment, .hljs-meta { color: #969896; } .hljs-string, .hljs-variable, .hljs-template-variable, .hljs-strong, .hljs-emphasis, .hljs-quote { color: #df5000; } .hljs-keyword, .hljs-selector-tag, .hljs-type { color: #a71d5d; } .hljs-literal, .hljs-symbol, .hljs-bullet, .hljs-attribute { color: #0086b3; } .hljs-section, .hljs-name { color: #63a35c; } .hljs-tag { color: #333333; } .hljs-title, .hljs-attr, .hljs-selector-id, .hljs-selector-class, .hljs-selector-attr, .hljs-selector-pseudo { color: #795da3; } .hljs-addition { color: #55a532; background-color: #eaffea; } .hljs-deletion { color: #bd2c00; background-color: #ffecec; } .hljs-link { text-decoration: underline; }";
|
|
2
|
+
|
|
3
|
+
const appError = (data) => {
|
|
4
|
+
const results = {
|
|
5
|
+
diagnostics: [],
|
|
6
|
+
status: null,
|
|
7
|
+
};
|
|
8
|
+
if (data && data.window && Array.isArray(data.buildResults.diagnostics)) {
|
|
9
|
+
const diagnostics = data.buildResults.diagnostics.filter(diagnostic => diagnostic.level === 'error');
|
|
10
|
+
if (diagnostics.length > 0) {
|
|
11
|
+
const modal = getDevServerModal(data.window.document);
|
|
12
|
+
diagnostics.forEach((diagnostic) => {
|
|
13
|
+
results.diagnostics.push(diagnostic);
|
|
14
|
+
appendDiagnostic(data.window.document, data.openInEditor, modal, diagnostic);
|
|
15
|
+
});
|
|
16
|
+
results.status = 'error';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return results;
|
|
20
|
+
};
|
|
21
|
+
const appendDiagnostic = (doc, openInEditor, modal, diagnostic) => {
|
|
22
|
+
const card = doc.createElement('div');
|
|
23
|
+
card.className = 'dev-server-diagnostic';
|
|
24
|
+
const masthead = doc.createElement('div');
|
|
25
|
+
masthead.className = 'dev-server-diagnostic-masthead';
|
|
26
|
+
masthead.title = `${escapeHtml(diagnostic.type)} error: ${escapeHtml(diagnostic.code)}`;
|
|
27
|
+
card.appendChild(masthead);
|
|
28
|
+
const title = doc.createElement('div');
|
|
29
|
+
title.className = 'dev-server-diagnostic-title';
|
|
30
|
+
if (typeof diagnostic.header === 'string' && diagnostic.header.trim().length > 0) {
|
|
31
|
+
title.textContent = diagnostic.header;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
title.textContent = `${titleCase(diagnostic.type)} ${titleCase(diagnostic.level)}`;
|
|
35
|
+
}
|
|
36
|
+
masthead.appendChild(title);
|
|
37
|
+
const message = doc.createElement('div');
|
|
38
|
+
message.className = 'dev-server-diagnostic-message';
|
|
39
|
+
message.textContent = diagnostic.messageText;
|
|
40
|
+
masthead.appendChild(message);
|
|
41
|
+
const file = doc.createElement('div');
|
|
42
|
+
file.className = 'dev-server-diagnostic-file';
|
|
43
|
+
card.appendChild(file);
|
|
44
|
+
const isUrl = typeof diagnostic.absFilePath === 'string' && diagnostic.absFilePath.indexOf('http') === 0;
|
|
45
|
+
const canOpenInEditor = typeof openInEditor === 'function' && typeof diagnostic.absFilePath === 'string' && !isUrl;
|
|
46
|
+
if (isUrl) {
|
|
47
|
+
const fileHeader = doc.createElement('a');
|
|
48
|
+
fileHeader.href = diagnostic.absFilePath;
|
|
49
|
+
fileHeader.setAttribute('target', '_blank');
|
|
50
|
+
fileHeader.setAttribute('rel', 'noopener noreferrer');
|
|
51
|
+
fileHeader.className = 'dev-server-diagnostic-file-header';
|
|
52
|
+
const filePath = doc.createElement('span');
|
|
53
|
+
filePath.className = 'dev-server-diagnostic-file-path';
|
|
54
|
+
filePath.textContent = diagnostic.absFilePath;
|
|
55
|
+
fileHeader.appendChild(filePath);
|
|
56
|
+
file.appendChild(fileHeader);
|
|
57
|
+
}
|
|
58
|
+
else if (diagnostic.relFilePath) {
|
|
59
|
+
const fileHeader = doc.createElement(canOpenInEditor ? 'a' : 'div');
|
|
60
|
+
fileHeader.className = 'dev-server-diagnostic-file-header';
|
|
61
|
+
if (diagnostic.absFilePath) {
|
|
62
|
+
fileHeader.title = escapeHtml(diagnostic.absFilePath);
|
|
63
|
+
if (canOpenInEditor) {
|
|
64
|
+
addOpenInEditor(openInEditor, fileHeader, diagnostic.absFilePath, diagnostic.lineNumber, diagnostic.columnNumber);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const parts = diagnostic.relFilePath.split('/');
|
|
68
|
+
const fileName = doc.createElement('span');
|
|
69
|
+
fileName.className = 'dev-server-diagnostic-file-name';
|
|
70
|
+
fileName.textContent = parts.pop();
|
|
71
|
+
const filePath = doc.createElement('span');
|
|
72
|
+
filePath.className = 'dev-server-diagnostic-file-path';
|
|
73
|
+
filePath.textContent = parts.join('/') + '/';
|
|
74
|
+
fileHeader.appendChild(filePath);
|
|
75
|
+
fileHeader.appendChild(fileName);
|
|
76
|
+
file.appendChild(fileHeader);
|
|
77
|
+
}
|
|
78
|
+
if (diagnostic.lines && diagnostic.lines.length > 0) {
|
|
79
|
+
const blob = doc.createElement('div');
|
|
80
|
+
blob.className = 'dev-server-diagnostic-blob';
|
|
81
|
+
file.appendChild(blob);
|
|
82
|
+
const table = doc.createElement('table');
|
|
83
|
+
table.className = 'dev-server-diagnostic-table';
|
|
84
|
+
blob.appendChild(table);
|
|
85
|
+
prepareLines(diagnostic.lines).forEach(l => {
|
|
86
|
+
const tr = doc.createElement('tr');
|
|
87
|
+
if (l.errorCharStart > 0) {
|
|
88
|
+
tr.classList.add('dev-server-diagnostic-error-line');
|
|
89
|
+
}
|
|
90
|
+
if (canOpenInEditor) {
|
|
91
|
+
tr.classList.add('dev-server-diagnostic-open-in-editor');
|
|
92
|
+
}
|
|
93
|
+
table.appendChild(tr);
|
|
94
|
+
const tdNum = doc.createElement('td');
|
|
95
|
+
tdNum.className = 'dev-server-diagnostic-blob-num';
|
|
96
|
+
if (l.lineNumber > 0) {
|
|
97
|
+
tdNum.setAttribute('data-line-number', l.lineNumber + '');
|
|
98
|
+
tdNum.title = escapeHtml(diagnostic.relFilePath) + ', line ' + l.lineNumber;
|
|
99
|
+
if (canOpenInEditor) {
|
|
100
|
+
const column = l.lineNumber === diagnostic.lineNumber ? diagnostic.columnNumber : 1;
|
|
101
|
+
addOpenInEditor(openInEditor, tdNum, diagnostic.absFilePath, l.lineNumber, column);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
tr.appendChild(tdNum);
|
|
105
|
+
const tdCode = doc.createElement('td');
|
|
106
|
+
tdCode.className = 'dev-server-diagnostic-blob-code';
|
|
107
|
+
tdCode.innerHTML = highlightError(l.text, l.errorCharStart, l.errorLength);
|
|
108
|
+
tr.appendChild(tdCode);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
modal.appendChild(card);
|
|
112
|
+
};
|
|
113
|
+
const addOpenInEditor = (openInEditor, elm, file, line, column) => {
|
|
114
|
+
if (elm.tagName === 'A') {
|
|
115
|
+
elm.href = '#open-in-editor';
|
|
116
|
+
}
|
|
117
|
+
if (typeof line !== 'number' || line < 1) {
|
|
118
|
+
line = 1;
|
|
119
|
+
}
|
|
120
|
+
if (typeof column !== 'number' || column < 1) {
|
|
121
|
+
column = 1;
|
|
122
|
+
}
|
|
123
|
+
elm.addEventListener('click', ev => {
|
|
124
|
+
ev.preventDefault();
|
|
125
|
+
ev.stopPropagation();
|
|
126
|
+
openInEditor({
|
|
127
|
+
file: file,
|
|
128
|
+
line: line,
|
|
129
|
+
column: column,
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
const getDevServerModal = (doc) => {
|
|
134
|
+
let outer = doc.getElementById(DEV_SERVER_MODAL);
|
|
135
|
+
if (!outer) {
|
|
136
|
+
outer = doc.createElement('div');
|
|
137
|
+
outer.id = DEV_SERVER_MODAL;
|
|
138
|
+
outer.setAttribute('role', 'dialog');
|
|
139
|
+
doc.body.appendChild(outer);
|
|
140
|
+
}
|
|
141
|
+
outer.innerHTML = `<style>${appErrorCss}</style><div id="${DEV_SERVER_MODAL}-inner"></div>`;
|
|
142
|
+
return doc.getElementById(`${DEV_SERVER_MODAL}-inner`);
|
|
143
|
+
};
|
|
144
|
+
const clearAppErrorModal = (data) => {
|
|
145
|
+
const appErrorElm = data.window.document.getElementById(DEV_SERVER_MODAL);
|
|
146
|
+
if (appErrorElm) {
|
|
147
|
+
appErrorElm.parentNode.removeChild(appErrorElm);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const escapeHtml = (unsafe) => {
|
|
151
|
+
if (typeof unsafe === 'number' || typeof unsafe === 'boolean') {
|
|
152
|
+
return unsafe.toString();
|
|
153
|
+
}
|
|
154
|
+
if (typeof unsafe === 'string') {
|
|
155
|
+
return unsafe.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
|
|
156
|
+
}
|
|
157
|
+
return '';
|
|
158
|
+
};
|
|
159
|
+
const titleCase = (str) => str.charAt(0).toUpperCase() + str.substr(1);
|
|
160
|
+
const highlightError = (text, errorCharStart, errorLength) => {
|
|
161
|
+
if (typeof text !== 'string') {
|
|
162
|
+
return '';
|
|
163
|
+
}
|
|
164
|
+
const errorCharEnd = errorCharStart + errorLength;
|
|
165
|
+
return text
|
|
166
|
+
.split('')
|
|
167
|
+
.map((inputChar, charIndex) => {
|
|
168
|
+
let outputChar;
|
|
169
|
+
if (inputChar === `<`) {
|
|
170
|
+
outputChar = `<`;
|
|
171
|
+
}
|
|
172
|
+
else if (inputChar === `>`) {
|
|
173
|
+
outputChar = `>`;
|
|
174
|
+
}
|
|
175
|
+
else if (inputChar === `"`) {
|
|
176
|
+
outputChar = `"`;
|
|
177
|
+
}
|
|
178
|
+
else if (inputChar === `'`) {
|
|
179
|
+
outputChar = `'`;
|
|
180
|
+
}
|
|
181
|
+
else if (inputChar === `&`) {
|
|
182
|
+
outputChar = `&`;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
outputChar = inputChar;
|
|
186
|
+
}
|
|
187
|
+
if (charIndex >= errorCharStart && charIndex < errorCharEnd) {
|
|
188
|
+
outputChar = `<span class="dev-server-diagnostic-error-chr">${outputChar}</span>`;
|
|
189
|
+
}
|
|
190
|
+
return outputChar;
|
|
191
|
+
})
|
|
192
|
+
.join('');
|
|
193
|
+
};
|
|
194
|
+
const prepareLines = (orgLines) => {
|
|
195
|
+
const lines = JSON.parse(JSON.stringify(orgLines));
|
|
196
|
+
for (let i = 0; i < 100; i++) {
|
|
197
|
+
if (!eachLineHasLeadingWhitespace(lines)) {
|
|
198
|
+
return lines;
|
|
199
|
+
}
|
|
200
|
+
for (let i = 0; i < lines.length; i++) {
|
|
201
|
+
lines[i].text = lines[i].text.substr(1);
|
|
202
|
+
lines[i].errorCharStart--;
|
|
203
|
+
if (!lines[i].text.length) {
|
|
204
|
+
return lines;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return lines;
|
|
209
|
+
};
|
|
210
|
+
const eachLineHasLeadingWhitespace = (lines) => {
|
|
211
|
+
if (!lines.length) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
for (let i = 0; i < lines.length; i++) {
|
|
215
|
+
if (!lines[i].text || lines[i].text.length < 1) {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
const firstChar = lines[i].text.charAt(0);
|
|
219
|
+
if (firstChar !== ' ' && firstChar !== '\t') {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return true;
|
|
224
|
+
};
|
|
225
|
+
const DEV_SERVER_MODAL = `dev-server-modal`;
|
|
226
|
+
|
|
227
|
+
const emitBuildLog = (win, buildLog) => {
|
|
228
|
+
win.dispatchEvent(new CustomEvent(BUILD_LOG, { detail: buildLog }));
|
|
229
|
+
};
|
|
230
|
+
const emitBuildResults = (win, buildResults) => {
|
|
231
|
+
win.dispatchEvent(new CustomEvent(BUILD_RESULTS, { detail: buildResults }));
|
|
232
|
+
};
|
|
233
|
+
const emitBuildStatus = (win, buildStatus) => {
|
|
234
|
+
win.dispatchEvent(new CustomEvent(BUILD_STATUS, { detail: buildStatus }));
|
|
235
|
+
};
|
|
236
|
+
const onBuildLog = (win, cb) => {
|
|
237
|
+
win.addEventListener(BUILD_LOG, (ev) => {
|
|
238
|
+
cb(ev.detail);
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
const onBuildResults = (win, cb) => {
|
|
242
|
+
win.addEventListener(BUILD_RESULTS, (ev) => {
|
|
243
|
+
cb(ev.detail);
|
|
244
|
+
});
|
|
245
|
+
};
|
|
246
|
+
const onBuildStatus = (win, cb) => {
|
|
247
|
+
win.addEventListener(BUILD_STATUS, (ev) => {
|
|
248
|
+
cb(ev.detail);
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
const BUILD_LOG = `devserver:buildlog`;
|
|
252
|
+
const BUILD_RESULTS = `devserver:buildresults`;
|
|
253
|
+
const BUILD_STATUS = `devserver:buildstatus`;
|
|
254
|
+
|
|
255
|
+
const initBuildProgress = (data) => {
|
|
256
|
+
const win = data.window;
|
|
257
|
+
const doc = win.document;
|
|
258
|
+
const barColor = `#5851ff`;
|
|
259
|
+
const errorColor = `#b70c19`;
|
|
260
|
+
let addBarTimerId;
|
|
261
|
+
let removeBarTimerId;
|
|
262
|
+
let opacityTimerId;
|
|
263
|
+
let incIntervalId;
|
|
264
|
+
let progressIncrease;
|
|
265
|
+
let currentProgress = 0;
|
|
266
|
+
function update() {
|
|
267
|
+
clearTimeout(opacityTimerId);
|
|
268
|
+
clearTimeout(removeBarTimerId);
|
|
269
|
+
const progressBar = getProgressBar();
|
|
270
|
+
if (!progressBar) {
|
|
271
|
+
createProgressBar();
|
|
272
|
+
addBarTimerId = setTimeout(update, 16);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
progressBar.style.background = barColor;
|
|
276
|
+
progressBar.style.opacity = `1`;
|
|
277
|
+
progressBar.style.transform = `scaleX(${Math.min(1, displayProgress())})`;
|
|
278
|
+
if (incIntervalId == null) {
|
|
279
|
+
incIntervalId = setInterval(() => {
|
|
280
|
+
progressIncrease += Math.random() * 0.05 + 0.01;
|
|
281
|
+
if (displayProgress() < 0.9) {
|
|
282
|
+
update();
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
clearInterval(incIntervalId);
|
|
286
|
+
}
|
|
287
|
+
}, 800);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
function reset() {
|
|
291
|
+
clearInterval(incIntervalId);
|
|
292
|
+
progressIncrease = 0.05;
|
|
293
|
+
incIntervalId = null;
|
|
294
|
+
clearTimeout(opacityTimerId);
|
|
295
|
+
clearTimeout(addBarTimerId);
|
|
296
|
+
clearTimeout(removeBarTimerId);
|
|
297
|
+
const progressBar = getProgressBar();
|
|
298
|
+
if (progressBar) {
|
|
299
|
+
if (currentProgress >= 1) {
|
|
300
|
+
progressBar.style.transform = `scaleX(1)`;
|
|
301
|
+
}
|
|
302
|
+
opacityTimerId = setTimeout(() => {
|
|
303
|
+
try {
|
|
304
|
+
const progressBar = getProgressBar();
|
|
305
|
+
if (progressBar) {
|
|
306
|
+
progressBar.style.opacity = `0`;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
catch (e) { }
|
|
310
|
+
}, 150);
|
|
311
|
+
removeBarTimerId = setTimeout(() => {
|
|
312
|
+
try {
|
|
313
|
+
const progressBar = getProgressBar();
|
|
314
|
+
if (progressBar) {
|
|
315
|
+
progressBar.parentNode.removeChild(progressBar);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
catch (e) { }
|
|
319
|
+
}, 1000);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
function displayProgress() {
|
|
323
|
+
const p = currentProgress + progressIncrease;
|
|
324
|
+
return Math.max(0, Math.min(1, p));
|
|
325
|
+
}
|
|
326
|
+
reset();
|
|
327
|
+
onBuildLog(win, buildLog => {
|
|
328
|
+
currentProgress = buildLog.progress;
|
|
329
|
+
if (currentProgress >= 0 && currentProgress < 1) {
|
|
330
|
+
update();
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
reset();
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
onBuildResults(win, buildResults => {
|
|
337
|
+
if (buildResults.hasError) {
|
|
338
|
+
const progressBar = getProgressBar();
|
|
339
|
+
if (progressBar) {
|
|
340
|
+
progressBar.style.transform = `scaleX(1)`;
|
|
341
|
+
progressBar.style.background = errorColor;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
reset();
|
|
345
|
+
});
|
|
346
|
+
onBuildStatus(win, buildStatus => {
|
|
347
|
+
if (buildStatus === 'disabled') {
|
|
348
|
+
reset();
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
if (doc.head.dataset.tmpl === 'tmpl-initial-load') {
|
|
352
|
+
update();
|
|
353
|
+
}
|
|
354
|
+
const PROGRESS_BAR_ID = `dev-server-progress-bar`;
|
|
355
|
+
function getProgressBar() {
|
|
356
|
+
return doc.getElementById(PROGRESS_BAR_ID);
|
|
357
|
+
}
|
|
358
|
+
function createProgressBar() {
|
|
359
|
+
const progressBar = doc.createElement('div');
|
|
360
|
+
progressBar.id = PROGRESS_BAR_ID;
|
|
361
|
+
progressBar.style.position = `absolute`;
|
|
362
|
+
progressBar.style.top = `0`;
|
|
363
|
+
progressBar.style.left = `0`;
|
|
364
|
+
progressBar.style.zIndex = `100001`;
|
|
365
|
+
progressBar.style.width = `100%`;
|
|
366
|
+
progressBar.style.height = `2px`;
|
|
367
|
+
progressBar.style.transform = `scaleX(0)`;
|
|
368
|
+
progressBar.style.opacity = `1`;
|
|
369
|
+
progressBar.style.background = barColor;
|
|
370
|
+
progressBar.style.transformOrigin = `left center`;
|
|
371
|
+
progressBar.style.transition = `transform .1s ease-in-out, opacity .5s ease-in`;
|
|
372
|
+
progressBar.style.contain = `strict`;
|
|
373
|
+
doc.body.appendChild(progressBar);
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
const initBuildStatus = (data) => {
|
|
378
|
+
const win = data.window;
|
|
379
|
+
const doc = win.document;
|
|
380
|
+
const iconElms = getFavIcons(doc);
|
|
381
|
+
iconElms.forEach(iconElm => {
|
|
382
|
+
if (iconElm.href) {
|
|
383
|
+
iconElm.dataset.href = iconElm.href;
|
|
384
|
+
iconElm.dataset.type = iconElm.type;
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
onBuildStatus(win, buildStatus => {
|
|
388
|
+
updateBuildStatus(doc, buildStatus);
|
|
389
|
+
});
|
|
390
|
+
};
|
|
391
|
+
const updateBuildStatus = (doc, status) => {
|
|
392
|
+
const iconElms = getFavIcons(doc);
|
|
393
|
+
iconElms.forEach(iconElm => {
|
|
394
|
+
updateFavIcon(iconElm, status);
|
|
395
|
+
});
|
|
396
|
+
};
|
|
397
|
+
const updateFavIcon = (linkElm, status) => {
|
|
398
|
+
if (status === 'pending') {
|
|
399
|
+
linkElm.href = ICON_PENDING;
|
|
400
|
+
linkElm.type = ICON_TYPE;
|
|
401
|
+
linkElm.setAttribute('data-status', status);
|
|
402
|
+
}
|
|
403
|
+
else if (status === 'error') {
|
|
404
|
+
linkElm.href = ICON_ERROR;
|
|
405
|
+
linkElm.type = ICON_TYPE;
|
|
406
|
+
linkElm.setAttribute('data-status', status);
|
|
407
|
+
}
|
|
408
|
+
else if (status === 'disabled') {
|
|
409
|
+
linkElm.href = ICON_DISABLED;
|
|
410
|
+
linkElm.type = ICON_TYPE;
|
|
411
|
+
linkElm.setAttribute('data-status', status);
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
linkElm.removeAttribute('data-status');
|
|
415
|
+
if (linkElm.dataset.href) {
|
|
416
|
+
linkElm.href = linkElm.dataset.href;
|
|
417
|
+
linkElm.type = linkElm.dataset.type;
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
linkElm.href = ICON_DEFAULT;
|
|
421
|
+
linkElm.type = ICON_TYPE;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
const getFavIcons = (doc) => {
|
|
426
|
+
const iconElms = [];
|
|
427
|
+
const linkElms = doc.querySelectorAll('link');
|
|
428
|
+
for (let i = 0; i < linkElms.length; i++) {
|
|
429
|
+
if (linkElms[i].href && linkElms[i].rel && (linkElms[i].rel.indexOf('shortcut') > -1 || linkElms[i].rel.indexOf('icon') > -1)) {
|
|
430
|
+
iconElms.push(linkElms[i]);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
if (iconElms.length === 0) {
|
|
434
|
+
const linkElm = doc.createElement('link');
|
|
435
|
+
linkElm.rel = 'shortcut icon';
|
|
436
|
+
doc.head.appendChild(linkElm);
|
|
437
|
+
iconElms.push(linkElm);
|
|
438
|
+
}
|
|
439
|
+
return iconElms;
|
|
440
|
+
};
|
|
441
|
+
const ICON_DEFAULT = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAMAAABlApw1AAAAnFBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4jUzeAAAAM3RSTlMAsGDs4wML8QEbBvr2FMhAM7+ILCUPnNzXrX04otO6j3RiT0ggzLSTcmtWUUWoZlknghZc2mZzAAACrklEQVR42u3dWXLiUAyFYWEwg40x8wxhSIAwJtH+99ZVeeinfriXVpWk5Hyr+C2VrgkAAAAAAAAAAAw5sZQ7aUhYypw07FjKC2ko2yxk2SQFgwYLOWSkYFhlIZ06KWhNWMhqRApGKxYyaZGCeoeFVIekIDuwkEaXFDSXLKRdkoYjS9mRhjlLSUjDO0s5kYYzS+mThn3OQsYqAbQQC7hZSgoGYgHUy0jBa42FvKkEUDERC6CCFIzeWEjtlRRkPbGAG5CCtCIWQAtS0ByzkHxPGvos5UEaNizlnTRsWconhbM4wTpSFHMTrFtKCroNFrLGBOsJLbGAWxWkoFiJBRAmWE/I1r4nWOmNheTeJ1gX0vDJUrYUweAEa04aHs5XePvc9wpPboJ1SCmOsRVkr04aromUEQEAgB9lxaZ++ATFpNDv6Y8qm1QdBk9QTAr9ni6mbFK7DJ6g2LQLXoHZlFCQdMY2nYJXYDb1g1dgNo2boSswm2Zp6ArMptCFyIVtCl2IlDmbNC0QcPEQcD8l4HLvAXdxHnBb5wG3QcDFQ8D9mIDrIeCiIeDiA25oNeA+EHDREHDxAbdmmxBwT0HARQbciW0KDbiEbQoNuB3bFBxwbTYJAfcUBFxkwFG/YlNJAADgxzCRcqUY9m7KGgNSUEx9H3XXO76Puv/OY5wedX/flHk+6j46v2maO79purPvm6Yz+75puua+b5q6Dd/PEsrNMyZfFM5gAMW+ymPtWciYV3ksBpBOwKUH3wHXXLKUM2l4cR5wG+cBlzgPuJ3zgJNb6FRwlP4Ln1X8wrOKeFbxP6Qz3wEn+KzilWLYe5UnMuDwY5BvD+cBt899B9zC+49Bqr4DrlXzHXDF1HfA1Tu+Ay5b+w649OY74OjoO+Bo7jzg7s4DDgAAAAAAAAAA/u0POrfnVIaqz/QAAAAASUVORK5CYII=';
|
|
442
|
+
const ICON_PENDING = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAMAAABlApw1AAAAjVBMVEUAAAD8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjL8kjLn7xn3AAAALnRSTlMAsFBgAaDxfPpAdTMcD/fs47kDBhVXJQpvLNbInIiBRvSqIb+TZ2OOONxdzUxpgKSpAAAAA69JREFUeNrt3FtvskAQxvERFQXFioqnCkqth572+3+8947dN00TliF5ZpP53ZOAveg/OzCklFJKKaWUUkoppQTZm77cCGFo+jIhhG/TlwchJAvTk/GIAA6x6Um+JoDti+nJ644A5h+mJ8eMALKj6cnHnAB2r80NLJ4jf3Vz+cuWANZ5cwPTM/l7by6PZwQwGptGQf4q++dLCOHdNIbkb2IvjwjAvYEf8pe6j4/wYxopr/9SQih4BXa3l5eEcJ7a++c9/gkSQE8bcCWvXwcrAjjYADrxHv8KCbi3JasgD5fm8i9IAG1swMXzDv0X2wDaEED21dzA5UDeVoPm8uUbAayvvAI42YA7EIDzA5pv8lc6/UoAoxMv4CZuvyKUpnHn9VNBAG6B7XkBtCeEO6/AbvbyihAiXsB92svfCcA9wap4j19DAmgWs37AZCrnBKvu8vgX9AmWE3BZh/6L7QkWJIA2RxtwHQpml9sAQp9gXWbkbxz4CdYDfIK1qk1j3IV9fPgJFlNECJXhYfSfsBHkhBCKwEd452nYI7wncwQJP8GKTU+uO0I4D/uSkVJKqXAkA5nK9icoIi3nrU9QRHrZtj5BESmetT5BEantPCh7NTJFrUdgMg1bj8BkSv1HYJ8RmjMQKf1HYDdC+/R/IyQFzbD4AxH+CIyPPxCJoEdQ/IFIMgXNEPkDkd8jMLQs5wRcTXA1J+By/BGO+0ovYwQGU3kPRLJfIzCkCSfgpgmhpc5AxD/gIkLb8wKO0DTgoNyaGQQecNfQAy7TgGtHA04DLtyA24UecHngAVdrwIkJuAitU8DJ1Dbghkam9gEnU+uAWxiRjhsdoXagI1TPgKNyIBO+ZpRSSrW3HfblTAA9/juPDwTAfiMK9VG3PY/hwX7Ubc9j+AoCWNWGp+NSH4HflE2IgXUEGPI3TTfmN4ndv2kSsRUJvpUn4W1FShbYb5rc84ySAtzKs3W3IgW4lWfO24q0zsFbebIjaysSjbtt5RHzUf0DHHCrAW8gVYEDzl0LGYW4lefB24uYQgOOfwN7dMANeW/k3DkBJ2CrUNE54GRsFYIHnPNR+iPEgHPWKo5DDDhnrWKeBRhwzlrFeNtlq5CgtYqzAAPODaBzgAH331rFAAOOqsDXKjL3IqboN7ILJ4BCDDh3r3SIAfd0AijEgHP3So/8wQNuvjRBbxVij5A6Bpy8EZJnwIkbIfkFnLwRkm/ASRshXbwDTtYICRRwt7BHqEoppZRSSimllFLqD/8AOXJZHefotiIAAAAASUVORK5CYII=';
|
|
443
|
+
const ICON_ERROR = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAMAAABlApw1AAAAkFBMVEUAAAD5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0H5Q0HYvLBZAAAAL3RSTlMAsGDjA/rsC/ElHRUBBssz9pFCvoh0UEcsD9ec3K19OLiiaNLEYlmoVeiCbmE+GuMl4I8AAAKQSURBVHja7d1njupQDIZhAymEUIZQQu9taN7/7q50pfl/TmTJtvQ9q3hzLDsEAAAAAAAAAACGzFjKiTS0WcqONMxZypg0fH5YyLFPChZdFnIYkILil4VcclLw3bCQ85IULM8sZPMlBfmFhfwWpGBwYCHdESnoH1nIz4c0jFnKnDTsWEqbNJxYyow03FjKlDTUKQtZqwTQXizgtgkpWGQsZKIScL0OCxmqBFC5EQugkhQshyyk0yMFgwkLyRakIGmJBdCeFPTXLCStScOUpdwogsEXrBdpuLKUJ4XDC9afKmUh94QUjLy/YGViAZRTOIMBtypJQXn2HUC5WMBleMFqILmzkLSicBZfsB6k4clSrqTh5XyEd3MeQHXqe4Qn94LVSiicwRHkJScNdVvKkgAAwI+qZdM0/AXFpE4v+AXFpKwIfkExKfR7ulyxSWkV/IJi0zx4BGbTm4IkW7ZpFjwCs2kaPAKzad0PHYHZtE1CR2A2TQahIzCbhnnwCMykVYmAi4aAQ8BZ4T3grgi4BhBwCDgbEHCNIOAQcCYg4BpCwCHgLEDAaYgPuDfbhIBrBAGHgDMhNOBo2rKpIgAA8KNoS6kplq2dsu6CFJQr30vd+dD3Uvf/nTLHS93J3flZwrHznaad852mE/veaXqw752mKvW90zTq+j5LWGS+r/J8xQKoU1AUa2chm1zlsXQWUifgkoPvgOsffQccjZ0H3Mx5wL2dB9zcecB9sJTePOBM3cU+46wiziq6C7hk6zvg3J9VfDK7vir0ch5wN+cBV6e+A27v/ccgme+AkxshTXKKYW6EFH0X29gIKTLgzI2QYgPO2ggpLuDsvaDEBZy9EVJcwBkcIT0IAAAAAAAAAADs+AdjeyF69/r87QAAAABJRU5ErkJggg==';
|
|
444
|
+
const ICON_DISABLED = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAMAAABlApw1AAAAeFBMVEUAAAC4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7+4t7/uGGySAAAAJ3RSTlMAsGAE7OMcAQvxJRX69kHWyL8zq5GIdEcsD5zcfVg4uKLNa1JPZoK/xdPIAAACiklEQVR42u3dW5KqUAyF4QgCCggqIt7t9pb5z/Ccvjz2w95UqpJ0r28Uf2WTQAAAAAAAAAAAYMiWpTxJQ8JSTqThwVI2pKFZsJC3ghTs5izkmpKCcspCljNSkB9ZSLsnBfuWhRxzUjBbspBpSQrSKwuZr0lB8cZCFg1p2LCUB2k4sZSENNxYypY0nFlKTxqGmoUcClJwEQu4SUoKdmIBtEpJQZ6xkHeVAKqOYgFUkYL9OwvJclKQrsQCbkcK0olYAF1IQXFgIfVAGnqWcqZwFidYN4phb4L1onCYYMlPsLqUFKwxwRozwTIYcG1FCqrWdwBhgqU7wUo7FlJ7n2DdScPL+RPezfkT3tl5AA217yc89xMssYBbzUjDkEjZEwAA+NFMbOrDJygmZXnwBMWkaRk8QTFpvg6eoJi0aIInKDY9gp/AbEqCJyg2bYOfwGzqKUzPNh2K0Ccwm0IfRBK2KfSLkDvbFPog0tRsUlsh4EZAwP2SgKu9B9wdATcOAg4BZwACbgQEHALOCATcCAg4BJwVCLhREHB/LOAebFNwwC3YJATcKAi4yICjfmJTQwAA4EeZSBkojrWdsvmO4hjbKYtd6ra2Uxa71G1tp0xnqbvo+IPfpe4Nf3K703Ridr3T9OQPfnea7szseaepqX3vNH3NM/xe5fmeZ7i9yiMXQFlJEeydhYy4ymMygCICzmQAxQactbOQMQFnMoBiAs7iVaHIgDN3VSgq4AxeFYoOOGNXhbCUPkaJs4o4q/iXzyp2vgPO/VnFl/OAu/F/jq8KnZ0H3FD7DriL9x+DTH0HXJ75Driq9R1ws6XvgEuvvgOu6HwHHG18BxydnAfc03nAAQAAAAAAAADAz/4BoL2Us9XM2zMAAAAASUVORK5CYII=';
|
|
445
|
+
const ICON_TYPE = 'image/x-icon';
|
|
446
|
+
|
|
447
|
+
const logBuild = (msg) => log(BLUE, 'Build', msg);
|
|
448
|
+
const logReload = (msg) => logWarn('Reload', msg);
|
|
449
|
+
const logWarn = (prefix, msg) => log(YELLOW, prefix, msg);
|
|
450
|
+
const logDisabled = (prefix, msg) => log(GRAY, prefix, msg);
|
|
451
|
+
const logDiagnostic = (diag) => {
|
|
452
|
+
const diagnostic = diag;
|
|
453
|
+
let color = RED;
|
|
454
|
+
let prefix = 'Error';
|
|
455
|
+
if (diagnostic.level === 'warn') {
|
|
456
|
+
color = YELLOW;
|
|
457
|
+
prefix = 'Warning';
|
|
458
|
+
}
|
|
459
|
+
if (diagnostic.header) {
|
|
460
|
+
prefix = diagnostic.header;
|
|
461
|
+
}
|
|
462
|
+
let msg = ``;
|
|
463
|
+
if (diagnostic.relFilePath) {
|
|
464
|
+
msg += diagnostic.relFilePath;
|
|
465
|
+
if (typeof diagnostic.lineNumber === 'number' && diagnostic.lineNumber > 0) {
|
|
466
|
+
msg += ', line ' + diagnostic.lineNumber;
|
|
467
|
+
if (typeof diagnostic.columnNumber === 'number' && diagnostic.columnNumber > 0) {
|
|
468
|
+
msg += ', column ' + diagnostic.columnNumber;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
msg += `\n`;
|
|
472
|
+
}
|
|
473
|
+
msg += diagnostic.messageText;
|
|
474
|
+
log(color, prefix, msg);
|
|
475
|
+
};
|
|
476
|
+
const log = (color, prefix, msg) => {
|
|
477
|
+
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.indexOf('Trident') > -1) {
|
|
478
|
+
console.log(prefix, msg);
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
console.log.apply(console, ['%c' + prefix, `background: ${color}; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;`, msg]);
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
const YELLOW = `#f39c12`;
|
|
485
|
+
const RED = `#c0392b`;
|
|
486
|
+
const BLUE = `#3498db`;
|
|
487
|
+
const GRAY = `#717171`;
|
|
488
|
+
|
|
489
|
+
const getHmrHref = (versionId, fileName, testUrl) => {
|
|
490
|
+
if (typeof testUrl === 'string' && testUrl.trim() !== '') {
|
|
491
|
+
if (getUrlFileName(fileName) === getUrlFileName(testUrl)) {
|
|
492
|
+
// only compare by filename w/out querystrings, not full path
|
|
493
|
+
return setHmrQueryString(testUrl, versionId);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
return testUrl;
|
|
497
|
+
};
|
|
498
|
+
const getUrlFileName = (url) => {
|
|
499
|
+
// not using URL because IE11 doesn't support it
|
|
500
|
+
const splt = url.split('/');
|
|
501
|
+
return splt[splt.length - 1].split('&')[0].split('?')[0];
|
|
502
|
+
};
|
|
503
|
+
const parseQuerystring = (oldQs) => {
|
|
504
|
+
const newQs = {};
|
|
505
|
+
if (typeof oldQs === 'string') {
|
|
506
|
+
oldQs.split('&').forEach(kv => {
|
|
507
|
+
const splt = kv.split('=');
|
|
508
|
+
newQs[splt[0]] = splt[1] ? splt[1] : '';
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
return newQs;
|
|
512
|
+
};
|
|
513
|
+
const stringifyQuerystring = (qs) => Object.keys(qs)
|
|
514
|
+
.map(key => key + '=' + qs[key])
|
|
515
|
+
.join('&');
|
|
516
|
+
const setQueryString = (url, qsKey, qsValue) => {
|
|
517
|
+
// not using URL because IE11 doesn't support it
|
|
518
|
+
const urlSplt = url.split('?');
|
|
519
|
+
const urlPath = urlSplt[0];
|
|
520
|
+
const qs = parseQuerystring(urlSplt[1]);
|
|
521
|
+
qs[qsKey] = qsValue;
|
|
522
|
+
return urlPath + '?' + stringifyQuerystring(qs);
|
|
523
|
+
};
|
|
524
|
+
const setHmrQueryString = (url, versionId) => setQueryString(url, 's-hmr', versionId);
|
|
525
|
+
const updateCssUrlValue = (versionId, fileName, oldCss) => {
|
|
526
|
+
const reg = /url\((['"]?)(.*)\1\)/gi;
|
|
527
|
+
let result;
|
|
528
|
+
let newCss = oldCss;
|
|
529
|
+
while ((result = reg.exec(oldCss)) !== null) {
|
|
530
|
+
const url = result[2];
|
|
531
|
+
newCss = newCss.replace(url, getHmrHref(versionId, fileName, url));
|
|
532
|
+
}
|
|
533
|
+
return newCss;
|
|
534
|
+
};
|
|
535
|
+
const isLinkStylesheet = (elm) => elm.nodeName.toLowerCase() === 'link' && elm.href && elm.rel && elm.rel.toLowerCase() === 'stylesheet';
|
|
536
|
+
const isTemplate = (elm) => elm.nodeName.toLowerCase() === 'template' && !!elm.content && elm.content.nodeType === 11;
|
|
537
|
+
const setHmrAttr = (elm, versionId) => elm.setAttribute('data-hmr', versionId);
|
|
538
|
+
const hasShadowRoot = (elm) => !!elm.shadowRoot && elm.shadowRoot.nodeType === 11 && elm.shadowRoot !== elm;
|
|
539
|
+
const isElement = (elm) => !!elm && elm.nodeType === 1 && !!elm.getAttribute;
|
|
540
|
+
|
|
541
|
+
const hmrComponents = (elm, versionId, hmrTagNames) => {
|
|
542
|
+
const updatedTags = [];
|
|
543
|
+
hmrTagNames.forEach(hmrTagName => {
|
|
544
|
+
hmrComponent(updatedTags, elm, versionId, hmrTagName);
|
|
545
|
+
});
|
|
546
|
+
return updatedTags.sort();
|
|
547
|
+
};
|
|
548
|
+
const hmrComponent = (updatedTags, elm, versionId, cmpTagName) => {
|
|
549
|
+
// drill down through every node in the page
|
|
550
|
+
// to include shadow roots and look for this
|
|
551
|
+
// component tag to run hmr() on
|
|
552
|
+
if (elm.nodeName.toLowerCase() === cmpTagName && typeof elm['s-hmr'] === 'function') {
|
|
553
|
+
elm['s-hmr'](versionId);
|
|
554
|
+
setHmrAttr(elm, versionId);
|
|
555
|
+
if (updatedTags.indexOf(cmpTagName) === -1) {
|
|
556
|
+
updatedTags.push(cmpTagName);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
if (hasShadowRoot(elm)) {
|
|
560
|
+
hmrComponent(updatedTags, elm.shadowRoot, versionId, cmpTagName);
|
|
561
|
+
}
|
|
562
|
+
if (elm.children) {
|
|
563
|
+
for (let i = 0; i < elm.children.length; i++) {
|
|
564
|
+
hmrComponent(updatedTags, elm.children[i], versionId, cmpTagName);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
const hmrExternalStyles = (elm, versionId, cssFileNames) => {
|
|
570
|
+
if (isLinkStylesheet(elm)) {
|
|
571
|
+
cssFileNames.forEach(cssFileName => {
|
|
572
|
+
hmrStylesheetLink(elm, versionId, cssFileName);
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
if (isTemplate(elm)) {
|
|
576
|
+
hmrExternalStyles(elm.content, versionId, cssFileNames);
|
|
577
|
+
}
|
|
578
|
+
if (hasShadowRoot(elm)) {
|
|
579
|
+
hmrExternalStyles(elm.shadowRoot, versionId, cssFileNames);
|
|
580
|
+
}
|
|
581
|
+
if (elm.children) {
|
|
582
|
+
for (let i = 0; i < elm.children.length; i++) {
|
|
583
|
+
hmrExternalStyles(elm.children[i], versionId, cssFileNames);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
return cssFileNames.sort();
|
|
587
|
+
};
|
|
588
|
+
const hmrStylesheetLink = (styleSheetElm, versionId, cssFileName) => {
|
|
589
|
+
const orgHref = styleSheetElm.getAttribute('href');
|
|
590
|
+
const newHref = getHmrHref(versionId, cssFileName, styleSheetElm.href);
|
|
591
|
+
if (newHref !== orgHref) {
|
|
592
|
+
styleSheetElm.setAttribute('href', newHref);
|
|
593
|
+
setHmrAttr(styleSheetElm, versionId);
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
const hmrImages = (win, doc, versionId, imageFileNames) => {
|
|
598
|
+
if (win.location.protocol !== 'file:' && doc.styleSheets) {
|
|
599
|
+
hmrStyleSheetsImages(doc, versionId, imageFileNames);
|
|
600
|
+
}
|
|
601
|
+
hmrImagesElements(win, doc.documentElement, versionId, imageFileNames);
|
|
602
|
+
return imageFileNames.sort();
|
|
603
|
+
};
|
|
604
|
+
const hmrStyleSheetsImages = (doc, versionId, imageFileNames) => {
|
|
605
|
+
const cssImageProps = Object.keys(doc.documentElement.style).filter(cssProp => {
|
|
606
|
+
return cssProp.endsWith('Image');
|
|
607
|
+
});
|
|
608
|
+
for (let i = 0; i < doc.styleSheets.length; i++) {
|
|
609
|
+
hmrStyleSheetImages(cssImageProps, doc.styleSheets[i], versionId, imageFileNames);
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
const hmrStyleSheetImages = (cssImageProps, styleSheet, versionId, imageFileNames) => {
|
|
613
|
+
try {
|
|
614
|
+
const cssRules = styleSheet.cssRules;
|
|
615
|
+
for (let i = 0; i < cssRules.length; i++) {
|
|
616
|
+
const cssRule = cssRules[i];
|
|
617
|
+
switch (cssRule.type) {
|
|
618
|
+
case CSSRule.IMPORT_RULE:
|
|
619
|
+
hmrStyleSheetImages(cssImageProps, cssRule.styleSheet, versionId, imageFileNames);
|
|
620
|
+
break;
|
|
621
|
+
case CSSRule.STYLE_RULE:
|
|
622
|
+
hmrStyleSheetRuleImages(cssImageProps, cssRule, versionId, imageFileNames);
|
|
623
|
+
break;
|
|
624
|
+
case CSSRule.MEDIA_RULE:
|
|
625
|
+
hmrStyleSheetImages(cssImageProps, cssRule, versionId, imageFileNames);
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
catch (e) {
|
|
631
|
+
console.error('hmrStyleSheetImages: ' + e);
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
const hmrStyleSheetRuleImages = (cssImageProps, cssRule, versionId, imageFileNames) => {
|
|
635
|
+
cssImageProps.forEach(cssImageProp => {
|
|
636
|
+
imageFileNames.forEach(imageFileName => {
|
|
637
|
+
const oldCssText = cssRule.style[cssImageProp];
|
|
638
|
+
const newCssText = updateCssUrlValue(versionId, imageFileName, oldCssText);
|
|
639
|
+
if (oldCssText !== newCssText) {
|
|
640
|
+
cssRule.style[cssImageProp] = newCssText;
|
|
641
|
+
}
|
|
642
|
+
});
|
|
643
|
+
});
|
|
644
|
+
};
|
|
645
|
+
const hmrImagesElements = (win, elm, versionId, imageFileNames) => {
|
|
646
|
+
const tagName = elm.nodeName.toLowerCase();
|
|
647
|
+
if (tagName === 'img') {
|
|
648
|
+
hmrImgElement(elm, versionId, imageFileNames);
|
|
649
|
+
}
|
|
650
|
+
if (isElement(elm)) {
|
|
651
|
+
const styleAttr = elm.getAttribute('style');
|
|
652
|
+
if (styleAttr) {
|
|
653
|
+
hmrUpdateStyleAttr(elm, versionId, imageFileNames, styleAttr);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
if (tagName === 'style') {
|
|
657
|
+
hmrUpdateStyleElementUrl(elm, versionId, imageFileNames);
|
|
658
|
+
}
|
|
659
|
+
if (win.location.protocol !== 'file:' && isLinkStylesheet(elm)) {
|
|
660
|
+
hmrUpdateLinkElementUrl(elm, versionId, imageFileNames);
|
|
661
|
+
}
|
|
662
|
+
if (isTemplate(elm)) {
|
|
663
|
+
hmrImagesElements(win, elm.content, versionId, imageFileNames);
|
|
664
|
+
}
|
|
665
|
+
if (hasShadowRoot(elm)) {
|
|
666
|
+
hmrImagesElements(win, elm.shadowRoot, versionId, imageFileNames);
|
|
667
|
+
}
|
|
668
|
+
if (elm.children) {
|
|
669
|
+
for (let i = 0; i < elm.children.length; i++) {
|
|
670
|
+
hmrImagesElements(win, elm.children[i], versionId, imageFileNames);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
const hmrImgElement = (imgElm, versionId, imageFileNames) => {
|
|
675
|
+
imageFileNames.forEach(imageFileName => {
|
|
676
|
+
const orgSrc = imgElm.getAttribute('src');
|
|
677
|
+
const newSrc = getHmrHref(versionId, imageFileName, orgSrc);
|
|
678
|
+
if (newSrc !== orgSrc) {
|
|
679
|
+
imgElm.setAttribute('src', newSrc);
|
|
680
|
+
setHmrAttr(imgElm, versionId);
|
|
681
|
+
}
|
|
682
|
+
});
|
|
683
|
+
};
|
|
684
|
+
const hmrUpdateStyleAttr = (elm, versionId, imageFileNames, oldStyleAttr) => {
|
|
685
|
+
imageFileNames.forEach(imageFileName => {
|
|
686
|
+
const newStyleAttr = updateCssUrlValue(versionId, imageFileName, oldStyleAttr);
|
|
687
|
+
if (newStyleAttr !== oldStyleAttr) {
|
|
688
|
+
elm.setAttribute('style', newStyleAttr);
|
|
689
|
+
setHmrAttr(elm, versionId);
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
};
|
|
693
|
+
const hmrUpdateStyleElementUrl = (styleElm, versionId, imageFileNames) => {
|
|
694
|
+
imageFileNames.forEach(imageFileName => {
|
|
695
|
+
const oldCssText = styleElm.innerHTML;
|
|
696
|
+
const newCssText = updateCssUrlValue(versionId, imageFileName, oldCssText);
|
|
697
|
+
if (newCssText !== oldCssText) {
|
|
698
|
+
styleElm.innerHTML = newCssText;
|
|
699
|
+
setHmrAttr(styleElm, versionId);
|
|
700
|
+
}
|
|
701
|
+
});
|
|
702
|
+
};
|
|
703
|
+
const hmrUpdateLinkElementUrl = (linkElm, versionId, imageFileNames) => {
|
|
704
|
+
linkElm.href = setQueryString(linkElm.href, 's-hmr-urls', imageFileNames.sort().join(','));
|
|
705
|
+
linkElm.href = setHmrQueryString(linkElm.href, versionId);
|
|
706
|
+
linkElm.setAttribute('data-hmr', versionId);
|
|
707
|
+
};
|
|
708
|
+
|
|
709
|
+
const hmrInlineStyles = (elm, versionId, stylesUpdatedData) => {
|
|
710
|
+
const stylesUpdated = stylesUpdatedData;
|
|
711
|
+
if (isElement(elm) && elm.nodeName.toLowerCase() === 'style') {
|
|
712
|
+
stylesUpdated.forEach(styleUpdated => {
|
|
713
|
+
hmrStyleElement(elm, versionId, styleUpdated);
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
if (isTemplate(elm)) {
|
|
717
|
+
hmrInlineStyles(elm.content, versionId, stylesUpdated);
|
|
718
|
+
}
|
|
719
|
+
if (hasShadowRoot(elm)) {
|
|
720
|
+
hmrInlineStyles(elm.shadowRoot, versionId, stylesUpdated);
|
|
721
|
+
}
|
|
722
|
+
if (elm.children) {
|
|
723
|
+
for (let i = 0; i < elm.children.length; i++) {
|
|
724
|
+
hmrInlineStyles(elm.children[i], versionId, stylesUpdated);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
return stylesUpdated
|
|
728
|
+
.map(s => s.styleTag)
|
|
729
|
+
.reduce((arr, v) => {
|
|
730
|
+
if (arr.indexOf(v) === -1) {
|
|
731
|
+
arr.push(v);
|
|
732
|
+
}
|
|
733
|
+
return arr;
|
|
734
|
+
}, [])
|
|
735
|
+
.sort();
|
|
736
|
+
};
|
|
737
|
+
const hmrStyleElement = (elm, versionId, stylesUpdated) => {
|
|
738
|
+
const styleId = elm.getAttribute('sty-id');
|
|
739
|
+
if (styleId === stylesUpdated.styleId && stylesUpdated.styleText) {
|
|
740
|
+
// if we made it this far then it's a match!
|
|
741
|
+
// update the new style text
|
|
742
|
+
elm.innerHTML = stylesUpdated.styleText.replace(/\\n/g, '\n');
|
|
743
|
+
elm.setAttribute('data-hmr', versionId);
|
|
744
|
+
}
|
|
745
|
+
};
|
|
746
|
+
|
|
747
|
+
const hmrWindow = (data) => {
|
|
748
|
+
const results = {
|
|
749
|
+
updatedComponents: [],
|
|
750
|
+
updatedExternalStyles: [],
|
|
751
|
+
updatedInlineStyles: [],
|
|
752
|
+
updatedImages: [],
|
|
753
|
+
versionId: '',
|
|
754
|
+
};
|
|
755
|
+
try {
|
|
756
|
+
if (!data || !data.window || !data.window.document.documentElement || !data.hmr || typeof data.hmr.versionId !== 'string') {
|
|
757
|
+
return results;
|
|
758
|
+
}
|
|
759
|
+
const win = data.window;
|
|
760
|
+
const doc = win.document;
|
|
761
|
+
const hmr = data.hmr;
|
|
762
|
+
const documentElement = doc.documentElement;
|
|
763
|
+
const versionId = hmr.versionId;
|
|
764
|
+
results.versionId = versionId;
|
|
765
|
+
if (hmr.componentsUpdated) {
|
|
766
|
+
results.updatedComponents = hmrComponents(documentElement, versionId, hmr.componentsUpdated);
|
|
767
|
+
}
|
|
768
|
+
if (hmr.inlineStylesUpdated) {
|
|
769
|
+
results.updatedInlineStyles = hmrInlineStyles(documentElement, versionId, hmr.inlineStylesUpdated);
|
|
770
|
+
}
|
|
771
|
+
if (hmr.externalStylesUpdated) {
|
|
772
|
+
results.updatedExternalStyles = hmrExternalStyles(documentElement, versionId, hmr.externalStylesUpdated);
|
|
773
|
+
}
|
|
774
|
+
if (hmr.imagesUpdated) {
|
|
775
|
+
results.updatedImages = hmrImages(win, doc, versionId, hmr.imagesUpdated);
|
|
776
|
+
}
|
|
777
|
+
setHmrAttr(documentElement, versionId);
|
|
778
|
+
}
|
|
779
|
+
catch (e) {
|
|
780
|
+
console.error(e);
|
|
781
|
+
}
|
|
782
|
+
return results;
|
|
783
|
+
};
|
|
784
|
+
|
|
785
|
+
export { appError, clearAppErrorModal, emitBuildLog, emitBuildResults, emitBuildStatus, hmrWindow, initBuildProgress, initBuildStatus, logBuild, logDiagnostic, logDisabled, logReload, logWarn, onBuildLog, onBuildResults, onBuildStatus };
|