@stencil/core 4.43.2 → 5.0.0-next.0
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/stencil.mjs +2 -0
- package/dist/chunk-ClPoSABd.mjs +21 -0
- package/dist/client-DR9zhmKG.mjs +4449 -0
- package/dist/compiler/index.d.mts +187 -0
- package/dist/compiler/index.mjs +9 -0
- package/dist/compiler/utils/index.d.mts +3 -0
- package/dist/compiler/utils/index.mjs +5 -0
- package/dist/declarations/stencil-public-compiler.d.ts +4401 -0
- package/dist/declarations/stencil-public-compiler.js +53 -0
- package/dist/declarations/stencil-public-runtime.d.ts +1857 -0
- package/dist/index-Bxo2jCf6.d.mts +77 -0
- package/dist/index-szczUd2l.d.mts +6851 -0
- package/{internal/stencil-core/index.d.ts → dist/index.d.mts} +7 -3
- package/dist/index.mjs +4 -0
- package/dist/mock-doc.d.mts +1 -0
- package/dist/mock-doc.mjs +3 -0
- package/dist/node-sys-BGURUNOZ.mjs +1954 -0
- package/{internal → dist/runtime}/app-data/index.d.ts +11 -7
- package/dist/runtime/app-data/index.js +100 -0
- package/dist/runtime/app-globals/index.d.ts +5 -0
- package/dist/runtime/app-globals/index.js +6 -0
- package/dist/runtime/client/index.d.ts +2286 -0
- package/dist/runtime/client/index.js +4839 -0
- package/dist/runtime/index.d.ts +221 -0
- package/dist/runtime/index.js +4819 -0
- package/dist/runtime/server/index.d.mts +1277 -0
- package/dist/runtime/server/index.mjs +5376 -0
- package/dist/runtime/server/runner.d.mts +298 -0
- package/dist/runtime/server/runner.mjs +1976 -0
- package/dist/serialize-BJvhE9aQ.mjs +775 -0
- package/dist/stencil-private-Cgcr414u.d.ts +1893 -0
- package/dist/sys/node/index.d.mts +33 -0
- package/dist/sys/node/index.mjs +7 -0
- package/dist/sys/node/worker.d.mts +1 -0
- package/dist/sys/node/worker.mjs +60 -0
- package/dist/testing/index.d.mts +207 -0
- package/dist/testing/index.mjs +1188 -0
- package/dist/transpile-CJQcQEVa.mjs +21854 -0
- package/dist/validation-BdcPruW_.mjs +1451 -0
- package/package.json +88 -232
- package/bin/stencil +0 -57
- package/cli/config-flags.d.ts +0 -132
- package/cli/index.cjs +0 -5816
- package/cli/index.d.ts +0 -19
- package/cli/index.js +0 -5809
- package/cli/package.json +0 -14
- package/compiler/lib.d.ts +0 -22
- package/compiler/lib.decorators.d.ts +0 -384
- package/compiler/lib.decorators.legacy.d.ts +0 -22
- package/compiler/lib.dom.asynciterable.d.ts +0 -41
- package/compiler/lib.dom.d.ts +0 -29610
- package/compiler/lib.dom.iterable.d.ts +0 -493
- package/compiler/lib.es2015.collection.d.ts +0 -147
- package/compiler/lib.es2015.core.d.ts +0 -597
- package/compiler/lib.es2015.d.ts +0 -28
- package/compiler/lib.es2015.generator.d.ts +0 -77
- package/compiler/lib.es2015.iterable.d.ts +0 -605
- package/compiler/lib.es2015.promise.d.ts +0 -81
- package/compiler/lib.es2015.proxy.d.ts +0 -128
- package/compiler/lib.es2015.reflect.d.ts +0 -144
- package/compiler/lib.es2015.symbol.d.ts +0 -46
- package/compiler/lib.es2015.symbol.wellknown.d.ts +0 -326
- package/compiler/lib.es2016.array.include.d.ts +0 -116
- package/compiler/lib.es2016.d.ts +0 -21
- package/compiler/lib.es2016.full.d.ts +0 -23
- package/compiler/lib.es2016.intl.d.ts +0 -31
- package/compiler/lib.es2017.arraybuffer.d.ts +0 -21
- package/compiler/lib.es2017.d.ts +0 -26
- package/compiler/lib.es2017.date.d.ts +0 -31
- package/compiler/lib.es2017.full.d.ts +0 -23
- package/compiler/lib.es2017.intl.d.ts +0 -44
- package/compiler/lib.es2017.object.d.ts +0 -49
- package/compiler/lib.es2017.sharedmemory.d.ts +0 -135
- package/compiler/lib.es2017.string.d.ts +0 -45
- package/compiler/lib.es2017.typedarrays.d.ts +0 -53
- package/compiler/lib.es2018.asyncgenerator.d.ts +0 -77
- package/compiler/lib.es2018.asynciterable.d.ts +0 -53
- package/compiler/lib.es2018.d.ts +0 -24
- package/compiler/lib.es2018.full.d.ts +0 -24
- package/compiler/lib.es2018.intl.d.ts +0 -83
- package/compiler/lib.es2018.promise.d.ts +0 -30
- package/compiler/lib.es2018.regexp.d.ts +0 -37
- package/compiler/lib.es2019.array.d.ts +0 -79
- package/compiler/lib.es2019.d.ts +0 -24
- package/compiler/lib.es2019.full.d.ts +0 -24
- package/compiler/lib.es2019.intl.d.ts +0 -23
- package/compiler/lib.es2019.object.d.ts +0 -33
- package/compiler/lib.es2019.string.d.ts +0 -37
- package/compiler/lib.es2019.symbol.d.ts +0 -24
- package/compiler/lib.es2020.bigint.d.ts +0 -765
- package/compiler/lib.es2020.d.ts +0 -27
- package/compiler/lib.es2020.date.d.ts +0 -42
- package/compiler/lib.es2020.full.d.ts +0 -24
- package/compiler/lib.es2020.intl.d.ts +0 -474
- package/compiler/lib.es2020.number.d.ts +0 -28
- package/compiler/lib.es2020.promise.d.ts +0 -47
- package/compiler/lib.es2020.sharedmemory.d.ts +0 -99
- package/compiler/lib.es2020.string.d.ts +0 -44
- package/compiler/lib.es2020.symbol.wellknown.d.ts +0 -41
- package/compiler/lib.es2021.d.ts +0 -23
- package/compiler/lib.es2021.full.d.ts +0 -24
- package/compiler/lib.es2021.intl.d.ts +0 -166
- package/compiler/lib.es2021.promise.d.ts +0 -48
- package/compiler/lib.es2021.string.d.ts +0 -33
- package/compiler/lib.es2021.weakref.d.ts +0 -78
- package/compiler/lib.es2022.array.d.ts +0 -121
- package/compiler/lib.es2022.d.ts +0 -25
- package/compiler/lib.es2022.error.d.ts +0 -75
- package/compiler/lib.es2022.full.d.ts +0 -24
- package/compiler/lib.es2022.intl.d.ts +0 -121
- package/compiler/lib.es2022.object.d.ts +0 -26
- package/compiler/lib.es2022.regexp.d.ts +0 -39
- package/compiler/lib.es2022.string.d.ts +0 -25
- package/compiler/lib.es2023.array.d.ts +0 -924
- package/compiler/lib.es2023.collection.d.ts +0 -21
- package/compiler/lib.es2023.d.ts +0 -22
- package/compiler/lib.es2023.full.d.ts +0 -24
- package/compiler/lib.es2023.intl.d.ts +0 -56
- package/compiler/lib.es2024.arraybuffer.d.ts +0 -65
- package/compiler/lib.es2024.collection.d.ts +0 -29
- package/compiler/lib.es2024.d.ts +0 -26
- package/compiler/lib.es2024.full.d.ts +0 -24
- package/compiler/lib.es2024.object.d.ts +0 -29
- package/compiler/lib.es2024.promise.d.ts +0 -35
- package/compiler/lib.es2024.regexp.d.ts +0 -25
- package/compiler/lib.es2024.sharedmemory.d.ts +0 -68
- package/compiler/lib.es2024.string.d.ts +0 -29
- package/compiler/lib.es5.d.ts +0 -4594
- package/compiler/lib.es6.d.ts +0 -23
- package/compiler/lib.esnext.array.d.ts +0 -35
- package/compiler/lib.esnext.collection.d.ts +0 -96
- package/compiler/lib.esnext.d.ts +0 -27
- package/compiler/lib.esnext.decorators.d.ts +0 -28
- package/compiler/lib.esnext.disposable.d.ts +0 -193
- package/compiler/lib.esnext.float16.d.ts +0 -443
- package/compiler/lib.esnext.full.d.ts +0 -24
- package/compiler/lib.esnext.intl.d.ts +0 -21
- package/compiler/lib.esnext.iterator.d.ts +0 -148
- package/compiler/lib.esnext.promise.d.ts +0 -34
- package/compiler/lib.scripthost.d.ts +0 -322
- package/compiler/lib.webworker.asynciterable.d.ts +0 -41
- package/compiler/lib.webworker.d.ts +0 -9894
- package/compiler/lib.webworker.importscripts.d.ts +0 -23
- package/compiler/lib.webworker.iterable.d.ts +0 -287
- package/compiler/package.json +0 -8
- package/compiler/stencil.d.ts +0 -73
- package/compiler/stencil.js +0 -287816
- package/compiler/sys/in-memory-fs.d.ts +0 -227
- package/compiler/transpile.d.ts +0 -32
- package/dev-server/client/app-error.d.ts +0 -20
- package/dev-server/client/events.d.ts +0 -6
- package/dev-server/client/hmr-components.d.ts +0 -12
- package/dev-server/client/hmr-external-styles.d.ts +0 -1
- package/dev-server/client/hmr-images.d.ts +0 -1
- package/dev-server/client/hmr-inline-styles.d.ts +0 -1
- package/dev-server/client/hmr-util.d.ts +0 -39
- package/dev-server/client/hmr-window.d.ts +0 -10
- package/dev-server/client/index.d.ts +0 -6
- package/dev-server/client/index.js +0 -793
- package/dev-server/client/logger.d.ts +0 -6
- package/dev-server/client/package.json +0 -8
- package/dev-server/client/progress.d.ts +0 -3
- package/dev-server/client/status.d.ts +0 -4
- package/dev-server/client/test/hmr-util.spec.d.ts +0 -1
- package/dev-server/client/test/status.spec.d.ts +0 -1
- package/dev-server/connector.html +0 -6
- package/dev-server/index.d.ts +0 -3
- package/dev-server/index.js +0 -247
- package/dev-server/package.json +0 -8
- package/dev-server/server-process.js +0 -12095
- package/dev-server/server-worker-thread.js +0 -39
- package/dev-server/static/favicon.ico +0 -0
- package/dev-server/templates/directory-index.html +0 -176
- package/dev-server/templates/initial-load.html +0 -168
- package/dev-server/visualstudio.vbs +0 -82
- package/dev-server/xdg-open +0 -1066
- package/internal/app-data/index.cjs +0 -119
- package/internal/app-data/index.js +0 -92
- package/internal/app-data/package.json +0 -15
- package/internal/app-globals/index.d.ts +0 -2
- package/internal/app-globals/index.js +0 -14
- package/internal/app-globals/package.json +0 -14
- package/internal/child_process.d.ts +0 -7
- package/internal/client/index.js +0 -4736
- package/internal/client/package.json +0 -10
- package/internal/client/patch-browser.js +0 -45
- package/internal/client/polyfills/core-js.js +0 -11
- package/internal/client/polyfills/dom.js +0 -79
- package/internal/client/polyfills/es5-html-element.js +0 -1
- package/internal/client/polyfills/index.js +0 -34
- package/internal/client/polyfills/system.js +0 -6
- package/internal/client/shadow-css.js +0 -414
- package/internal/hydrate/index.js +0 -6671
- package/internal/hydrate/package.json +0 -7
- package/internal/hydrate/runner.d.ts +0 -287
- package/internal/hydrate/runner.js +0 -17950
- package/internal/index.d.ts +0 -4
- package/internal/index.js +0 -2
- package/internal/package.json +0 -9
- package/internal/stencil-core/index.cjs +0 -1
- package/internal/stencil-core/index.js +0 -18
- package/internal/stencil-core/jsx-dev-runtime.cjs +0 -7
- package/internal/stencil-core/jsx-dev-runtime.d.ts +0 -41
- package/internal/stencil-core/jsx-dev-runtime.js +0 -2
- package/internal/stencil-core/jsx-runtime.cjs +0 -8
- package/internal/stencil-core/jsx-runtime.d.ts +0 -40
- package/internal/stencil-core/jsx-runtime.js +0 -2
- package/internal/stencil-private.d.ts +0 -2549
- package/internal/stencil-public-compiler.d.ts +0 -2867
- package/internal/stencil-public-runtime.d.ts +0 -1860
- package/internal/testing/index.js +0 -6528
- package/internal/testing/jsx-dev-runtime.d.ts +0 -2
- package/internal/testing/jsx-dev-runtime.js +0 -8
- package/internal/testing/jsx-runtime.d.ts +0 -2
- package/internal/testing/jsx-runtime.js +0 -9
- package/internal/testing/package.json +0 -7
- package/internal/utils/index.d.ts +0 -1
- package/internal/utils/result.d.ts +0 -112
- package/mock-doc/index.cjs +0 -10165
- package/mock-doc/index.d.ts +0 -1172
- package/mock-doc/index.js +0 -10144
- package/mock-doc/package.json +0 -15
- package/readme.md +0 -94
- package/screenshot/compare/assets/favicon.ico +0 -0
- package/screenshot/compare/assets/logo.png +0 -0
- package/screenshot/compare/build/app.css +0 -1
- package/screenshot/compare/build/app.esm.js +0 -1
- package/screenshot/compare/build/app.js +0 -33
- package/screenshot/compare/build/p-081b0641.js +0 -1
- package/screenshot/compare/build/p-227a1e18.entry.js +0 -1
- package/screenshot/compare/build/p-2c298727.entry.js +0 -1
- package/screenshot/compare/build/p-5479268c.entry.js +0 -1
- package/screenshot/compare/build/p-573ec8a4.entry.js +0 -1
- package/screenshot/compare/build/p-6ba08604.entry.js +0 -1
- package/screenshot/compare/build/p-6bc63295.entry.js +0 -1
- package/screenshot/compare/build/p-7a3759fd.entry.js +0 -1
- package/screenshot/compare/build/p-7b4e3ba7.js +0 -1
- package/screenshot/compare/build/p-988eb362.css +0 -1
- package/screenshot/compare/build/p-9b6a9315.js +0 -1
- package/screenshot/compare/build/p-b4cc611c.entry.js +0 -1
- package/screenshot/compare/build/p-d1bf53f5.entry.js +0 -1
- package/screenshot/compare/build/p-e2efe0df.js +0 -1
- package/screenshot/compare/build/p-e8ca6d97.entry.js +0 -1
- package/screenshot/compare/build/p-ec2f13e0.entry.js +0 -1
- package/screenshot/compare/build/p-f0b99977.entry.js +0 -1
- package/screenshot/compare/build/p-f4745c2f.entry.js +0 -1
- package/screenshot/compare/build/p-fbbae598.js +0 -1
- package/screenshot/compare/host.config.json +0 -15
- package/screenshot/compare/index.html +0 -1
- package/screenshot/compare/manifest.json +0 -13
- package/screenshot/connector-base.d.ts +0 -42
- package/screenshot/connector-local.d.ts +0 -7
- package/screenshot/connector.js +0 -2
- package/screenshot/index.d.ts +0 -3
- package/screenshot/index.js +0 -2433
- package/screenshot/local-connector.js +0 -2
- package/screenshot/package.json +0 -15
- package/screenshot/pixel-match.d.ts +0 -1
- package/screenshot/pixel-match.js +0 -2315
- package/screenshot/screenshot-compare.d.ts +0 -20
- package/screenshot/screenshot-fs.d.ts +0 -14
- package/sys/node/460.node-fetch.js +0 -451
- package/sys/node/autoprefixer.js +0 -9
- package/sys/node/glob.js +0 -1
- package/sys/node/graceful-fs.js +0 -1
- package/sys/node/index.d.ts +0 -39
- package/sys/node/index.js +0 -64
- package/sys/node/node-fetch.js +0 -12
- package/sys/node/package.json +0 -8
- package/sys/node/prompts.js +0 -1
- package/sys/node/worker.js +0 -4
- package/testing/index.d.ts +0 -9
- package/testing/index.js +0 -13064
- package/testing/jest/jest-27-and-under/jest-config.d.ts +0 -16
- package/testing/jest/jest-27-and-under/jest-environment.d.ts +0 -2
- package/testing/jest/jest-27-and-under/jest-facade.d.ts +0 -155
- package/testing/jest/jest-27-and-under/jest-preprocessor.d.ts +0 -59
- package/testing/jest/jest-27-and-under/jest-preset.d.ts +0 -3
- package/testing/jest/jest-27-and-under/jest-runner.d.ts +0 -11
- package/testing/jest/jest-27-and-under/jest-screenshot.d.ts +0 -2
- package/testing/jest/jest-27-and-under/jest-serializer.d.ts +0 -4
- package/testing/jest/jest-27-and-under/jest-setup-test-framework.d.ts +0 -9
- package/testing/jest/jest-27-and-under/matchers/attributes.d.ts +0 -14
- package/testing/jest/jest-27-and-under/matchers/class-list.d.ts +0 -12
- package/testing/jest/jest-27-and-under/matchers/events.d.ts +0 -25
- package/testing/jest/jest-27-and-under/matchers/html.d.ts +0 -13
- package/testing/jest/jest-27-and-under/matchers/index.d.ts +0 -24
- package/testing/jest/jest-27-and-under/matchers/screenshot.d.ts +0 -5
- package/testing/jest/jest-27-and-under/matchers/text.d.ts +0 -4
- package/testing/jest/jest-27-and-under/test/jest-config.spec.d.ts +0 -1
- package/testing/jest/jest-27-and-under/test/jest-preprocessor.spec.d.ts +0 -1
- package/testing/jest/jest-27-and-under/test/jest-runner.spec.d.ts +0 -1
- package/testing/jest/jest-27-and-under/test/jest-serializer.spec.d.ts +0 -1
- package/testing/jest/jest-27-and-under/test/jest-setup-test-framework.spec.d.ts +0 -1
- package/testing/jest/jest-28/jest-config.d.ts +0 -16
- package/testing/jest/jest-28/jest-environment.d.ts +0 -2
- package/testing/jest/jest-28/jest-facade.d.ts +0 -134
- package/testing/jest/jest-28/jest-preprocessor.d.ts +0 -35
- package/testing/jest/jest-28/jest-preset.d.ts +0 -3
- package/testing/jest/jest-28/jest-runner.d.ts +0 -11
- package/testing/jest/jest-28/jest-screenshot.d.ts +0 -2
- package/testing/jest/jest-28/jest-serializer.d.ts +0 -4
- package/testing/jest/jest-28/jest-setup-test-framework.d.ts +0 -9
- package/testing/jest/jest-28/matchers/attributes.d.ts +0 -14
- package/testing/jest/jest-28/matchers/class-list.d.ts +0 -12
- package/testing/jest/jest-28/matchers/events.d.ts +0 -25
- package/testing/jest/jest-28/matchers/html.d.ts +0 -13
- package/testing/jest/jest-28/matchers/index.d.ts +0 -24
- package/testing/jest/jest-28/matchers/screenshot.d.ts +0 -5
- package/testing/jest/jest-28/matchers/text.d.ts +0 -4
- package/testing/jest/jest-28/test/jest-config.spec.d.ts +0 -1
- package/testing/jest/jest-28/test/jest-preprocessor.spec.d.ts +0 -1
- package/testing/jest/jest-28/test/jest-runner.spec.d.ts +0 -1
- package/testing/jest/jest-28/test/jest-serializer.spec.d.ts +0 -1
- package/testing/jest/jest-28/test/jest-setup-test-framework.spec.d.ts +0 -1
- package/testing/jest/jest-29/jest-config.d.ts +0 -16
- package/testing/jest/jest-29/jest-environment.d.ts +0 -2
- package/testing/jest/jest-29/jest-facade.d.ts +0 -136
- package/testing/jest/jest-29/jest-preprocessor.d.ts +0 -35
- package/testing/jest/jest-29/jest-preset.d.ts +0 -3
- package/testing/jest/jest-29/jest-runner.d.ts +0 -11
- package/testing/jest/jest-29/jest-screenshot.d.ts +0 -2
- package/testing/jest/jest-29/jest-serializer.d.ts +0 -4
- package/testing/jest/jest-29/jest-setup-test-framework.d.ts +0 -9
- package/testing/jest/jest-29/matchers/attributes.d.ts +0 -14
- package/testing/jest/jest-29/matchers/class-list.d.ts +0 -12
- package/testing/jest/jest-29/matchers/events.d.ts +0 -25
- package/testing/jest/jest-29/matchers/html.d.ts +0 -13
- package/testing/jest/jest-29/matchers/index.d.ts +0 -24
- package/testing/jest/jest-29/matchers/screenshot.d.ts +0 -5
- package/testing/jest/jest-29/matchers/text.d.ts +0 -4
- package/testing/jest/jest-29/test/jest-config.spec.d.ts +0 -1
- package/testing/jest/jest-29/test/jest-preprocessor.spec.d.ts +0 -1
- package/testing/jest/jest-29/test/jest-runner.spec.d.ts +0 -1
- package/testing/jest/jest-29/test/jest-serializer.spec.d.ts +0 -1
- package/testing/jest/jest-29/test/jest-setup-test-framework.spec.d.ts +0 -1
- package/testing/jest/jest-apis.d.ts +0 -86
- package/testing/jest/jest-facade.d.ts +0 -74
- package/testing/jest/jest-stencil-connector.d.ts +0 -65
- package/testing/jest/test/jest-stencil-connector.spec.d.ts +0 -1
- package/testing/jest-environment.js +0 -3
- package/testing/jest-preprocessor.js +0 -3
- package/testing/jest-preset.js +0 -2
- package/testing/jest-runner.js +0 -3
- package/testing/jest-setuptestframework.js +0 -3
- package/testing/mock-fetch.d.ts +0 -11
- package/testing/mocks.d.ts +0 -56
- package/testing/package.json +0 -8
- package/testing/puppeteer/index.d.ts +0 -2
- package/testing/puppeteer/puppeteer-browser.d.ts +0 -6
- package/testing/puppeteer/puppeteer-declarations.d.ts +0 -414
- package/testing/puppeteer/puppeteer-element.d.ts +0 -67
- package/testing/puppeteer/puppeteer-emulate.d.ts +0 -2
- package/testing/puppeteer/puppeteer-events.d.ts +0 -21
- package/testing/puppeteer/puppeteer-page.d.ts +0 -2
- package/testing/puppeteer/puppeteer-screenshot.d.ts +0 -27
- package/testing/puppeteer/test/puppeteer-screenshot.spec.d.ts +0 -1
- package/testing/reset-build-conditionals.d.ts +0 -12
- package/testing/spec-page.d.ts +0 -7
- package/testing/test/testing-utils.spec.d.ts +0 -1
- package/testing/test-transpile.d.ts +0 -2
- package/testing/testing-logger.d.ts +0 -26
- package/testing/testing-sys.d.ts +0 -6
- package/testing/testing-utils.d.ts +0 -80
- package/testing/testing.d.ts +0 -2
- /package/{internal → dist/declarations}/stencil-ext-modules.d.ts +0 -0
- /package/{internal → dist/declarations}/stencil-public-docs.d.ts +0 -0
- /package/{screenshot/compare/build/index.esm.js → dist/declarations/stencil-public-runtime.js} +0 -0
package/screenshot/index.js
DELETED
|
@@ -1,2433 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Stencil Screenshot v4.43.2 | MIT Licensed | https://stenciljs.com
|
|
3
|
-
*/
|
|
4
|
-
"use strict";
|
|
5
|
-
var __create = Object.create;
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __typeError = (msg) => {
|
|
12
|
-
throw TypeError(msg);
|
|
13
|
-
};
|
|
14
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
16
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
|
-
};
|
|
18
|
-
var __export = (target, all) => {
|
|
19
|
-
for (var name in all)
|
|
20
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
21
|
-
};
|
|
22
|
-
var __copyProps = (to, from, except, desc) => {
|
|
23
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
24
|
-
for (let key of __getOwnPropNames(from))
|
|
25
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
26
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
27
|
-
}
|
|
28
|
-
return to;
|
|
29
|
-
};
|
|
30
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
31
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
32
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
33
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
34
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
35
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
36
|
-
mod
|
|
37
|
-
));
|
|
38
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
39
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
40
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
41
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
42
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
43
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
44
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
45
|
-
|
|
46
|
-
// node_modules/balanced-match/index.js
|
|
47
|
-
var require_balanced_match = __commonJS({
|
|
48
|
-
"node_modules/balanced-match/index.js"(exports2, module2) {
|
|
49
|
-
"use strict";
|
|
50
|
-
module2.exports = balanced;
|
|
51
|
-
function balanced(a, b, str) {
|
|
52
|
-
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
53
|
-
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
54
|
-
var r = range(a, b, str);
|
|
55
|
-
return r && {
|
|
56
|
-
start: r[0],
|
|
57
|
-
end: r[1],
|
|
58
|
-
pre: str.slice(0, r[0]),
|
|
59
|
-
body: str.slice(r[0] + a.length, r[1]),
|
|
60
|
-
post: str.slice(r[1] + b.length)
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
function maybeMatch(reg, str) {
|
|
64
|
-
var m = str.match(reg);
|
|
65
|
-
return m ? m[0] : null;
|
|
66
|
-
}
|
|
67
|
-
balanced.range = range;
|
|
68
|
-
function range(a, b, str) {
|
|
69
|
-
var begs, beg, left, right, result;
|
|
70
|
-
var ai = str.indexOf(a);
|
|
71
|
-
var bi = str.indexOf(b, ai + 1);
|
|
72
|
-
var i = ai;
|
|
73
|
-
if (ai >= 0 && bi > 0) {
|
|
74
|
-
if (a === b) {
|
|
75
|
-
return [ai, bi];
|
|
76
|
-
}
|
|
77
|
-
begs = [];
|
|
78
|
-
left = str.length;
|
|
79
|
-
while (i >= 0 && !result) {
|
|
80
|
-
if (i == ai) {
|
|
81
|
-
begs.push(i);
|
|
82
|
-
ai = str.indexOf(a, i + 1);
|
|
83
|
-
} else if (begs.length == 1) {
|
|
84
|
-
result = [begs.pop(), bi];
|
|
85
|
-
} else {
|
|
86
|
-
beg = begs.pop();
|
|
87
|
-
if (beg < left) {
|
|
88
|
-
left = beg;
|
|
89
|
-
right = bi;
|
|
90
|
-
}
|
|
91
|
-
bi = str.indexOf(b, i + 1);
|
|
92
|
-
}
|
|
93
|
-
i = ai < bi && ai >= 0 ? ai : bi;
|
|
94
|
-
}
|
|
95
|
-
if (begs.length) {
|
|
96
|
-
result = [left, right];
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return result;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
// node_modules/brace-expansion/index.js
|
|
105
|
-
var require_brace_expansion = __commonJS({
|
|
106
|
-
"node_modules/brace-expansion/index.js"(exports2, module2) {
|
|
107
|
-
var balanced = require_balanced_match();
|
|
108
|
-
module2.exports = expandTop;
|
|
109
|
-
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
110
|
-
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
111
|
-
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
112
|
-
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
113
|
-
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
114
|
-
function numeric(str) {
|
|
115
|
-
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
|
|
116
|
-
}
|
|
117
|
-
function escapeBraces(str) {
|
|
118
|
-
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
|
|
119
|
-
}
|
|
120
|
-
function unescapeBraces(str) {
|
|
121
|
-
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
|
|
122
|
-
}
|
|
123
|
-
function parseCommaParts(str) {
|
|
124
|
-
if (!str)
|
|
125
|
-
return [""];
|
|
126
|
-
var parts = [];
|
|
127
|
-
var m = balanced("{", "}", str);
|
|
128
|
-
if (!m)
|
|
129
|
-
return str.split(",");
|
|
130
|
-
var pre = m.pre;
|
|
131
|
-
var body = m.body;
|
|
132
|
-
var post = m.post;
|
|
133
|
-
var p = pre.split(",");
|
|
134
|
-
p[p.length - 1] += "{" + body + "}";
|
|
135
|
-
var postParts = parseCommaParts(post);
|
|
136
|
-
if (post.length) {
|
|
137
|
-
p[p.length - 1] += postParts.shift();
|
|
138
|
-
p.push.apply(p, postParts);
|
|
139
|
-
}
|
|
140
|
-
parts.push.apply(parts, p);
|
|
141
|
-
return parts;
|
|
142
|
-
}
|
|
143
|
-
function expandTop(str) {
|
|
144
|
-
if (!str)
|
|
145
|
-
return [];
|
|
146
|
-
if (str.substr(0, 2) === "{}") {
|
|
147
|
-
str = "\\{\\}" + str.substr(2);
|
|
148
|
-
}
|
|
149
|
-
return expand2(escapeBraces(str), true).map(unescapeBraces);
|
|
150
|
-
}
|
|
151
|
-
function embrace(str) {
|
|
152
|
-
return "{" + str + "}";
|
|
153
|
-
}
|
|
154
|
-
function isPadded(el) {
|
|
155
|
-
return /^-?0\d/.test(el);
|
|
156
|
-
}
|
|
157
|
-
function lte(i, y) {
|
|
158
|
-
return i <= y;
|
|
159
|
-
}
|
|
160
|
-
function gte(i, y) {
|
|
161
|
-
return i >= y;
|
|
162
|
-
}
|
|
163
|
-
function expand2(str, isTop) {
|
|
164
|
-
var expansions = [];
|
|
165
|
-
var m = balanced("{", "}", str);
|
|
166
|
-
if (!m) return [str];
|
|
167
|
-
var pre = m.pre;
|
|
168
|
-
var post = m.post.length ? expand2(m.post, false) : [""];
|
|
169
|
-
if (/\$$/.test(m.pre)) {
|
|
170
|
-
for (var k = 0; k < post.length; k++) {
|
|
171
|
-
var expansion = pre + "{" + m.body + "}" + post[k];
|
|
172
|
-
expansions.push(expansion);
|
|
173
|
-
}
|
|
174
|
-
} else {
|
|
175
|
-
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
176
|
-
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
177
|
-
var isSequence = isNumericSequence || isAlphaSequence;
|
|
178
|
-
var isOptions = m.body.indexOf(",") >= 0;
|
|
179
|
-
if (!isSequence && !isOptions) {
|
|
180
|
-
if (m.post.match(/,(?!,).*\}/)) {
|
|
181
|
-
str = m.pre + "{" + m.body + escClose + m.post;
|
|
182
|
-
return expand2(str);
|
|
183
|
-
}
|
|
184
|
-
return [str];
|
|
185
|
-
}
|
|
186
|
-
var n;
|
|
187
|
-
if (isSequence) {
|
|
188
|
-
n = m.body.split(/\.\./);
|
|
189
|
-
} else {
|
|
190
|
-
n = parseCommaParts(m.body);
|
|
191
|
-
if (n.length === 1) {
|
|
192
|
-
n = expand2(n[0], false).map(embrace);
|
|
193
|
-
if (n.length === 1) {
|
|
194
|
-
return post.map(function(p) {
|
|
195
|
-
return m.pre + n[0] + p;
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
var N;
|
|
201
|
-
if (isSequence) {
|
|
202
|
-
var x = numeric(n[0]);
|
|
203
|
-
var y = numeric(n[1]);
|
|
204
|
-
var width = Math.max(n[0].length, n[1].length);
|
|
205
|
-
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
|
|
206
|
-
var test = lte;
|
|
207
|
-
var reverse = y < x;
|
|
208
|
-
if (reverse) {
|
|
209
|
-
incr *= -1;
|
|
210
|
-
test = gte;
|
|
211
|
-
}
|
|
212
|
-
var pad = n.some(isPadded);
|
|
213
|
-
N = [];
|
|
214
|
-
for (var i = x; test(i, y); i += incr) {
|
|
215
|
-
var c;
|
|
216
|
-
if (isAlphaSequence) {
|
|
217
|
-
c = String.fromCharCode(i);
|
|
218
|
-
if (c === "\\")
|
|
219
|
-
c = "";
|
|
220
|
-
} else {
|
|
221
|
-
c = String(i);
|
|
222
|
-
if (pad) {
|
|
223
|
-
var need = width - c.length;
|
|
224
|
-
if (need > 0) {
|
|
225
|
-
var z = new Array(need + 1).join("0");
|
|
226
|
-
if (i < 0)
|
|
227
|
-
c = "-" + z + c.slice(1);
|
|
228
|
-
else
|
|
229
|
-
c = z + c;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
N.push(c);
|
|
234
|
-
}
|
|
235
|
-
} else {
|
|
236
|
-
N = [];
|
|
237
|
-
for (var j = 0; j < n.length; j++) {
|
|
238
|
-
N.push.apply(N, expand2(n[j], false));
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
for (var j = 0; j < N.length; j++) {
|
|
242
|
-
for (var k = 0; k < post.length; k++) {
|
|
243
|
-
var expansion = pre + N[j] + post[k];
|
|
244
|
-
if (!isTop || isSequence || expansion)
|
|
245
|
-
expansions.push(expansion);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
return expansions;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
// src/screenshot/index.ts
|
|
255
|
-
var index_exports = {};
|
|
256
|
-
__export(index_exports, {
|
|
257
|
-
ScreenshotConnector: () => ScreenshotConnector,
|
|
258
|
-
ScreenshotLocalConnector: () => ScreenshotLocalConnector
|
|
259
|
-
});
|
|
260
|
-
module.exports = __toCommonJS(index_exports);
|
|
261
|
-
|
|
262
|
-
// src/screenshot/connector-base.ts
|
|
263
|
-
var import_os = require("os");
|
|
264
|
-
var import_path2 = require("path");
|
|
265
|
-
|
|
266
|
-
// src/screenshot/screenshot-fs.ts
|
|
267
|
-
var import_fs = __toESM(require("fs"));
|
|
268
|
-
var import_path = __toESM(require("path"));
|
|
269
|
-
function fileExists(filePath) {
|
|
270
|
-
return new Promise((resolve) => {
|
|
271
|
-
import_fs.default.access(filePath, (err2) => resolve(!err2));
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
function readFile(filePath) {
|
|
275
|
-
return new Promise((resolve, reject) => {
|
|
276
|
-
import_fs.default.readFile(filePath, "utf-8", (err2, data) => {
|
|
277
|
-
if (err2) {
|
|
278
|
-
reject(err2);
|
|
279
|
-
} else {
|
|
280
|
-
resolve(data);
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
function readFileBuffer(filePath) {
|
|
286
|
-
return new Promise((resolve, reject) => {
|
|
287
|
-
import_fs.default.readFile(filePath, (err2, data) => {
|
|
288
|
-
if (err2) {
|
|
289
|
-
reject(err2);
|
|
290
|
-
} else {
|
|
291
|
-
resolve(data);
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
function writeFile(filePath, data) {
|
|
297
|
-
return new Promise((resolve, reject) => {
|
|
298
|
-
import_fs.default.writeFile(filePath, data, (err2) => {
|
|
299
|
-
if (err2) {
|
|
300
|
-
reject(err2);
|
|
301
|
-
} else {
|
|
302
|
-
resolve();
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
function mkDir(filePath) {
|
|
308
|
-
return new Promise((resolve) => {
|
|
309
|
-
import_fs.default.mkdir(filePath, () => {
|
|
310
|
-
resolve();
|
|
311
|
-
});
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
function rmDir(filePath) {
|
|
315
|
-
return new Promise((resolve) => {
|
|
316
|
-
import_fs.default.rmdir(filePath, () => {
|
|
317
|
-
resolve();
|
|
318
|
-
});
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
async function emptyDir(dir) {
|
|
322
|
-
const files = await readDir(dir);
|
|
323
|
-
const promises = files.map(async (fileName) => {
|
|
324
|
-
const filePath = import_path.default.join(dir, fileName);
|
|
325
|
-
const isDirFile = await isFile(filePath);
|
|
326
|
-
if (isDirFile) {
|
|
327
|
-
await unlink(filePath);
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
await Promise.all(promises);
|
|
331
|
-
}
|
|
332
|
-
async function readDir(dir) {
|
|
333
|
-
return new Promise((resolve) => {
|
|
334
|
-
import_fs.default.readdir(dir, (err2, files) => {
|
|
335
|
-
if (err2) {
|
|
336
|
-
resolve([]);
|
|
337
|
-
} else {
|
|
338
|
-
resolve(files);
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
async function isFile(itemPath) {
|
|
344
|
-
return new Promise((resolve) => {
|
|
345
|
-
import_fs.default.stat(itemPath, (err2, stat) => {
|
|
346
|
-
if (err2) {
|
|
347
|
-
resolve(false);
|
|
348
|
-
} else {
|
|
349
|
-
resolve(stat.isFile());
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
async function unlink(filePath) {
|
|
355
|
-
return new Promise((resolve) => {
|
|
356
|
-
import_fs.default.unlink(filePath, () => {
|
|
357
|
-
resolve();
|
|
358
|
-
});
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// src/screenshot/connector-base.ts
|
|
363
|
-
var ScreenshotConnector = class {
|
|
364
|
-
rootDir;
|
|
365
|
-
cacheDir;
|
|
366
|
-
packageDir;
|
|
367
|
-
screenshotDirName = "screenshot";
|
|
368
|
-
imagesDirName = "images";
|
|
369
|
-
buildsDirName = "builds";
|
|
370
|
-
masterBuildFileName = "master.json";
|
|
371
|
-
screenshotCacheFileName = "screenshot-cache.json";
|
|
372
|
-
logger;
|
|
373
|
-
buildId;
|
|
374
|
-
buildMessage;
|
|
375
|
-
buildAuthor;
|
|
376
|
-
buildUrl;
|
|
377
|
-
previewUrl;
|
|
378
|
-
buildTimestamp;
|
|
379
|
-
appNamespace;
|
|
380
|
-
screenshotDir;
|
|
381
|
-
imagesDir;
|
|
382
|
-
buildsDir;
|
|
383
|
-
masterBuildFilePath;
|
|
384
|
-
screenshotCacheFilePath;
|
|
385
|
-
currentBuildDir;
|
|
386
|
-
updateMaster;
|
|
387
|
-
allowableMismatchedRatio;
|
|
388
|
-
allowableMismatchedPixels;
|
|
389
|
-
pixelmatchThreshold;
|
|
390
|
-
waitBeforeScreenshot;
|
|
391
|
-
pixelmatchModulePath;
|
|
392
|
-
async initBuild(opts) {
|
|
393
|
-
this.logger = opts.logger;
|
|
394
|
-
this.buildId = opts.buildId;
|
|
395
|
-
this.buildMessage = opts.buildMessage || "";
|
|
396
|
-
this.buildAuthor = opts.buildAuthor;
|
|
397
|
-
this.buildUrl = opts.buildUrl;
|
|
398
|
-
this.previewUrl = opts.previewUrl;
|
|
399
|
-
this.buildTimestamp = typeof opts.buildTimestamp === "number" ? opts.buildTimestamp : Date.now();
|
|
400
|
-
this.cacheDir = opts.cacheDir;
|
|
401
|
-
this.packageDir = opts.packageDir;
|
|
402
|
-
this.rootDir = opts.rootDir;
|
|
403
|
-
this.appNamespace = opts.appNamespace;
|
|
404
|
-
this.waitBeforeScreenshot = opts.waitBeforeScreenshot;
|
|
405
|
-
this.pixelmatchModulePath = opts.pixelmatchModulePath;
|
|
406
|
-
if (!opts.logger) {
|
|
407
|
-
throw new Error(`logger option required`);
|
|
408
|
-
}
|
|
409
|
-
if (typeof opts.buildId !== "string") {
|
|
410
|
-
throw new Error(`buildId option required`);
|
|
411
|
-
}
|
|
412
|
-
if (typeof opts.cacheDir !== "string") {
|
|
413
|
-
throw new Error(`cacheDir option required`);
|
|
414
|
-
}
|
|
415
|
-
if (typeof opts.packageDir !== "string") {
|
|
416
|
-
throw new Error(`packageDir option required`);
|
|
417
|
-
}
|
|
418
|
-
if (typeof opts.rootDir !== "string") {
|
|
419
|
-
throw new Error(`rootDir option required`);
|
|
420
|
-
}
|
|
421
|
-
this.updateMaster = !!opts.updateMaster;
|
|
422
|
-
this.allowableMismatchedPixels = opts.allowableMismatchedPixels;
|
|
423
|
-
this.allowableMismatchedRatio = opts.allowableMismatchedRatio;
|
|
424
|
-
this.pixelmatchThreshold = opts.pixelmatchThreshold;
|
|
425
|
-
this.logger.debug(`screenshot build: ${this.buildId}, ${this.buildMessage}, updateMaster: ${this.updateMaster}`);
|
|
426
|
-
this.logger.debug(
|
|
427
|
-
`screenshot, allowableMismatchedPixels: ${this.allowableMismatchedPixels}, allowableMismatchedRatio: ${this.allowableMismatchedRatio}, pixelmatchThreshold: ${this.pixelmatchThreshold}`
|
|
428
|
-
);
|
|
429
|
-
if (typeof opts.screenshotDirName === "string") {
|
|
430
|
-
this.screenshotDirName = opts.screenshotDirName;
|
|
431
|
-
}
|
|
432
|
-
if (typeof opts.imagesDirName === "string") {
|
|
433
|
-
this.imagesDirName = opts.imagesDirName;
|
|
434
|
-
}
|
|
435
|
-
if (typeof opts.buildsDirName === "string") {
|
|
436
|
-
this.buildsDirName = opts.buildsDirName;
|
|
437
|
-
}
|
|
438
|
-
this.screenshotDir = (0, import_path2.join)(this.rootDir, this.screenshotDirName);
|
|
439
|
-
this.imagesDir = (0, import_path2.join)(this.screenshotDir, this.imagesDirName);
|
|
440
|
-
this.buildsDir = (0, import_path2.join)(this.screenshotDir, this.buildsDirName);
|
|
441
|
-
this.masterBuildFilePath = (0, import_path2.join)(this.buildsDir, this.masterBuildFileName);
|
|
442
|
-
this.screenshotCacheFilePath = (0, import_path2.join)(this.cacheDir, this.screenshotCacheFileName);
|
|
443
|
-
this.currentBuildDir = (0, import_path2.join)((0, import_os.tmpdir)(), "screenshot-build-" + this.buildId);
|
|
444
|
-
this.logger.debug(`screenshotDirPath: ${this.screenshotDir}`);
|
|
445
|
-
this.logger.debug(`imagesDirPath: ${this.imagesDir}`);
|
|
446
|
-
this.logger.debug(`buildsDirPath: ${this.buildsDir}`);
|
|
447
|
-
this.logger.debug(`currentBuildDir: ${this.currentBuildDir}`);
|
|
448
|
-
this.logger.debug(`cacheDir: ${this.cacheDir}`);
|
|
449
|
-
await mkDir(this.screenshotDir);
|
|
450
|
-
await Promise.all([
|
|
451
|
-
mkDir(this.imagesDir),
|
|
452
|
-
mkDir(this.buildsDir),
|
|
453
|
-
mkDir(this.currentBuildDir),
|
|
454
|
-
mkDir(this.cacheDir)
|
|
455
|
-
]);
|
|
456
|
-
}
|
|
457
|
-
async pullMasterBuild() {
|
|
458
|
-
}
|
|
459
|
-
async getMasterBuild() {
|
|
460
|
-
try {
|
|
461
|
-
const masterBuild = JSON.parse(await readFile(this.masterBuildFilePath));
|
|
462
|
-
return masterBuild;
|
|
463
|
-
} catch (e) {
|
|
464
|
-
}
|
|
465
|
-
return null;
|
|
466
|
-
}
|
|
467
|
-
async completeBuild(masterBuild) {
|
|
468
|
-
const filePaths = (await readDir(this.currentBuildDir)).map((f) => (0, import_path2.join)(this.currentBuildDir, f)).filter((f) => f.endsWith(".json"));
|
|
469
|
-
const screenshots = await Promise.all(filePaths.map(async (f) => JSON.parse(await readFile(f))));
|
|
470
|
-
this.sortScreenshots(screenshots);
|
|
471
|
-
if (!masterBuild) {
|
|
472
|
-
masterBuild = {
|
|
473
|
-
id: this.buildId,
|
|
474
|
-
message: this.buildMessage,
|
|
475
|
-
author: this.buildAuthor,
|
|
476
|
-
url: this.buildUrl,
|
|
477
|
-
previewUrl: this.previewUrl,
|
|
478
|
-
appNamespace: this.appNamespace,
|
|
479
|
-
timestamp: this.buildTimestamp,
|
|
480
|
-
screenshots
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
const results = {
|
|
484
|
-
appNamespace: this.appNamespace,
|
|
485
|
-
masterBuild,
|
|
486
|
-
currentBuild: {
|
|
487
|
-
id: this.buildId,
|
|
488
|
-
message: this.buildMessage,
|
|
489
|
-
author: this.buildAuthor,
|
|
490
|
-
url: this.buildUrl,
|
|
491
|
-
previewUrl: this.previewUrl,
|
|
492
|
-
appNamespace: this.appNamespace,
|
|
493
|
-
timestamp: this.buildTimestamp,
|
|
494
|
-
screenshots
|
|
495
|
-
},
|
|
496
|
-
compare: {
|
|
497
|
-
id: `${masterBuild.id}-${this.buildId}`,
|
|
498
|
-
a: {
|
|
499
|
-
id: masterBuild.id,
|
|
500
|
-
message: masterBuild.message,
|
|
501
|
-
author: masterBuild.author,
|
|
502
|
-
url: masterBuild.url,
|
|
503
|
-
previewUrl: masterBuild.previewUrl
|
|
504
|
-
},
|
|
505
|
-
b: {
|
|
506
|
-
id: this.buildId,
|
|
507
|
-
message: this.buildMessage,
|
|
508
|
-
author: this.buildAuthor,
|
|
509
|
-
url: this.buildUrl,
|
|
510
|
-
previewUrl: this.previewUrl
|
|
511
|
-
},
|
|
512
|
-
url: null,
|
|
513
|
-
appNamespace: this.appNamespace,
|
|
514
|
-
timestamp: this.buildTimestamp,
|
|
515
|
-
diffs: []
|
|
516
|
-
}
|
|
517
|
-
};
|
|
518
|
-
results.currentBuild.screenshots.forEach((screenshot) => {
|
|
519
|
-
screenshot.diff.device = screenshot.diff.device || screenshot.diff.userAgent;
|
|
520
|
-
results.compare.diffs.push(screenshot.diff);
|
|
521
|
-
delete screenshot.diff;
|
|
522
|
-
});
|
|
523
|
-
this.sortCompares(results.compare.diffs);
|
|
524
|
-
await emptyDir(this.currentBuildDir);
|
|
525
|
-
await rmDir(this.currentBuildDir);
|
|
526
|
-
return results;
|
|
527
|
-
}
|
|
528
|
-
async publishBuild(results) {
|
|
529
|
-
return results;
|
|
530
|
-
}
|
|
531
|
-
async generateJsonpDataUris(build) {
|
|
532
|
-
if (build && Array.isArray(build.screenshots)) {
|
|
533
|
-
for (let i = 0; i < build.screenshots.length; i++) {
|
|
534
|
-
const screenshot = build.screenshots[i];
|
|
535
|
-
const jsonpFileName = `screenshot_${screenshot.image}.js`;
|
|
536
|
-
const jsonFilePath = (0, import_path2.join)(this.cacheDir, jsonpFileName);
|
|
537
|
-
const jsonpExists = await fileExists(jsonFilePath);
|
|
538
|
-
if (!jsonpExists) {
|
|
539
|
-
const imageFilePath = (0, import_path2.join)(this.imagesDir, screenshot.image);
|
|
540
|
-
const imageBuf = await readFileBuffer(imageFilePath);
|
|
541
|
-
const jsonpContent = `loadScreenshot("${screenshot.image}","data:image/png;base64,${imageBuf.toString(
|
|
542
|
-
"base64"
|
|
543
|
-
)}");`;
|
|
544
|
-
await writeFile(jsonFilePath, jsonpContent);
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
async getScreenshotCache() {
|
|
550
|
-
return null;
|
|
551
|
-
}
|
|
552
|
-
async updateScreenshotCache(screenshotCache, buildResults) {
|
|
553
|
-
screenshotCache = screenshotCache || {};
|
|
554
|
-
screenshotCache.timestamp = this.buildTimestamp;
|
|
555
|
-
screenshotCache.lastBuildId = this.buildId;
|
|
556
|
-
screenshotCache.size = 0;
|
|
557
|
-
screenshotCache.items = screenshotCache.items || [];
|
|
558
|
-
if (buildResults && buildResults.compare && Array.isArray(buildResults.compare.diffs)) {
|
|
559
|
-
buildResults.compare.diffs.forEach((diff) => {
|
|
560
|
-
if (typeof diff.cacheKey !== "string") {
|
|
561
|
-
return;
|
|
562
|
-
}
|
|
563
|
-
if (diff.imageA === diff.imageB) {
|
|
564
|
-
return;
|
|
565
|
-
}
|
|
566
|
-
const existingItem = screenshotCache.items.find((i) => i.key === diff.cacheKey);
|
|
567
|
-
if (existingItem) {
|
|
568
|
-
existingItem.ts = this.buildTimestamp;
|
|
569
|
-
} else {
|
|
570
|
-
screenshotCache.items.push({
|
|
571
|
-
key: diff.cacheKey,
|
|
572
|
-
ts: this.buildTimestamp,
|
|
573
|
-
mp: diff.mismatchedPixels
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
screenshotCache.items.sort((a, b) => {
|
|
579
|
-
if (a.ts > b.ts) return -1;
|
|
580
|
-
if (a.ts < b.ts) return 1;
|
|
581
|
-
if (a.mp > b.mp) return -1;
|
|
582
|
-
if (a.mp < b.mp) return 1;
|
|
583
|
-
return 0;
|
|
584
|
-
});
|
|
585
|
-
screenshotCache.items = screenshotCache.items.slice(0, 1e3);
|
|
586
|
-
screenshotCache.size = screenshotCache.items.length;
|
|
587
|
-
return screenshotCache;
|
|
588
|
-
}
|
|
589
|
-
toJson(masterBuild, screenshotCache) {
|
|
590
|
-
const masterScreenshots = {};
|
|
591
|
-
if (masterBuild && Array.isArray(masterBuild.screenshots)) {
|
|
592
|
-
masterBuild.screenshots.forEach((masterScreenshot) => {
|
|
593
|
-
masterScreenshots[masterScreenshot.id] = masterScreenshot.image;
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
const mismatchCache = {};
|
|
597
|
-
if (screenshotCache && Array.isArray(screenshotCache.items)) {
|
|
598
|
-
screenshotCache.items.forEach((cacheItem) => {
|
|
599
|
-
mismatchCache[cacheItem.key] = cacheItem.mp;
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
|
-
const screenshotBuild = {
|
|
603
|
-
buildId: this.buildId,
|
|
604
|
-
rootDir: this.rootDir,
|
|
605
|
-
screenshotDir: this.screenshotDir,
|
|
606
|
-
imagesDir: this.imagesDir,
|
|
607
|
-
buildsDir: this.buildsDir,
|
|
608
|
-
masterScreenshots,
|
|
609
|
-
cache: mismatchCache,
|
|
610
|
-
currentBuildDir: this.currentBuildDir,
|
|
611
|
-
updateMaster: this.updateMaster,
|
|
612
|
-
allowableMismatchedPixels: this.allowableMismatchedPixels,
|
|
613
|
-
allowableMismatchedRatio: this.allowableMismatchedRatio,
|
|
614
|
-
pixelmatchThreshold: this.pixelmatchThreshold,
|
|
615
|
-
timeoutBeforeScreenshot: this.waitBeforeScreenshot,
|
|
616
|
-
pixelmatchModulePath: this.pixelmatchModulePath
|
|
617
|
-
};
|
|
618
|
-
return JSON.stringify(screenshotBuild);
|
|
619
|
-
}
|
|
620
|
-
sortScreenshots(screenshots) {
|
|
621
|
-
return screenshots.sort((a, b) => {
|
|
622
|
-
if (a.desc && b.desc) {
|
|
623
|
-
if (a.desc.toLowerCase() < b.desc.toLowerCase()) return -1;
|
|
624
|
-
if (a.desc.toLowerCase() > b.desc.toLowerCase()) return 1;
|
|
625
|
-
}
|
|
626
|
-
if (a.device && b.device) {
|
|
627
|
-
if (a.device.toLowerCase() < b.device.toLowerCase()) return -1;
|
|
628
|
-
if (a.device.toLowerCase() > b.device.toLowerCase()) return 1;
|
|
629
|
-
}
|
|
630
|
-
if (a.userAgent && b.userAgent) {
|
|
631
|
-
if (a.userAgent.toLowerCase() < b.userAgent.toLowerCase()) return -1;
|
|
632
|
-
if (a.userAgent.toLowerCase() > b.userAgent.toLowerCase()) return 1;
|
|
633
|
-
}
|
|
634
|
-
if (a.width < b.width) return -1;
|
|
635
|
-
if (a.width > b.width) return 1;
|
|
636
|
-
if (a.height < b.height) return -1;
|
|
637
|
-
if (a.height > b.height) return 1;
|
|
638
|
-
if (a.id < b.id) return -1;
|
|
639
|
-
if (a.id > b.id) return 1;
|
|
640
|
-
return 0;
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
|
-
sortCompares(compares) {
|
|
644
|
-
return compares.sort((a, b) => {
|
|
645
|
-
if (a.allowableMismatchedPixels > b.allowableMismatchedPixels) return -1;
|
|
646
|
-
if (a.allowableMismatchedPixels < b.allowableMismatchedPixels) return 1;
|
|
647
|
-
if (a.allowableMismatchedRatio > b.allowableMismatchedRatio) return -1;
|
|
648
|
-
if (a.allowableMismatchedRatio < b.allowableMismatchedRatio) return 1;
|
|
649
|
-
if (a.desc && b.desc) {
|
|
650
|
-
if (a.desc.toLowerCase() < b.desc.toLowerCase()) return -1;
|
|
651
|
-
if (a.desc.toLowerCase() > b.desc.toLowerCase()) return 1;
|
|
652
|
-
}
|
|
653
|
-
if (a.device && b.device) {
|
|
654
|
-
if (a.device.toLowerCase() < b.device.toLowerCase()) return -1;
|
|
655
|
-
if (a.device.toLowerCase() > b.device.toLowerCase()) return 1;
|
|
656
|
-
}
|
|
657
|
-
if (a.userAgent && b.userAgent) {
|
|
658
|
-
if (a.userAgent.toLowerCase() < b.userAgent.toLowerCase()) return -1;
|
|
659
|
-
if (a.userAgent.toLowerCase() > b.userAgent.toLowerCase()) return 1;
|
|
660
|
-
}
|
|
661
|
-
if (a.width < b.width) return -1;
|
|
662
|
-
if (a.width > b.width) return 1;
|
|
663
|
-
if (a.height < b.height) return -1;
|
|
664
|
-
if (a.height > b.height) return 1;
|
|
665
|
-
if (a.id < b.id) return -1;
|
|
666
|
-
if (a.id > b.id) return 1;
|
|
667
|
-
return 0;
|
|
668
|
-
});
|
|
669
|
-
}
|
|
670
|
-
};
|
|
671
|
-
|
|
672
|
-
// src/utils/path.ts
|
|
673
|
-
var normalizePath = (path3, relativize = true) => {
|
|
674
|
-
if (typeof path3 !== "string") {
|
|
675
|
-
throw new Error(`invalid path to normalize`);
|
|
676
|
-
}
|
|
677
|
-
path3 = normalizeSlashes(path3.trim());
|
|
678
|
-
const components = pathComponents(path3, getRootLength(path3));
|
|
679
|
-
const reducedComponents = reducePathComponents(components);
|
|
680
|
-
const rootPart = reducedComponents[0];
|
|
681
|
-
const secondPart = reducedComponents[1];
|
|
682
|
-
const normalized = rootPart + reducedComponents.slice(1).join("/");
|
|
683
|
-
if (normalized === "") {
|
|
684
|
-
return ".";
|
|
685
|
-
}
|
|
686
|
-
if (rootPart === "" && secondPart && path3.includes("/") && !secondPart.startsWith(".") && !secondPart.startsWith("@") && relativize) {
|
|
687
|
-
return "./" + normalized;
|
|
688
|
-
}
|
|
689
|
-
return normalized;
|
|
690
|
-
};
|
|
691
|
-
var normalizeSlashes = (path3) => path3.replace(backslashRegExp, "/");
|
|
692
|
-
var altDirectorySeparator = "\\";
|
|
693
|
-
var urlSchemeSeparator = "://";
|
|
694
|
-
var backslashRegExp = /\\/g;
|
|
695
|
-
var reducePathComponents = (components) => {
|
|
696
|
-
if (!Array.isArray(components) || components.length === 0) {
|
|
697
|
-
return [];
|
|
698
|
-
}
|
|
699
|
-
const reduced = [components[0]];
|
|
700
|
-
for (let i = 1; i < components.length; i++) {
|
|
701
|
-
const component = components[i];
|
|
702
|
-
if (!component) continue;
|
|
703
|
-
if (component === ".") continue;
|
|
704
|
-
if (component === "..") {
|
|
705
|
-
if (reduced.length > 1) {
|
|
706
|
-
if (reduced[reduced.length - 1] !== "..") {
|
|
707
|
-
reduced.pop();
|
|
708
|
-
continue;
|
|
709
|
-
}
|
|
710
|
-
} else if (reduced[0]) continue;
|
|
711
|
-
}
|
|
712
|
-
reduced.push(component);
|
|
713
|
-
}
|
|
714
|
-
return reduced;
|
|
715
|
-
};
|
|
716
|
-
var getRootLength = (path3) => {
|
|
717
|
-
const rootLength = getEncodedRootLength(path3);
|
|
718
|
-
return rootLength < 0 ? ~rootLength : rootLength;
|
|
719
|
-
};
|
|
720
|
-
var getEncodedRootLength = (path3) => {
|
|
721
|
-
if (!path3) return 0;
|
|
722
|
-
const ch0 = path3.charCodeAt(0);
|
|
723
|
-
if (ch0 === 47 /* slash */ || ch0 === 92 /* backslash */) {
|
|
724
|
-
if (path3.charCodeAt(1) !== ch0) return 1;
|
|
725
|
-
const p1 = path3.indexOf(ch0 === 47 /* slash */ ? "/" : altDirectorySeparator, 2);
|
|
726
|
-
if (p1 < 0) return path3.length;
|
|
727
|
-
return p1 + 1;
|
|
728
|
-
}
|
|
729
|
-
if (isVolumeCharacter(ch0) && path3.charCodeAt(1) === 58 /* colon */) {
|
|
730
|
-
const ch2 = path3.charCodeAt(2);
|
|
731
|
-
if (ch2 === 47 /* slash */ || ch2 === 92 /* backslash */) return 3;
|
|
732
|
-
if (path3.length === 2) return 2;
|
|
733
|
-
}
|
|
734
|
-
const schemeEnd = path3.indexOf(urlSchemeSeparator);
|
|
735
|
-
if (schemeEnd !== -1) {
|
|
736
|
-
const authorityStart = schemeEnd + urlSchemeSeparator.length;
|
|
737
|
-
const authorityEnd = path3.indexOf("/", authorityStart);
|
|
738
|
-
if (authorityEnd !== -1) {
|
|
739
|
-
const scheme = path3.slice(0, schemeEnd);
|
|
740
|
-
const authority = path3.slice(authorityStart, authorityEnd);
|
|
741
|
-
if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(path3.charCodeAt(authorityEnd + 1))) {
|
|
742
|
-
const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path3, authorityEnd + 2);
|
|
743
|
-
if (volumeSeparatorEnd !== -1) {
|
|
744
|
-
if (path3.charCodeAt(volumeSeparatorEnd) === 47 /* slash */) {
|
|
745
|
-
return ~(volumeSeparatorEnd + 1);
|
|
746
|
-
}
|
|
747
|
-
if (volumeSeparatorEnd === path3.length) {
|
|
748
|
-
return ~volumeSeparatorEnd;
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
return ~(authorityEnd + 1);
|
|
753
|
-
}
|
|
754
|
-
return ~path3.length;
|
|
755
|
-
}
|
|
756
|
-
return 0;
|
|
757
|
-
};
|
|
758
|
-
var isVolumeCharacter = (charCode) => charCode >= 97 /* a */ && charCode <= 122 /* z */ || charCode >= 65 /* A */ && charCode <= 90 /* Z */;
|
|
759
|
-
var getFileUrlVolumeSeparatorEnd = (url, start) => {
|
|
760
|
-
const ch0 = url.charCodeAt(start);
|
|
761
|
-
if (ch0 === 58 /* colon */) return start + 1;
|
|
762
|
-
if (ch0 === 37 /* percent */ && url.charCodeAt(start + 1) === 51 /* _3 */) {
|
|
763
|
-
const ch2 = url.charCodeAt(start + 2);
|
|
764
|
-
if (ch2 === 97 /* a */ || ch2 === 65 /* A */) return start + 3;
|
|
765
|
-
}
|
|
766
|
-
return -1;
|
|
767
|
-
};
|
|
768
|
-
var pathComponents = (path3, rootLength) => {
|
|
769
|
-
const root = path3.substring(0, rootLength);
|
|
770
|
-
const rest = path3.substring(rootLength).split("/");
|
|
771
|
-
const restLen = rest.length;
|
|
772
|
-
if (restLen > 0 && !rest[restLen - 1]) {
|
|
773
|
-
rest.pop();
|
|
774
|
-
}
|
|
775
|
-
return [root, ...rest];
|
|
776
|
-
};
|
|
777
|
-
|
|
778
|
-
// node_modules/minimatch/dist/esm/index.js
|
|
779
|
-
var import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
|
780
|
-
|
|
781
|
-
// node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
782
|
-
var MAX_PATTERN_LENGTH = 1024 * 64;
|
|
783
|
-
var assertValidPattern = (pattern) => {
|
|
784
|
-
if (typeof pattern !== "string") {
|
|
785
|
-
throw new TypeError("invalid pattern");
|
|
786
|
-
}
|
|
787
|
-
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
788
|
-
throw new TypeError("pattern is too long");
|
|
789
|
-
}
|
|
790
|
-
};
|
|
791
|
-
|
|
792
|
-
// node_modules/minimatch/dist/esm/brace-expressions.js
|
|
793
|
-
var posixClasses = {
|
|
794
|
-
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
795
|
-
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
|
|
796
|
-
"[:ascii:]": ["\\x00-\\x7f", false],
|
|
797
|
-
"[:blank:]": ["\\p{Zs}\\t", true],
|
|
798
|
-
"[:cntrl:]": ["\\p{Cc}", true],
|
|
799
|
-
"[:digit:]": ["\\p{Nd}", true],
|
|
800
|
-
"[:graph:]": ["\\p{Z}\\p{C}", true, true],
|
|
801
|
-
"[:lower:]": ["\\p{Ll}", true],
|
|
802
|
-
"[:print:]": ["\\p{C}", true],
|
|
803
|
-
"[:punct:]": ["\\p{P}", true],
|
|
804
|
-
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
|
|
805
|
-
"[:upper:]": ["\\p{Lu}", true],
|
|
806
|
-
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
|
|
807
|
-
"[:xdigit:]": ["A-Fa-f0-9", false]
|
|
808
|
-
};
|
|
809
|
-
var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
|
|
810
|
-
var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
811
|
-
var rangesToString = (ranges) => ranges.join("");
|
|
812
|
-
var parseClass = (glob, position) => {
|
|
813
|
-
const pos = position;
|
|
814
|
-
if (glob.charAt(pos) !== "[") {
|
|
815
|
-
throw new Error("not in a brace expression");
|
|
816
|
-
}
|
|
817
|
-
const ranges = [];
|
|
818
|
-
const negs = [];
|
|
819
|
-
let i = pos + 1;
|
|
820
|
-
let sawStart = false;
|
|
821
|
-
let uflag = false;
|
|
822
|
-
let escaping = false;
|
|
823
|
-
let negate = false;
|
|
824
|
-
let endPos = pos;
|
|
825
|
-
let rangeStart = "";
|
|
826
|
-
WHILE: while (i < glob.length) {
|
|
827
|
-
const c = glob.charAt(i);
|
|
828
|
-
if ((c === "!" || c === "^") && i === pos + 1) {
|
|
829
|
-
negate = true;
|
|
830
|
-
i++;
|
|
831
|
-
continue;
|
|
832
|
-
}
|
|
833
|
-
if (c === "]" && sawStart && !escaping) {
|
|
834
|
-
endPos = i + 1;
|
|
835
|
-
break;
|
|
836
|
-
}
|
|
837
|
-
sawStart = true;
|
|
838
|
-
if (c === "\\") {
|
|
839
|
-
if (!escaping) {
|
|
840
|
-
escaping = true;
|
|
841
|
-
i++;
|
|
842
|
-
continue;
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
if (c === "[" && !escaping) {
|
|
846
|
-
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
|
|
847
|
-
if (glob.startsWith(cls, i)) {
|
|
848
|
-
if (rangeStart) {
|
|
849
|
-
return ["$.", false, glob.length - pos, true];
|
|
850
|
-
}
|
|
851
|
-
i += cls.length;
|
|
852
|
-
if (neg)
|
|
853
|
-
negs.push(unip);
|
|
854
|
-
else
|
|
855
|
-
ranges.push(unip);
|
|
856
|
-
uflag = uflag || u;
|
|
857
|
-
continue WHILE;
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
escaping = false;
|
|
862
|
-
if (rangeStart) {
|
|
863
|
-
if (c > rangeStart) {
|
|
864
|
-
ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
|
|
865
|
-
} else if (c === rangeStart) {
|
|
866
|
-
ranges.push(braceEscape(c));
|
|
867
|
-
}
|
|
868
|
-
rangeStart = "";
|
|
869
|
-
i++;
|
|
870
|
-
continue;
|
|
871
|
-
}
|
|
872
|
-
if (glob.startsWith("-]", i + 1)) {
|
|
873
|
-
ranges.push(braceEscape(c + "-"));
|
|
874
|
-
i += 2;
|
|
875
|
-
continue;
|
|
876
|
-
}
|
|
877
|
-
if (glob.startsWith("-", i + 1)) {
|
|
878
|
-
rangeStart = c;
|
|
879
|
-
i += 2;
|
|
880
|
-
continue;
|
|
881
|
-
}
|
|
882
|
-
ranges.push(braceEscape(c));
|
|
883
|
-
i++;
|
|
884
|
-
}
|
|
885
|
-
if (endPos < i) {
|
|
886
|
-
return ["", false, 0, false];
|
|
887
|
-
}
|
|
888
|
-
if (!ranges.length && !negs.length) {
|
|
889
|
-
return ["$.", false, glob.length - pos, true];
|
|
890
|
-
}
|
|
891
|
-
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
|
|
892
|
-
const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
|
|
893
|
-
return [regexpEscape(r), false, endPos - pos, false];
|
|
894
|
-
}
|
|
895
|
-
const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
|
|
896
|
-
const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
|
|
897
|
-
const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
|
|
898
|
-
return [comb, uflag, endPos - pos, true];
|
|
899
|
-
};
|
|
900
|
-
|
|
901
|
-
// node_modules/minimatch/dist/esm/unescape.js
|
|
902
|
-
var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
903
|
-
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
904
|
-
};
|
|
905
|
-
|
|
906
|
-
// node_modules/minimatch/dist/esm/ast.js
|
|
907
|
-
var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
|
908
|
-
var isExtglobType = (c) => types.has(c);
|
|
909
|
-
var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
910
|
-
var startNoDot = "(?!\\.)";
|
|
911
|
-
var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
|
|
912
|
-
var justDots = /* @__PURE__ */ new Set(["..", "."]);
|
|
913
|
-
var reSpecials = new Set("().*{}+?[]^$\\!");
|
|
914
|
-
var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
915
|
-
var qmark = "[^/]";
|
|
916
|
-
var star = qmark + "*?";
|
|
917
|
-
var starNoEmpty = qmark + "+?";
|
|
918
|
-
var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn;
|
|
919
|
-
var _AST = class _AST {
|
|
920
|
-
constructor(type, parent, options = {}) {
|
|
921
|
-
__privateAdd(this, _AST_instances);
|
|
922
|
-
__publicField(this, "type");
|
|
923
|
-
__privateAdd(this, _root);
|
|
924
|
-
__privateAdd(this, _hasMagic);
|
|
925
|
-
__privateAdd(this, _uflag, false);
|
|
926
|
-
__privateAdd(this, _parts, []);
|
|
927
|
-
__privateAdd(this, _parent);
|
|
928
|
-
__privateAdd(this, _parentIndex);
|
|
929
|
-
__privateAdd(this, _negs);
|
|
930
|
-
__privateAdd(this, _filledNegs, false);
|
|
931
|
-
__privateAdd(this, _options);
|
|
932
|
-
__privateAdd(this, _toString);
|
|
933
|
-
// set to true if it's an extglob with no children
|
|
934
|
-
// (which really means one child of '')
|
|
935
|
-
__privateAdd(this, _emptyExt, false);
|
|
936
|
-
this.type = type;
|
|
937
|
-
if (type)
|
|
938
|
-
__privateSet(this, _hasMagic, true);
|
|
939
|
-
__privateSet(this, _parent, parent);
|
|
940
|
-
__privateSet(this, _root, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _root) : this);
|
|
941
|
-
__privateSet(this, _options, __privateGet(this, _root) === this ? options : __privateGet(__privateGet(this, _root), _options));
|
|
942
|
-
__privateSet(this, _negs, __privateGet(this, _root) === this ? [] : __privateGet(__privateGet(this, _root), _negs));
|
|
943
|
-
if (type === "!" && !__privateGet(__privateGet(this, _root), _filledNegs))
|
|
944
|
-
__privateGet(this, _negs).push(this);
|
|
945
|
-
__privateSet(this, _parentIndex, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0);
|
|
946
|
-
}
|
|
947
|
-
get hasMagic() {
|
|
948
|
-
if (__privateGet(this, _hasMagic) !== void 0)
|
|
949
|
-
return __privateGet(this, _hasMagic);
|
|
950
|
-
for (const p of __privateGet(this, _parts)) {
|
|
951
|
-
if (typeof p === "string")
|
|
952
|
-
continue;
|
|
953
|
-
if (p.type || p.hasMagic)
|
|
954
|
-
return __privateSet(this, _hasMagic, true);
|
|
955
|
-
}
|
|
956
|
-
return __privateGet(this, _hasMagic);
|
|
957
|
-
}
|
|
958
|
-
// reconstructs the pattern
|
|
959
|
-
toString() {
|
|
960
|
-
if (__privateGet(this, _toString) !== void 0)
|
|
961
|
-
return __privateGet(this, _toString);
|
|
962
|
-
if (!this.type) {
|
|
963
|
-
return __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join(""));
|
|
964
|
-
} else {
|
|
965
|
-
return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
push(...parts) {
|
|
969
|
-
for (const p of parts) {
|
|
970
|
-
if (p === "")
|
|
971
|
-
continue;
|
|
972
|
-
if (typeof p !== "string" && !(p instanceof _AST && __privateGet(p, _parent) === this)) {
|
|
973
|
-
throw new Error("invalid part: " + p);
|
|
974
|
-
}
|
|
975
|
-
__privateGet(this, _parts).push(p);
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
toJSON() {
|
|
979
|
-
var _a;
|
|
980
|
-
const ret = this.type === null ? __privateGet(this, _parts).slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...__privateGet(this, _parts).map((p) => p.toJSON())];
|
|
981
|
-
if (this.isStart() && !this.type)
|
|
982
|
-
ret.unshift([]);
|
|
983
|
-
if (this.isEnd() && (this === __privateGet(this, _root) || __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")) {
|
|
984
|
-
ret.push({});
|
|
985
|
-
}
|
|
986
|
-
return ret;
|
|
987
|
-
}
|
|
988
|
-
isStart() {
|
|
989
|
-
var _a;
|
|
990
|
-
if (__privateGet(this, _root) === this)
|
|
991
|
-
return true;
|
|
992
|
-
if (!((_a = __privateGet(this, _parent)) == null ? void 0 : _a.isStart()))
|
|
993
|
-
return false;
|
|
994
|
-
if (__privateGet(this, _parentIndex) === 0)
|
|
995
|
-
return true;
|
|
996
|
-
const p = __privateGet(this, _parent);
|
|
997
|
-
for (let i = 0; i < __privateGet(this, _parentIndex); i++) {
|
|
998
|
-
const pp = __privateGet(p, _parts)[i];
|
|
999
|
-
if (!(pp instanceof _AST && pp.type === "!")) {
|
|
1000
|
-
return false;
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
return true;
|
|
1004
|
-
}
|
|
1005
|
-
isEnd() {
|
|
1006
|
-
var _a, _b, _c;
|
|
1007
|
-
if (__privateGet(this, _root) === this)
|
|
1008
|
-
return true;
|
|
1009
|
-
if (((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")
|
|
1010
|
-
return true;
|
|
1011
|
-
if (!((_b = __privateGet(this, _parent)) == null ? void 0 : _b.isEnd()))
|
|
1012
|
-
return false;
|
|
1013
|
-
if (!this.type)
|
|
1014
|
-
return (_c = __privateGet(this, _parent)) == null ? void 0 : _c.isEnd();
|
|
1015
|
-
const pl = __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0;
|
|
1016
|
-
return __privateGet(this, _parentIndex) === pl - 1;
|
|
1017
|
-
}
|
|
1018
|
-
copyIn(part) {
|
|
1019
|
-
if (typeof part === "string")
|
|
1020
|
-
this.push(part);
|
|
1021
|
-
else
|
|
1022
|
-
this.push(part.clone(this));
|
|
1023
|
-
}
|
|
1024
|
-
clone(parent) {
|
|
1025
|
-
const c = new _AST(this.type, parent);
|
|
1026
|
-
for (const p of __privateGet(this, _parts)) {
|
|
1027
|
-
c.copyIn(p);
|
|
1028
|
-
}
|
|
1029
|
-
return c;
|
|
1030
|
-
}
|
|
1031
|
-
static fromGlob(pattern, options = {}) {
|
|
1032
|
-
var _a;
|
|
1033
|
-
const ast = new _AST(null, void 0, options);
|
|
1034
|
-
__privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, pattern, ast, 0, options);
|
|
1035
|
-
return ast;
|
|
1036
|
-
}
|
|
1037
|
-
// returns the regular expression if there's magic, or the unescaped
|
|
1038
|
-
// string if not.
|
|
1039
|
-
toMMPattern() {
|
|
1040
|
-
if (this !== __privateGet(this, _root))
|
|
1041
|
-
return __privateGet(this, _root).toMMPattern();
|
|
1042
|
-
const glob = this.toString();
|
|
1043
|
-
const [re, body, hasMagic, uflag] = this.toRegExpSource();
|
|
1044
|
-
const anyMagic = hasMagic || __privateGet(this, _hasMagic) || __privateGet(this, _options).nocase && !__privateGet(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
|
|
1045
|
-
if (!anyMagic) {
|
|
1046
|
-
return body;
|
|
1047
|
-
}
|
|
1048
|
-
const flags = (__privateGet(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
|
|
1049
|
-
return Object.assign(new RegExp(`^${re}$`, flags), {
|
|
1050
|
-
_src: re,
|
|
1051
|
-
_glob: glob
|
|
1052
|
-
});
|
|
1053
|
-
}
|
|
1054
|
-
get options() {
|
|
1055
|
-
return __privateGet(this, _options);
|
|
1056
|
-
}
|
|
1057
|
-
// returns the string match, the regexp source, whether there's magic
|
|
1058
|
-
// in the regexp (so a regular expression is required) and whether or
|
|
1059
|
-
// not the uflag is needed for the regular expression (for posix classes)
|
|
1060
|
-
// TODO: instead of injecting the start/end at this point, just return
|
|
1061
|
-
// the BODY of the regexp, along with the start/end portions suitable
|
|
1062
|
-
// for binding the start/end in either a joined full-path makeRe context
|
|
1063
|
-
// (where we bind to (^|/), or a standalone matchPart context (where
|
|
1064
|
-
// we bind to ^, and not /). Otherwise slashes get duped!
|
|
1065
|
-
//
|
|
1066
|
-
// In part-matching mode, the start is:
|
|
1067
|
-
// - if not isStart: nothing
|
|
1068
|
-
// - if traversal possible, but not allowed: ^(?!\.\.?$)
|
|
1069
|
-
// - if dots allowed or not possible: ^
|
|
1070
|
-
// - if dots possible and not allowed: ^(?!\.)
|
|
1071
|
-
// end is:
|
|
1072
|
-
// - if not isEnd(): nothing
|
|
1073
|
-
// - else: $
|
|
1074
|
-
//
|
|
1075
|
-
// In full-path matching mode, we put the slash at the START of the
|
|
1076
|
-
// pattern, so start is:
|
|
1077
|
-
// - if first pattern: same as part-matching mode
|
|
1078
|
-
// - if not isStart(): nothing
|
|
1079
|
-
// - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
|
|
1080
|
-
// - if dots allowed or not possible: /
|
|
1081
|
-
// - if dots possible and not allowed: /(?!\.)
|
|
1082
|
-
// end is:
|
|
1083
|
-
// - if last pattern, same as part-matching mode
|
|
1084
|
-
// - else nothing
|
|
1085
|
-
//
|
|
1086
|
-
// Always put the (?:$|/) on negated tails, though, because that has to be
|
|
1087
|
-
// there to bind the end of the negated pattern portion, and it's easier to
|
|
1088
|
-
// just stick it in now rather than try to inject it later in the middle of
|
|
1089
|
-
// the pattern.
|
|
1090
|
-
//
|
|
1091
|
-
// We can just always return the same end, and leave it up to the caller
|
|
1092
|
-
// to know whether it's going to be used joined or in parts.
|
|
1093
|
-
// And, if the start is adjusted slightly, can do the same there:
|
|
1094
|
-
// - if not isStart: nothing
|
|
1095
|
-
// - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
|
|
1096
|
-
// - if dots allowed or not possible: (?:/|^)
|
|
1097
|
-
// - if dots possible and not allowed: (?:/|^)(?!\.)
|
|
1098
|
-
//
|
|
1099
|
-
// But it's better to have a simpler binding without a conditional, for
|
|
1100
|
-
// performance, so probably better to return both start options.
|
|
1101
|
-
//
|
|
1102
|
-
// Then the caller just ignores the end if it's not the first pattern,
|
|
1103
|
-
// and the start always gets applied.
|
|
1104
|
-
//
|
|
1105
|
-
// But that's always going to be $ if it's the ending pattern, or nothing,
|
|
1106
|
-
// so the caller can just attach $ at the end of the pattern when building.
|
|
1107
|
-
//
|
|
1108
|
-
// So the todo is:
|
|
1109
|
-
// - better detect what kind of start is needed
|
|
1110
|
-
// - return both flavors of starting pattern
|
|
1111
|
-
// - attach $ at the end of the pattern when creating the actual RegExp
|
|
1112
|
-
//
|
|
1113
|
-
// Ah, but wait, no, that all only applies to the root when the first pattern
|
|
1114
|
-
// is not an extglob. If the first pattern IS an extglob, then we need all
|
|
1115
|
-
// that dot prevention biz to live in the extglob portions, because eg
|
|
1116
|
-
// +(*|.x*) can match .xy but not .yx.
|
|
1117
|
-
//
|
|
1118
|
-
// So, return the two flavors if it's #root and the first child is not an
|
|
1119
|
-
// AST, otherwise leave it to the child AST to handle it, and there,
|
|
1120
|
-
// use the (?:^|/) style of start binding.
|
|
1121
|
-
//
|
|
1122
|
-
// Even simplified further:
|
|
1123
|
-
// - Since the start for a join is eg /(?!\.) and the start for a part
|
|
1124
|
-
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
|
|
1125
|
-
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
|
1126
|
-
toRegExpSource(allowDot) {
|
|
1127
|
-
var _a;
|
|
1128
|
-
const dot = allowDot != null ? allowDot : !!__privateGet(this, _options).dot;
|
|
1129
|
-
if (__privateGet(this, _root) === this)
|
|
1130
|
-
__privateMethod(this, _AST_instances, fillNegs_fn).call(this);
|
|
1131
|
-
if (!this.type) {
|
|
1132
|
-
const noEmpty = this.isStart() && this.isEnd();
|
|
1133
|
-
const src = __privateGet(this, _parts).map((p) => {
|
|
1134
|
-
var _a2;
|
|
1135
|
-
const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a2 = _AST, _AST_static, parseGlob_fn).call(_a2, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
|
|
1136
|
-
__privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
|
|
1137
|
-
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
|
|
1138
|
-
return re;
|
|
1139
|
-
}).join("");
|
|
1140
|
-
let start2 = "";
|
|
1141
|
-
if (this.isStart()) {
|
|
1142
|
-
if (typeof __privateGet(this, _parts)[0] === "string") {
|
|
1143
|
-
const dotTravAllowed = __privateGet(this, _parts).length === 1 && justDots.has(__privateGet(this, _parts)[0]);
|
|
1144
|
-
if (!dotTravAllowed) {
|
|
1145
|
-
const aps = addPatternStart;
|
|
1146
|
-
const needNoTrav = (
|
|
1147
|
-
// dots are allowed, and the pattern starts with [ or .
|
|
1148
|
-
dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
|
|
1149
|
-
src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
|
|
1150
|
-
src.startsWith("\\.\\.") && aps.has(src.charAt(4))
|
|
1151
|
-
);
|
|
1152
|
-
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
|
1153
|
-
start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
let end = "";
|
|
1158
|
-
if (this.isEnd() && __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!") {
|
|
1159
|
-
end = "(?:$|\\/)";
|
|
1160
|
-
}
|
|
1161
|
-
const final2 = start2 + src + end;
|
|
1162
|
-
return [
|
|
1163
|
-
final2,
|
|
1164
|
-
unescape(src),
|
|
1165
|
-
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
|
|
1166
|
-
__privateGet(this, _uflag)
|
|
1167
|
-
];
|
|
1168
|
-
}
|
|
1169
|
-
const repeated = this.type === "*" || this.type === "+";
|
|
1170
|
-
const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
1171
|
-
let body = __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, dot);
|
|
1172
|
-
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
|
1173
|
-
const s = this.toString();
|
|
1174
|
-
__privateSet(this, _parts, [s]);
|
|
1175
|
-
this.type = null;
|
|
1176
|
-
__privateSet(this, _hasMagic, void 0);
|
|
1177
|
-
return [s, unescape(this.toString()), false, false];
|
|
1178
|
-
}
|
|
1179
|
-
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, true);
|
|
1180
|
-
if (bodyDotAllowed === body) {
|
|
1181
|
-
bodyDotAllowed = "";
|
|
1182
|
-
}
|
|
1183
|
-
if (bodyDotAllowed) {
|
|
1184
|
-
body = `(?:${body})(?:${bodyDotAllowed})*?`;
|
|
1185
|
-
}
|
|
1186
|
-
let final = "";
|
|
1187
|
-
if (this.type === "!" && __privateGet(this, _emptyExt)) {
|
|
1188
|
-
final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
|
|
1189
|
-
} else {
|
|
1190
|
-
const close = this.type === "!" ? (
|
|
1191
|
-
// !() must match something,but !(x) can match ''
|
|
1192
|
-
"))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
|
|
1193
|
-
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
|
|
1194
|
-
final = start + body + close;
|
|
1195
|
-
}
|
|
1196
|
-
return [
|
|
1197
|
-
final,
|
|
1198
|
-
unescape(body),
|
|
1199
|
-
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
|
|
1200
|
-
__privateGet(this, _uflag)
|
|
1201
|
-
];
|
|
1202
|
-
}
|
|
1203
|
-
};
|
|
1204
|
-
_root = new WeakMap();
|
|
1205
|
-
_hasMagic = new WeakMap();
|
|
1206
|
-
_uflag = new WeakMap();
|
|
1207
|
-
_parts = new WeakMap();
|
|
1208
|
-
_parent = new WeakMap();
|
|
1209
|
-
_parentIndex = new WeakMap();
|
|
1210
|
-
_negs = new WeakMap();
|
|
1211
|
-
_filledNegs = new WeakMap();
|
|
1212
|
-
_options = new WeakMap();
|
|
1213
|
-
_toString = new WeakMap();
|
|
1214
|
-
_emptyExt = new WeakMap();
|
|
1215
|
-
_AST_instances = new WeakSet();
|
|
1216
|
-
fillNegs_fn = function() {
|
|
1217
|
-
if (this !== __privateGet(this, _root))
|
|
1218
|
-
throw new Error("should only call on root");
|
|
1219
|
-
if (__privateGet(this, _filledNegs))
|
|
1220
|
-
return this;
|
|
1221
|
-
this.toString();
|
|
1222
|
-
__privateSet(this, _filledNegs, true);
|
|
1223
|
-
let n;
|
|
1224
|
-
while (n = __privateGet(this, _negs).pop()) {
|
|
1225
|
-
if (n.type !== "!")
|
|
1226
|
-
continue;
|
|
1227
|
-
let p = n;
|
|
1228
|
-
let pp = __privateGet(p, _parent);
|
|
1229
|
-
while (pp) {
|
|
1230
|
-
for (let i = __privateGet(p, _parentIndex) + 1; !pp.type && i < __privateGet(pp, _parts).length; i++) {
|
|
1231
|
-
for (const part of __privateGet(n, _parts)) {
|
|
1232
|
-
if (typeof part === "string") {
|
|
1233
|
-
throw new Error("string part in extglob AST??");
|
|
1234
|
-
}
|
|
1235
|
-
part.copyIn(__privateGet(pp, _parts)[i]);
|
|
1236
|
-
}
|
|
1237
|
-
}
|
|
1238
|
-
p = pp;
|
|
1239
|
-
pp = __privateGet(p, _parent);
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
return this;
|
|
1243
|
-
};
|
|
1244
|
-
_AST_static = new WeakSet();
|
|
1245
|
-
parseAST_fn = function(str, ast, pos, opt) {
|
|
1246
|
-
var _a, _b;
|
|
1247
|
-
let escaping = false;
|
|
1248
|
-
let inBrace = false;
|
|
1249
|
-
let braceStart = -1;
|
|
1250
|
-
let braceNeg = false;
|
|
1251
|
-
if (ast.type === null) {
|
|
1252
|
-
let i2 = pos;
|
|
1253
|
-
let acc2 = "";
|
|
1254
|
-
while (i2 < str.length) {
|
|
1255
|
-
const c = str.charAt(i2++);
|
|
1256
|
-
if (escaping || c === "\\") {
|
|
1257
|
-
escaping = !escaping;
|
|
1258
|
-
acc2 += c;
|
|
1259
|
-
continue;
|
|
1260
|
-
}
|
|
1261
|
-
if (inBrace) {
|
|
1262
|
-
if (i2 === braceStart + 1) {
|
|
1263
|
-
if (c === "^" || c === "!") {
|
|
1264
|
-
braceNeg = true;
|
|
1265
|
-
}
|
|
1266
|
-
} else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
|
|
1267
|
-
inBrace = false;
|
|
1268
|
-
}
|
|
1269
|
-
acc2 += c;
|
|
1270
|
-
continue;
|
|
1271
|
-
} else if (c === "[") {
|
|
1272
|
-
inBrace = true;
|
|
1273
|
-
braceStart = i2;
|
|
1274
|
-
braceNeg = false;
|
|
1275
|
-
acc2 += c;
|
|
1276
|
-
continue;
|
|
1277
|
-
}
|
|
1278
|
-
if (!opt.noext && isExtglobType(c) && str.charAt(i2) === "(") {
|
|
1279
|
-
ast.push(acc2);
|
|
1280
|
-
acc2 = "";
|
|
1281
|
-
const ext2 = new _AST(c, ast);
|
|
1282
|
-
i2 = __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, str, ext2, i2, opt);
|
|
1283
|
-
ast.push(ext2);
|
|
1284
|
-
continue;
|
|
1285
|
-
}
|
|
1286
|
-
acc2 += c;
|
|
1287
|
-
}
|
|
1288
|
-
ast.push(acc2);
|
|
1289
|
-
return i2;
|
|
1290
|
-
}
|
|
1291
|
-
let i = pos + 1;
|
|
1292
|
-
let part = new _AST(null, ast);
|
|
1293
|
-
const parts = [];
|
|
1294
|
-
let acc = "";
|
|
1295
|
-
while (i < str.length) {
|
|
1296
|
-
const c = str.charAt(i++);
|
|
1297
|
-
if (escaping || c === "\\") {
|
|
1298
|
-
escaping = !escaping;
|
|
1299
|
-
acc += c;
|
|
1300
|
-
continue;
|
|
1301
|
-
}
|
|
1302
|
-
if (inBrace) {
|
|
1303
|
-
if (i === braceStart + 1) {
|
|
1304
|
-
if (c === "^" || c === "!") {
|
|
1305
|
-
braceNeg = true;
|
|
1306
|
-
}
|
|
1307
|
-
} else if (c === "]" && !(i === braceStart + 2 && braceNeg)) {
|
|
1308
|
-
inBrace = false;
|
|
1309
|
-
}
|
|
1310
|
-
acc += c;
|
|
1311
|
-
continue;
|
|
1312
|
-
} else if (c === "[") {
|
|
1313
|
-
inBrace = true;
|
|
1314
|
-
braceStart = i;
|
|
1315
|
-
braceNeg = false;
|
|
1316
|
-
acc += c;
|
|
1317
|
-
continue;
|
|
1318
|
-
}
|
|
1319
|
-
if (isExtglobType(c) && str.charAt(i) === "(") {
|
|
1320
|
-
part.push(acc);
|
|
1321
|
-
acc = "";
|
|
1322
|
-
const ext2 = new _AST(c, part);
|
|
1323
|
-
part.push(ext2);
|
|
1324
|
-
i = __privateMethod(_b = _AST, _AST_static, parseAST_fn).call(_b, str, ext2, i, opt);
|
|
1325
|
-
continue;
|
|
1326
|
-
}
|
|
1327
|
-
if (c === "|") {
|
|
1328
|
-
part.push(acc);
|
|
1329
|
-
acc = "";
|
|
1330
|
-
parts.push(part);
|
|
1331
|
-
part = new _AST(null, ast);
|
|
1332
|
-
continue;
|
|
1333
|
-
}
|
|
1334
|
-
if (c === ")") {
|
|
1335
|
-
if (acc === "" && __privateGet(ast, _parts).length === 0) {
|
|
1336
|
-
__privateSet(ast, _emptyExt, true);
|
|
1337
|
-
}
|
|
1338
|
-
part.push(acc);
|
|
1339
|
-
acc = "";
|
|
1340
|
-
ast.push(...parts, part);
|
|
1341
|
-
return i;
|
|
1342
|
-
}
|
|
1343
|
-
acc += c;
|
|
1344
|
-
}
|
|
1345
|
-
ast.type = null;
|
|
1346
|
-
__privateSet(ast, _hasMagic, void 0);
|
|
1347
|
-
__privateSet(ast, _parts, [str.substring(pos - 1)]);
|
|
1348
|
-
return i;
|
|
1349
|
-
};
|
|
1350
|
-
partsToRegExp_fn = function(dot) {
|
|
1351
|
-
return __privateGet(this, _parts).map((p) => {
|
|
1352
|
-
if (typeof p === "string") {
|
|
1353
|
-
throw new Error("string type in extglob ast??");
|
|
1354
|
-
}
|
|
1355
|
-
const [re, _, _hasMagic2, uflag] = p.toRegExpSource(dot);
|
|
1356
|
-
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
|
|
1357
|
-
return re;
|
|
1358
|
-
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
1359
|
-
};
|
|
1360
|
-
parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
|
|
1361
|
-
let escaping = false;
|
|
1362
|
-
let re = "";
|
|
1363
|
-
let uflag = false;
|
|
1364
|
-
for (let i = 0; i < glob.length; i++) {
|
|
1365
|
-
const c = glob.charAt(i);
|
|
1366
|
-
if (escaping) {
|
|
1367
|
-
escaping = false;
|
|
1368
|
-
re += (reSpecials.has(c) ? "\\" : "") + c;
|
|
1369
|
-
continue;
|
|
1370
|
-
}
|
|
1371
|
-
if (c === "\\") {
|
|
1372
|
-
if (i === glob.length - 1) {
|
|
1373
|
-
re += "\\\\";
|
|
1374
|
-
} else {
|
|
1375
|
-
escaping = true;
|
|
1376
|
-
}
|
|
1377
|
-
continue;
|
|
1378
|
-
}
|
|
1379
|
-
if (c === "[") {
|
|
1380
|
-
const [src, needUflag, consumed, magic] = parseClass(glob, i);
|
|
1381
|
-
if (consumed) {
|
|
1382
|
-
re += src;
|
|
1383
|
-
uflag = uflag || needUflag;
|
|
1384
|
-
i += consumed - 1;
|
|
1385
|
-
hasMagic = hasMagic || magic;
|
|
1386
|
-
continue;
|
|
1387
|
-
}
|
|
1388
|
-
}
|
|
1389
|
-
if (c === "*") {
|
|
1390
|
-
if (noEmpty && glob === "*")
|
|
1391
|
-
re += starNoEmpty;
|
|
1392
|
-
else
|
|
1393
|
-
re += star;
|
|
1394
|
-
hasMagic = true;
|
|
1395
|
-
continue;
|
|
1396
|
-
}
|
|
1397
|
-
if (c === "?") {
|
|
1398
|
-
re += qmark;
|
|
1399
|
-
hasMagic = true;
|
|
1400
|
-
continue;
|
|
1401
|
-
}
|
|
1402
|
-
re += regExpEscape(c);
|
|
1403
|
-
}
|
|
1404
|
-
return [re, unescape(glob), !!hasMagic, uflag];
|
|
1405
|
-
};
|
|
1406
|
-
__privateAdd(_AST, _AST_static);
|
|
1407
|
-
var AST = _AST;
|
|
1408
|
-
|
|
1409
|
-
// node_modules/minimatch/dist/esm/escape.js
|
|
1410
|
-
var escape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
1411
|
-
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
1412
|
-
};
|
|
1413
|
-
|
|
1414
|
-
// node_modules/minimatch/dist/esm/index.js
|
|
1415
|
-
var minimatch = (p, pattern, options = {}) => {
|
|
1416
|
-
assertValidPattern(pattern);
|
|
1417
|
-
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
1418
|
-
return false;
|
|
1419
|
-
}
|
|
1420
|
-
return new Minimatch(pattern, options).match(p);
|
|
1421
|
-
};
|
|
1422
|
-
var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
|
|
1423
|
-
var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
|
|
1424
|
-
var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
|
|
1425
|
-
var starDotExtTestNocase = (ext2) => {
|
|
1426
|
-
ext2 = ext2.toLowerCase();
|
|
1427
|
-
return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
|
|
1428
|
-
};
|
|
1429
|
-
var starDotExtTestNocaseDot = (ext2) => {
|
|
1430
|
-
ext2 = ext2.toLowerCase();
|
|
1431
|
-
return (f) => f.toLowerCase().endsWith(ext2);
|
|
1432
|
-
};
|
|
1433
|
-
var starDotStarRE = /^\*+\.\*+$/;
|
|
1434
|
-
var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
|
|
1435
|
-
var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
|
|
1436
|
-
var dotStarRE = /^\.\*+$/;
|
|
1437
|
-
var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
|
|
1438
|
-
var starRE = /^\*+$/;
|
|
1439
|
-
var starTest = (f) => f.length !== 0 && !f.startsWith(".");
|
|
1440
|
-
var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
|
|
1441
|
-
var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
1442
|
-
var qmarksTestNocase = ([$0, ext2 = ""]) => {
|
|
1443
|
-
const noext = qmarksTestNoExt([$0]);
|
|
1444
|
-
if (!ext2)
|
|
1445
|
-
return noext;
|
|
1446
|
-
ext2 = ext2.toLowerCase();
|
|
1447
|
-
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
1448
|
-
};
|
|
1449
|
-
var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
|
|
1450
|
-
const noext = qmarksTestNoExtDot([$0]);
|
|
1451
|
-
if (!ext2)
|
|
1452
|
-
return noext;
|
|
1453
|
-
ext2 = ext2.toLowerCase();
|
|
1454
|
-
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
1455
|
-
};
|
|
1456
|
-
var qmarksTestDot = ([$0, ext2 = ""]) => {
|
|
1457
|
-
const noext = qmarksTestNoExtDot([$0]);
|
|
1458
|
-
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
1459
|
-
};
|
|
1460
|
-
var qmarksTest = ([$0, ext2 = ""]) => {
|
|
1461
|
-
const noext = qmarksTestNoExt([$0]);
|
|
1462
|
-
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
1463
|
-
};
|
|
1464
|
-
var qmarksTestNoExt = ([$0]) => {
|
|
1465
|
-
const len = $0.length;
|
|
1466
|
-
return (f) => f.length === len && !f.startsWith(".");
|
|
1467
|
-
};
|
|
1468
|
-
var qmarksTestNoExtDot = ([$0]) => {
|
|
1469
|
-
const len = $0.length;
|
|
1470
|
-
return (f) => f.length === len && f !== "." && f !== "..";
|
|
1471
|
-
};
|
|
1472
|
-
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
1473
|
-
var path2 = {
|
|
1474
|
-
win32: { sep: "\\" },
|
|
1475
|
-
posix: { sep: "/" }
|
|
1476
|
-
};
|
|
1477
|
-
var sep = defaultPlatform === "win32" ? path2.win32.sep : path2.posix.sep;
|
|
1478
|
-
minimatch.sep = sep;
|
|
1479
|
-
var GLOBSTAR = Symbol("globstar **");
|
|
1480
|
-
minimatch.GLOBSTAR = GLOBSTAR;
|
|
1481
|
-
var qmark2 = "[^/]";
|
|
1482
|
-
var star2 = qmark2 + "*?";
|
|
1483
|
-
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
1484
|
-
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
1485
|
-
var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
|
|
1486
|
-
minimatch.filter = filter;
|
|
1487
|
-
var ext = (a, b = {}) => Object.assign({}, a, b);
|
|
1488
|
-
var defaults = (def) => {
|
|
1489
|
-
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
1490
|
-
return minimatch;
|
|
1491
|
-
}
|
|
1492
|
-
const orig = minimatch;
|
|
1493
|
-
const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
|
|
1494
|
-
return Object.assign(m, {
|
|
1495
|
-
Minimatch: class Minimatch extends orig.Minimatch {
|
|
1496
|
-
constructor(pattern, options = {}) {
|
|
1497
|
-
super(pattern, ext(def, options));
|
|
1498
|
-
}
|
|
1499
|
-
static defaults(options) {
|
|
1500
|
-
return orig.defaults(ext(def, options)).Minimatch;
|
|
1501
|
-
}
|
|
1502
|
-
},
|
|
1503
|
-
AST: class AST extends orig.AST {
|
|
1504
|
-
/* c8 ignore start */
|
|
1505
|
-
constructor(type, parent, options = {}) {
|
|
1506
|
-
super(type, parent, ext(def, options));
|
|
1507
|
-
}
|
|
1508
|
-
/* c8 ignore stop */
|
|
1509
|
-
static fromGlob(pattern, options = {}) {
|
|
1510
|
-
return orig.AST.fromGlob(pattern, ext(def, options));
|
|
1511
|
-
}
|
|
1512
|
-
},
|
|
1513
|
-
unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
|
|
1514
|
-
escape: (s, options = {}) => orig.escape(s, ext(def, options)),
|
|
1515
|
-
filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
|
|
1516
|
-
defaults: (options) => orig.defaults(ext(def, options)),
|
|
1517
|
-
makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
|
|
1518
|
-
braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
|
|
1519
|
-
match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
|
|
1520
|
-
sep: orig.sep,
|
|
1521
|
-
GLOBSTAR
|
|
1522
|
-
});
|
|
1523
|
-
};
|
|
1524
|
-
minimatch.defaults = defaults;
|
|
1525
|
-
var braceExpand = (pattern, options = {}) => {
|
|
1526
|
-
assertValidPattern(pattern);
|
|
1527
|
-
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
1528
|
-
return [pattern];
|
|
1529
|
-
}
|
|
1530
|
-
return (0, import_brace_expansion.default)(pattern);
|
|
1531
|
-
};
|
|
1532
|
-
minimatch.braceExpand = braceExpand;
|
|
1533
|
-
var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
1534
|
-
minimatch.makeRe = makeRe;
|
|
1535
|
-
var match = (list, pattern, options = {}) => {
|
|
1536
|
-
const mm = new Minimatch(pattern, options);
|
|
1537
|
-
list = list.filter((f) => mm.match(f));
|
|
1538
|
-
if (mm.options.nonull && !list.length) {
|
|
1539
|
-
list.push(pattern);
|
|
1540
|
-
}
|
|
1541
|
-
return list;
|
|
1542
|
-
};
|
|
1543
|
-
minimatch.match = match;
|
|
1544
|
-
var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
1545
|
-
var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
1546
|
-
var Minimatch = class {
|
|
1547
|
-
options;
|
|
1548
|
-
set;
|
|
1549
|
-
pattern;
|
|
1550
|
-
windowsPathsNoEscape;
|
|
1551
|
-
nonegate;
|
|
1552
|
-
negate;
|
|
1553
|
-
comment;
|
|
1554
|
-
empty;
|
|
1555
|
-
preserveMultipleSlashes;
|
|
1556
|
-
partial;
|
|
1557
|
-
globSet;
|
|
1558
|
-
globParts;
|
|
1559
|
-
nocase;
|
|
1560
|
-
isWindows;
|
|
1561
|
-
platform;
|
|
1562
|
-
windowsNoMagicRoot;
|
|
1563
|
-
regexp;
|
|
1564
|
-
constructor(pattern, options = {}) {
|
|
1565
|
-
assertValidPattern(pattern);
|
|
1566
|
-
options = options || {};
|
|
1567
|
-
this.options = options;
|
|
1568
|
-
this.pattern = pattern;
|
|
1569
|
-
this.platform = options.platform || defaultPlatform;
|
|
1570
|
-
this.isWindows = this.platform === "win32";
|
|
1571
|
-
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
|
|
1572
|
-
if (this.windowsPathsNoEscape) {
|
|
1573
|
-
this.pattern = this.pattern.replace(/\\/g, "/");
|
|
1574
|
-
}
|
|
1575
|
-
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
1576
|
-
this.regexp = null;
|
|
1577
|
-
this.negate = false;
|
|
1578
|
-
this.nonegate = !!options.nonegate;
|
|
1579
|
-
this.comment = false;
|
|
1580
|
-
this.empty = false;
|
|
1581
|
-
this.partial = !!options.partial;
|
|
1582
|
-
this.nocase = !!this.options.nocase;
|
|
1583
|
-
this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
|
|
1584
|
-
this.globSet = [];
|
|
1585
|
-
this.globParts = [];
|
|
1586
|
-
this.set = [];
|
|
1587
|
-
this.make();
|
|
1588
|
-
}
|
|
1589
|
-
hasMagic() {
|
|
1590
|
-
if (this.options.magicalBraces && this.set.length > 1) {
|
|
1591
|
-
return true;
|
|
1592
|
-
}
|
|
1593
|
-
for (const pattern of this.set) {
|
|
1594
|
-
for (const part of pattern) {
|
|
1595
|
-
if (typeof part !== "string")
|
|
1596
|
-
return true;
|
|
1597
|
-
}
|
|
1598
|
-
}
|
|
1599
|
-
return false;
|
|
1600
|
-
}
|
|
1601
|
-
debug(..._) {
|
|
1602
|
-
}
|
|
1603
|
-
make() {
|
|
1604
|
-
const pattern = this.pattern;
|
|
1605
|
-
const options = this.options;
|
|
1606
|
-
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
1607
|
-
this.comment = true;
|
|
1608
|
-
return;
|
|
1609
|
-
}
|
|
1610
|
-
if (!pattern) {
|
|
1611
|
-
this.empty = true;
|
|
1612
|
-
return;
|
|
1613
|
-
}
|
|
1614
|
-
this.parseNegate();
|
|
1615
|
-
this.globSet = [...new Set(this.braceExpand())];
|
|
1616
|
-
if (options.debug) {
|
|
1617
|
-
this.debug = (...args) => console.error(...args);
|
|
1618
|
-
}
|
|
1619
|
-
this.debug(this.pattern, this.globSet);
|
|
1620
|
-
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
1621
|
-
this.globParts = this.preprocess(rawGlobParts);
|
|
1622
|
-
this.debug(this.pattern, this.globParts);
|
|
1623
|
-
let set = this.globParts.map((s, _, __) => {
|
|
1624
|
-
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
1625
|
-
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
1626
|
-
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
1627
|
-
if (isUNC) {
|
|
1628
|
-
return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
|
|
1629
|
-
} else if (isDrive) {
|
|
1630
|
-
return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
return s.map((ss) => this.parse(ss));
|
|
1634
|
-
});
|
|
1635
|
-
this.debug(this.pattern, set);
|
|
1636
|
-
this.set = set.filter((s) => s.indexOf(false) === -1);
|
|
1637
|
-
if (this.isWindows) {
|
|
1638
|
-
for (let i = 0; i < this.set.length; i++) {
|
|
1639
|
-
const p = this.set[i];
|
|
1640
|
-
if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
|
|
1641
|
-
p[2] = "?";
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
this.debug(this.pattern, this.set);
|
|
1646
|
-
}
|
|
1647
|
-
// various transforms to equivalent pattern sets that are
|
|
1648
|
-
// faster to process in a filesystem walk. The goal is to
|
|
1649
|
-
// eliminate what we can, and push all ** patterns as far
|
|
1650
|
-
// to the right as possible, even if it increases the number
|
|
1651
|
-
// of patterns that we have to process.
|
|
1652
|
-
preprocess(globParts) {
|
|
1653
|
-
if (this.options.noglobstar) {
|
|
1654
|
-
for (let i = 0; i < globParts.length; i++) {
|
|
1655
|
-
for (let j = 0; j < globParts[i].length; j++) {
|
|
1656
|
-
if (globParts[i][j] === "**") {
|
|
1657
|
-
globParts[i][j] = "*";
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
|
-
const { optimizationLevel = 1 } = this.options;
|
|
1663
|
-
if (optimizationLevel >= 2) {
|
|
1664
|
-
globParts = this.firstPhasePreProcess(globParts);
|
|
1665
|
-
globParts = this.secondPhasePreProcess(globParts);
|
|
1666
|
-
} else if (optimizationLevel >= 1) {
|
|
1667
|
-
globParts = this.levelOneOptimize(globParts);
|
|
1668
|
-
} else {
|
|
1669
|
-
globParts = this.adjascentGlobstarOptimize(globParts);
|
|
1670
|
-
}
|
|
1671
|
-
return globParts;
|
|
1672
|
-
}
|
|
1673
|
-
// just get rid of adjascent ** portions
|
|
1674
|
-
adjascentGlobstarOptimize(globParts) {
|
|
1675
|
-
return globParts.map((parts) => {
|
|
1676
|
-
let gs = -1;
|
|
1677
|
-
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
1678
|
-
let i = gs;
|
|
1679
|
-
while (parts[i + 1] === "**") {
|
|
1680
|
-
i++;
|
|
1681
|
-
}
|
|
1682
|
-
if (i !== gs) {
|
|
1683
|
-
parts.splice(gs, i - gs);
|
|
1684
|
-
}
|
|
1685
|
-
}
|
|
1686
|
-
return parts;
|
|
1687
|
-
});
|
|
1688
|
-
}
|
|
1689
|
-
// get rid of adjascent ** and resolve .. portions
|
|
1690
|
-
levelOneOptimize(globParts) {
|
|
1691
|
-
return globParts.map((parts) => {
|
|
1692
|
-
parts = parts.reduce((set, part) => {
|
|
1693
|
-
const prev = set[set.length - 1];
|
|
1694
|
-
if (part === "**" && prev === "**") {
|
|
1695
|
-
return set;
|
|
1696
|
-
}
|
|
1697
|
-
if (part === "..") {
|
|
1698
|
-
if (prev && prev !== ".." && prev !== "." && prev !== "**") {
|
|
1699
|
-
set.pop();
|
|
1700
|
-
return set;
|
|
1701
|
-
}
|
|
1702
|
-
}
|
|
1703
|
-
set.push(part);
|
|
1704
|
-
return set;
|
|
1705
|
-
}, []);
|
|
1706
|
-
return parts.length === 0 ? [""] : parts;
|
|
1707
|
-
});
|
|
1708
|
-
}
|
|
1709
|
-
levelTwoFileOptimize(parts) {
|
|
1710
|
-
if (!Array.isArray(parts)) {
|
|
1711
|
-
parts = this.slashSplit(parts);
|
|
1712
|
-
}
|
|
1713
|
-
let didSomething = false;
|
|
1714
|
-
do {
|
|
1715
|
-
didSomething = false;
|
|
1716
|
-
if (!this.preserveMultipleSlashes) {
|
|
1717
|
-
for (let i = 1; i < parts.length - 1; i++) {
|
|
1718
|
-
const p = parts[i];
|
|
1719
|
-
if (i === 1 && p === "" && parts[0] === "")
|
|
1720
|
-
continue;
|
|
1721
|
-
if (p === "." || p === "") {
|
|
1722
|
-
didSomething = true;
|
|
1723
|
-
parts.splice(i, 1);
|
|
1724
|
-
i--;
|
|
1725
|
-
}
|
|
1726
|
-
}
|
|
1727
|
-
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
1728
|
-
didSomething = true;
|
|
1729
|
-
parts.pop();
|
|
1730
|
-
}
|
|
1731
|
-
}
|
|
1732
|
-
let dd = 0;
|
|
1733
|
-
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
1734
|
-
const p = parts[dd - 1];
|
|
1735
|
-
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
1736
|
-
didSomething = true;
|
|
1737
|
-
parts.splice(dd - 1, 2);
|
|
1738
|
-
dd -= 2;
|
|
1739
|
-
}
|
|
1740
|
-
}
|
|
1741
|
-
} while (didSomething);
|
|
1742
|
-
return parts.length === 0 ? [""] : parts;
|
|
1743
|
-
}
|
|
1744
|
-
// First phase: single-pattern processing
|
|
1745
|
-
// <pre> is 1 or more portions
|
|
1746
|
-
// <rest> is 1 or more portions
|
|
1747
|
-
// <p> is any portion other than ., .., '', or **
|
|
1748
|
-
// <e> is . or ''
|
|
1749
|
-
//
|
|
1750
|
-
// **/.. is *brutal* for filesystem walking performance, because
|
|
1751
|
-
// it effectively resets the recursive walk each time it occurs,
|
|
1752
|
-
// and ** cannot be reduced out by a .. pattern part like a regexp
|
|
1753
|
-
// or most strings (other than .., ., and '') can be.
|
|
1754
|
-
//
|
|
1755
|
-
// <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
|
|
1756
|
-
// <pre>/<e>/<rest> -> <pre>/<rest>
|
|
1757
|
-
// <pre>/<p>/../<rest> -> <pre>/<rest>
|
|
1758
|
-
// **/**/<rest> -> **/<rest>
|
|
1759
|
-
//
|
|
1760
|
-
// **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
|
|
1761
|
-
// this WOULD be allowed if ** did follow symlinks, or * didn't
|
|
1762
|
-
firstPhasePreProcess(globParts) {
|
|
1763
|
-
let didSomething = false;
|
|
1764
|
-
do {
|
|
1765
|
-
didSomething = false;
|
|
1766
|
-
for (let parts of globParts) {
|
|
1767
|
-
let gs = -1;
|
|
1768
|
-
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
1769
|
-
let gss = gs;
|
|
1770
|
-
while (parts[gss + 1] === "**") {
|
|
1771
|
-
gss++;
|
|
1772
|
-
}
|
|
1773
|
-
if (gss > gs) {
|
|
1774
|
-
parts.splice(gs + 1, gss - gs);
|
|
1775
|
-
}
|
|
1776
|
-
let next = parts[gs + 1];
|
|
1777
|
-
const p = parts[gs + 2];
|
|
1778
|
-
const p2 = parts[gs + 3];
|
|
1779
|
-
if (next !== "..")
|
|
1780
|
-
continue;
|
|
1781
|
-
if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
|
|
1782
|
-
continue;
|
|
1783
|
-
}
|
|
1784
|
-
didSomething = true;
|
|
1785
|
-
parts.splice(gs, 1);
|
|
1786
|
-
const other = parts.slice(0);
|
|
1787
|
-
other[gs] = "**";
|
|
1788
|
-
globParts.push(other);
|
|
1789
|
-
gs--;
|
|
1790
|
-
}
|
|
1791
|
-
if (!this.preserveMultipleSlashes) {
|
|
1792
|
-
for (let i = 1; i < parts.length - 1; i++) {
|
|
1793
|
-
const p = parts[i];
|
|
1794
|
-
if (i === 1 && p === "" && parts[0] === "")
|
|
1795
|
-
continue;
|
|
1796
|
-
if (p === "." || p === "") {
|
|
1797
|
-
didSomething = true;
|
|
1798
|
-
parts.splice(i, 1);
|
|
1799
|
-
i--;
|
|
1800
|
-
}
|
|
1801
|
-
}
|
|
1802
|
-
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
1803
|
-
didSomething = true;
|
|
1804
|
-
parts.pop();
|
|
1805
|
-
}
|
|
1806
|
-
}
|
|
1807
|
-
let dd = 0;
|
|
1808
|
-
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
1809
|
-
const p = parts[dd - 1];
|
|
1810
|
-
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
1811
|
-
didSomething = true;
|
|
1812
|
-
const needDot = dd === 1 && parts[dd + 1] === "**";
|
|
1813
|
-
const splin = needDot ? ["."] : [];
|
|
1814
|
-
parts.splice(dd - 1, 2, ...splin);
|
|
1815
|
-
if (parts.length === 0)
|
|
1816
|
-
parts.push("");
|
|
1817
|
-
dd -= 2;
|
|
1818
|
-
}
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
} while (didSomething);
|
|
1822
|
-
return globParts;
|
|
1823
|
-
}
|
|
1824
|
-
// second phase: multi-pattern dedupes
|
|
1825
|
-
// {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
|
|
1826
|
-
// {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
|
|
1827
|
-
// {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
|
|
1828
|
-
//
|
|
1829
|
-
// {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
|
|
1830
|
-
// ^-- not valid because ** doens't follow symlinks
|
|
1831
|
-
secondPhasePreProcess(globParts) {
|
|
1832
|
-
for (let i = 0; i < globParts.length - 1; i++) {
|
|
1833
|
-
for (let j = i + 1; j < globParts.length; j++) {
|
|
1834
|
-
const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
|
|
1835
|
-
if (!matched)
|
|
1836
|
-
continue;
|
|
1837
|
-
globParts[i] = matched;
|
|
1838
|
-
globParts[j] = [];
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
return globParts.filter((gs) => gs.length);
|
|
1842
|
-
}
|
|
1843
|
-
partsMatch(a, b, emptyGSMatch = false) {
|
|
1844
|
-
let ai = 0;
|
|
1845
|
-
let bi = 0;
|
|
1846
|
-
let result = [];
|
|
1847
|
-
let which = "";
|
|
1848
|
-
while (ai < a.length && bi < b.length) {
|
|
1849
|
-
if (a[ai] === b[bi]) {
|
|
1850
|
-
result.push(which === "b" ? b[bi] : a[ai]);
|
|
1851
|
-
ai++;
|
|
1852
|
-
bi++;
|
|
1853
|
-
} else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
|
|
1854
|
-
result.push(a[ai]);
|
|
1855
|
-
ai++;
|
|
1856
|
-
} else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
|
|
1857
|
-
result.push(b[bi]);
|
|
1858
|
-
bi++;
|
|
1859
|
-
} else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
|
|
1860
|
-
if (which === "b")
|
|
1861
|
-
return false;
|
|
1862
|
-
which = "a";
|
|
1863
|
-
result.push(a[ai]);
|
|
1864
|
-
ai++;
|
|
1865
|
-
bi++;
|
|
1866
|
-
} else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
|
|
1867
|
-
if (which === "a")
|
|
1868
|
-
return false;
|
|
1869
|
-
which = "b";
|
|
1870
|
-
result.push(b[bi]);
|
|
1871
|
-
ai++;
|
|
1872
|
-
bi++;
|
|
1873
|
-
} else {
|
|
1874
|
-
return false;
|
|
1875
|
-
}
|
|
1876
|
-
}
|
|
1877
|
-
return a.length === b.length && result;
|
|
1878
|
-
}
|
|
1879
|
-
parseNegate() {
|
|
1880
|
-
if (this.nonegate)
|
|
1881
|
-
return;
|
|
1882
|
-
const pattern = this.pattern;
|
|
1883
|
-
let negate = false;
|
|
1884
|
-
let negateOffset = 0;
|
|
1885
|
-
for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
|
|
1886
|
-
negate = !negate;
|
|
1887
|
-
negateOffset++;
|
|
1888
|
-
}
|
|
1889
|
-
if (negateOffset)
|
|
1890
|
-
this.pattern = pattern.slice(negateOffset);
|
|
1891
|
-
this.negate = negate;
|
|
1892
|
-
}
|
|
1893
|
-
// set partial to true to test if, for example,
|
|
1894
|
-
// "/a/b" matches the start of "/*/b/*/d"
|
|
1895
|
-
// Partial means, if you run out of file before you run
|
|
1896
|
-
// out of pattern, then that's fine, as long as all
|
|
1897
|
-
// the parts match.
|
|
1898
|
-
matchOne(file, pattern, partial = false) {
|
|
1899
|
-
const options = this.options;
|
|
1900
|
-
if (this.isWindows) {
|
|
1901
|
-
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
1902
|
-
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
1903
|
-
const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
|
|
1904
|
-
const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
|
|
1905
|
-
const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
|
|
1906
|
-
const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
|
|
1907
|
-
if (typeof fdi === "number" && typeof pdi === "number") {
|
|
1908
|
-
const [fd, pd] = [file[fdi], pattern[pdi]];
|
|
1909
|
-
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
1910
|
-
pattern[pdi] = fd;
|
|
1911
|
-
if (pdi > fdi) {
|
|
1912
|
-
pattern = pattern.slice(pdi);
|
|
1913
|
-
} else if (fdi > pdi) {
|
|
1914
|
-
file = file.slice(fdi);
|
|
1915
|
-
}
|
|
1916
|
-
}
|
|
1917
|
-
}
|
|
1918
|
-
}
|
|
1919
|
-
const { optimizationLevel = 1 } = this.options;
|
|
1920
|
-
if (optimizationLevel >= 2) {
|
|
1921
|
-
file = this.levelTwoFileOptimize(file);
|
|
1922
|
-
}
|
|
1923
|
-
this.debug("matchOne", this, { file, pattern });
|
|
1924
|
-
this.debug("matchOne", file.length, pattern.length);
|
|
1925
|
-
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
1926
|
-
this.debug("matchOne loop");
|
|
1927
|
-
var p = pattern[pi];
|
|
1928
|
-
var f = file[fi];
|
|
1929
|
-
this.debug(pattern, p, f);
|
|
1930
|
-
if (p === false) {
|
|
1931
|
-
return false;
|
|
1932
|
-
}
|
|
1933
|
-
if (p === GLOBSTAR) {
|
|
1934
|
-
this.debug("GLOBSTAR", [pattern, p, f]);
|
|
1935
|
-
var fr = fi;
|
|
1936
|
-
var pr = pi + 1;
|
|
1937
|
-
if (pr === pl) {
|
|
1938
|
-
this.debug("** at the end");
|
|
1939
|
-
for (; fi < fl; fi++) {
|
|
1940
|
-
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
|
1941
|
-
return false;
|
|
1942
|
-
}
|
|
1943
|
-
return true;
|
|
1944
|
-
}
|
|
1945
|
-
while (fr < fl) {
|
|
1946
|
-
var swallowee = file[fr];
|
|
1947
|
-
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
|
1948
|
-
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
1949
|
-
this.debug("globstar found match!", fr, fl, swallowee);
|
|
1950
|
-
return true;
|
|
1951
|
-
} else {
|
|
1952
|
-
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
|
1953
|
-
this.debug("dot detected!", file, fr, pattern, pr);
|
|
1954
|
-
break;
|
|
1955
|
-
}
|
|
1956
|
-
this.debug("globstar swallow a segment, and continue");
|
|
1957
|
-
fr++;
|
|
1958
|
-
}
|
|
1959
|
-
}
|
|
1960
|
-
if (partial) {
|
|
1961
|
-
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
|
1962
|
-
if (fr === fl) {
|
|
1963
|
-
return true;
|
|
1964
|
-
}
|
|
1965
|
-
}
|
|
1966
|
-
return false;
|
|
1967
|
-
}
|
|
1968
|
-
let hit;
|
|
1969
|
-
if (typeof p === "string") {
|
|
1970
|
-
hit = f === p;
|
|
1971
|
-
this.debug("string match", p, f, hit);
|
|
1972
|
-
} else {
|
|
1973
|
-
hit = p.test(f);
|
|
1974
|
-
this.debug("pattern match", p, f, hit);
|
|
1975
|
-
}
|
|
1976
|
-
if (!hit)
|
|
1977
|
-
return false;
|
|
1978
|
-
}
|
|
1979
|
-
if (fi === fl && pi === pl) {
|
|
1980
|
-
return true;
|
|
1981
|
-
} else if (fi === fl) {
|
|
1982
|
-
return partial;
|
|
1983
|
-
} else if (pi === pl) {
|
|
1984
|
-
return fi === fl - 1 && file[fi] === "";
|
|
1985
|
-
} else {
|
|
1986
|
-
throw new Error("wtf?");
|
|
1987
|
-
}
|
|
1988
|
-
}
|
|
1989
|
-
braceExpand() {
|
|
1990
|
-
return braceExpand(this.pattern, this.options);
|
|
1991
|
-
}
|
|
1992
|
-
parse(pattern) {
|
|
1993
|
-
assertValidPattern(pattern);
|
|
1994
|
-
const options = this.options;
|
|
1995
|
-
if (pattern === "**")
|
|
1996
|
-
return GLOBSTAR;
|
|
1997
|
-
if (pattern === "")
|
|
1998
|
-
return "";
|
|
1999
|
-
let m;
|
|
2000
|
-
let fastTest = null;
|
|
2001
|
-
if (m = pattern.match(starRE)) {
|
|
2002
|
-
fastTest = options.dot ? starTestDot : starTest;
|
|
2003
|
-
} else if (m = pattern.match(starDotExtRE)) {
|
|
2004
|
-
fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
|
|
2005
|
-
} else if (m = pattern.match(qmarksRE)) {
|
|
2006
|
-
fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
|
|
2007
|
-
} else if (m = pattern.match(starDotStarRE)) {
|
|
2008
|
-
fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
|
|
2009
|
-
} else if (m = pattern.match(dotStarRE)) {
|
|
2010
|
-
fastTest = dotStarTest;
|
|
2011
|
-
}
|
|
2012
|
-
const re = AST.fromGlob(pattern, this.options).toMMPattern();
|
|
2013
|
-
if (fastTest && typeof re === "object") {
|
|
2014
|
-
Reflect.defineProperty(re, "test", { value: fastTest });
|
|
2015
|
-
}
|
|
2016
|
-
return re;
|
|
2017
|
-
}
|
|
2018
|
-
makeRe() {
|
|
2019
|
-
if (this.regexp || this.regexp === false)
|
|
2020
|
-
return this.regexp;
|
|
2021
|
-
const set = this.set;
|
|
2022
|
-
if (!set.length) {
|
|
2023
|
-
this.regexp = false;
|
|
2024
|
-
return this.regexp;
|
|
2025
|
-
}
|
|
2026
|
-
const options = this.options;
|
|
2027
|
-
const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
|
|
2028
|
-
const flags = new Set(options.nocase ? ["i"] : []);
|
|
2029
|
-
let re = set.map((pattern) => {
|
|
2030
|
-
const pp = pattern.map((p) => {
|
|
2031
|
-
if (p instanceof RegExp) {
|
|
2032
|
-
for (const f of p.flags.split(""))
|
|
2033
|
-
flags.add(f);
|
|
2034
|
-
}
|
|
2035
|
-
return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
|
|
2036
|
-
});
|
|
2037
|
-
pp.forEach((p, i) => {
|
|
2038
|
-
const next = pp[i + 1];
|
|
2039
|
-
const prev = pp[i - 1];
|
|
2040
|
-
if (p !== GLOBSTAR || prev === GLOBSTAR) {
|
|
2041
|
-
return;
|
|
2042
|
-
}
|
|
2043
|
-
if (prev === void 0) {
|
|
2044
|
-
if (next !== void 0 && next !== GLOBSTAR) {
|
|
2045
|
-
pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
|
|
2046
|
-
} else {
|
|
2047
|
-
pp[i] = twoStar;
|
|
2048
|
-
}
|
|
2049
|
-
} else if (next === void 0) {
|
|
2050
|
-
pp[i - 1] = prev + "(?:\\/|" + twoStar + ")?";
|
|
2051
|
-
} else if (next !== GLOBSTAR) {
|
|
2052
|
-
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
2053
|
-
pp[i + 1] = GLOBSTAR;
|
|
2054
|
-
}
|
|
2055
|
-
});
|
|
2056
|
-
return pp.filter((p) => p !== GLOBSTAR).join("/");
|
|
2057
|
-
}).join("|");
|
|
2058
|
-
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
2059
|
-
re = "^" + open + re + close + "$";
|
|
2060
|
-
if (this.negate)
|
|
2061
|
-
re = "^(?!" + re + ").+$";
|
|
2062
|
-
try {
|
|
2063
|
-
this.regexp = new RegExp(re, [...flags].join(""));
|
|
2064
|
-
} catch (ex) {
|
|
2065
|
-
this.regexp = false;
|
|
2066
|
-
}
|
|
2067
|
-
return this.regexp;
|
|
2068
|
-
}
|
|
2069
|
-
slashSplit(p) {
|
|
2070
|
-
if (this.preserveMultipleSlashes) {
|
|
2071
|
-
return p.split("/");
|
|
2072
|
-
} else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
|
|
2073
|
-
return ["", ...p.split(/\/+/)];
|
|
2074
|
-
} else {
|
|
2075
|
-
return p.split(/\/+/);
|
|
2076
|
-
}
|
|
2077
|
-
}
|
|
2078
|
-
match(f, partial = this.partial) {
|
|
2079
|
-
this.debug("match", f, this.pattern);
|
|
2080
|
-
if (this.comment) {
|
|
2081
|
-
return false;
|
|
2082
|
-
}
|
|
2083
|
-
if (this.empty) {
|
|
2084
|
-
return f === "";
|
|
2085
|
-
}
|
|
2086
|
-
if (f === "/" && partial) {
|
|
2087
|
-
return true;
|
|
2088
|
-
}
|
|
2089
|
-
const options = this.options;
|
|
2090
|
-
if (this.isWindows) {
|
|
2091
|
-
f = f.split("\\").join("/");
|
|
2092
|
-
}
|
|
2093
|
-
const ff = this.slashSplit(f);
|
|
2094
|
-
this.debug(this.pattern, "split", ff);
|
|
2095
|
-
const set = this.set;
|
|
2096
|
-
this.debug(this.pattern, "set", set);
|
|
2097
|
-
let filename = ff[ff.length - 1];
|
|
2098
|
-
if (!filename) {
|
|
2099
|
-
for (let i = ff.length - 2; !filename && i >= 0; i--) {
|
|
2100
|
-
filename = ff[i];
|
|
2101
|
-
}
|
|
2102
|
-
}
|
|
2103
|
-
for (let i = 0; i < set.length; i++) {
|
|
2104
|
-
const pattern = set[i];
|
|
2105
|
-
let file = ff;
|
|
2106
|
-
if (options.matchBase && pattern.length === 1) {
|
|
2107
|
-
file = [filename];
|
|
2108
|
-
}
|
|
2109
|
-
const hit = this.matchOne(file, pattern, partial);
|
|
2110
|
-
if (hit) {
|
|
2111
|
-
if (options.flipNegate) {
|
|
2112
|
-
return true;
|
|
2113
|
-
}
|
|
2114
|
-
return !this.negate;
|
|
2115
|
-
}
|
|
2116
|
-
}
|
|
2117
|
-
if (options.flipNegate) {
|
|
2118
|
-
return false;
|
|
2119
|
-
}
|
|
2120
|
-
return this.negate;
|
|
2121
|
-
}
|
|
2122
|
-
static defaults(def) {
|
|
2123
|
-
return minimatch.defaults(def).Minimatch;
|
|
2124
|
-
}
|
|
2125
|
-
};
|
|
2126
|
-
minimatch.AST = AST;
|
|
2127
|
-
minimatch.Minimatch = Minimatch;
|
|
2128
|
-
minimatch.escape = escape;
|
|
2129
|
-
minimatch.unescape = unescape;
|
|
2130
|
-
|
|
2131
|
-
// src/utils/result.ts
|
|
2132
|
-
var result_exports = {};
|
|
2133
|
-
__export(result_exports, {
|
|
2134
|
-
err: () => err,
|
|
2135
|
-
map: () => map,
|
|
2136
|
-
ok: () => ok,
|
|
2137
|
-
unwrap: () => unwrap,
|
|
2138
|
-
unwrapErr: () => unwrapErr
|
|
2139
|
-
});
|
|
2140
|
-
var ok = (value) => ({
|
|
2141
|
-
isOk: true,
|
|
2142
|
-
isErr: false,
|
|
2143
|
-
value
|
|
2144
|
-
});
|
|
2145
|
-
var err = (value) => ({
|
|
2146
|
-
isOk: false,
|
|
2147
|
-
isErr: true,
|
|
2148
|
-
value
|
|
2149
|
-
});
|
|
2150
|
-
function map(result, fn) {
|
|
2151
|
-
if (result.isOk) {
|
|
2152
|
-
const val = fn(result.value);
|
|
2153
|
-
if (val instanceof Promise) {
|
|
2154
|
-
return val.then((newVal) => ok(newVal));
|
|
2155
|
-
} else {
|
|
2156
|
-
return ok(val);
|
|
2157
|
-
}
|
|
2158
|
-
}
|
|
2159
|
-
if (result.isErr) {
|
|
2160
|
-
const value = result.value;
|
|
2161
|
-
return err(value);
|
|
2162
|
-
}
|
|
2163
|
-
throw "should never get here";
|
|
2164
|
-
}
|
|
2165
|
-
var unwrap = (result) => {
|
|
2166
|
-
if (result.isOk) {
|
|
2167
|
-
return result.value;
|
|
2168
|
-
} else {
|
|
2169
|
-
throw result.value;
|
|
2170
|
-
}
|
|
2171
|
-
};
|
|
2172
|
-
var unwrapErr = (result) => {
|
|
2173
|
-
if (result.isErr) {
|
|
2174
|
-
return result.value;
|
|
2175
|
-
} else {
|
|
2176
|
-
throw result.value;
|
|
2177
|
-
}
|
|
2178
|
-
};
|
|
2179
|
-
|
|
2180
|
-
// src/app-data/index.ts
|
|
2181
|
-
var BUILD = {
|
|
2182
|
-
allRenderFn: false,
|
|
2183
|
-
element: true,
|
|
2184
|
-
event: true,
|
|
2185
|
-
hasRenderFn: true,
|
|
2186
|
-
hostListener: true,
|
|
2187
|
-
hostListenerTargetWindow: true,
|
|
2188
|
-
hostListenerTargetDocument: true,
|
|
2189
|
-
hostListenerTargetBody: true,
|
|
2190
|
-
hostListenerTargetParent: false,
|
|
2191
|
-
hostListenerTarget: true,
|
|
2192
|
-
member: true,
|
|
2193
|
-
method: true,
|
|
2194
|
-
mode: true,
|
|
2195
|
-
observeAttribute: true,
|
|
2196
|
-
prop: true,
|
|
2197
|
-
propMutable: true,
|
|
2198
|
-
reflect: true,
|
|
2199
|
-
scoped: true,
|
|
2200
|
-
shadowDom: true,
|
|
2201
|
-
slot: true,
|
|
2202
|
-
cssAnnotations: true,
|
|
2203
|
-
state: true,
|
|
2204
|
-
style: true,
|
|
2205
|
-
formAssociated: false,
|
|
2206
|
-
svg: true,
|
|
2207
|
-
updatable: true,
|
|
2208
|
-
vdomAttribute: true,
|
|
2209
|
-
vdomXlink: true,
|
|
2210
|
-
vdomClass: true,
|
|
2211
|
-
vdomFunctional: true,
|
|
2212
|
-
vdomKey: true,
|
|
2213
|
-
vdomListener: true,
|
|
2214
|
-
vdomRef: true,
|
|
2215
|
-
vdomPropOrAttr: true,
|
|
2216
|
-
vdomRender: true,
|
|
2217
|
-
vdomStyle: true,
|
|
2218
|
-
vdomText: true,
|
|
2219
|
-
propChangeCallback: true,
|
|
2220
|
-
taskQueue: true,
|
|
2221
|
-
hotModuleReplacement: false,
|
|
2222
|
-
isDebug: false,
|
|
2223
|
-
isDev: false,
|
|
2224
|
-
isTesting: false,
|
|
2225
|
-
hydrateServerSide: false,
|
|
2226
|
-
hydrateClientSide: false,
|
|
2227
|
-
lifecycleDOMEvents: false,
|
|
2228
|
-
lazyLoad: false,
|
|
2229
|
-
profile: false,
|
|
2230
|
-
slotRelocation: true,
|
|
2231
|
-
// TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
|
|
2232
|
-
appendChildSlotFix: false,
|
|
2233
|
-
// TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
|
|
2234
|
-
cloneNodeFix: false,
|
|
2235
|
-
hydratedAttribute: false,
|
|
2236
|
-
hydratedClass: true,
|
|
2237
|
-
// TODO(STENCIL-1305): remove this option
|
|
2238
|
-
scriptDataOpts: false,
|
|
2239
|
-
// TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
|
|
2240
|
-
scopedSlotTextContentFix: false,
|
|
2241
|
-
// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
|
|
2242
|
-
shadowDomShim: false,
|
|
2243
|
-
// TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
|
|
2244
|
-
slotChildNodesFix: false,
|
|
2245
|
-
invisiblePrehydration: true,
|
|
2246
|
-
propBoolean: true,
|
|
2247
|
-
propNumber: true,
|
|
2248
|
-
propString: true,
|
|
2249
|
-
constructableCSS: true,
|
|
2250
|
-
devTools: false,
|
|
2251
|
-
shadowDelegatesFocus: true,
|
|
2252
|
-
shadowSlotAssignmentManual: false,
|
|
2253
|
-
initializeNextTick: false,
|
|
2254
|
-
asyncLoading: true,
|
|
2255
|
-
asyncQueue: false,
|
|
2256
|
-
// TODO: deprecated in favour of `setTagTransformer` and `transformTag`. Remove in 5.0
|
|
2257
|
-
transformTagName: false,
|
|
2258
|
-
attachStyles: true,
|
|
2259
|
-
// TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
|
|
2260
|
-
experimentalSlotFixes: false
|
|
2261
|
-
};
|
|
2262
|
-
|
|
2263
|
-
// src/client/client-build.ts
|
|
2264
|
-
var Build = {
|
|
2265
|
-
isDev: BUILD.isDev ? true : false,
|
|
2266
|
-
isBrowser: true,
|
|
2267
|
-
isServer: false,
|
|
2268
|
-
isTesting: BUILD.isTesting ? true : false
|
|
2269
|
-
};
|
|
2270
|
-
|
|
2271
|
-
// src/client/client-log.ts
|
|
2272
|
-
var STENCIL_DEV_MODE = BUILD.isTesting ? ["STENCIL:"] : [
|
|
2273
|
-
"%cstencil",
|
|
2274
|
-
"color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"
|
|
2275
|
-
];
|
|
2276
|
-
|
|
2277
|
-
// src/client/client-window.ts
|
|
2278
|
-
var win = typeof window !== "undefined" ? window : {};
|
|
2279
|
-
var H = win.HTMLElement || class {
|
|
2280
|
-
};
|
|
2281
|
-
var supportsShadow = BUILD.shadowDom;
|
|
2282
|
-
var supportsConstructableStylesheets = BUILD.constructableCSS ? /* @__PURE__ */ (() => {
|
|
2283
|
-
try {
|
|
2284
|
-
if (!win.document.adoptedStyleSheets) {
|
|
2285
|
-
return false;
|
|
2286
|
-
}
|
|
2287
|
-
new CSSStyleSheet();
|
|
2288
|
-
return typeof new CSSStyleSheet().replaceSync === "function";
|
|
2289
|
-
} catch (e) {
|
|
2290
|
-
}
|
|
2291
|
-
return false;
|
|
2292
|
-
})() : false;
|
|
2293
|
-
|
|
2294
|
-
// src/utils/shadow-css.ts
|
|
2295
|
-
/**
|
|
2296
|
-
* @license
|
|
2297
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
2298
|
-
*
|
|
2299
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
2300
|
-
* found in the LICENSE file at https://angular.io/license
|
|
2301
|
-
*
|
|
2302
|
-
* This file is a port of shadowCSS from `webcomponents.js` to TypeScript.
|
|
2303
|
-
* https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
|
|
2304
|
-
* https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
|
|
2305
|
-
*/
|
|
2306
|
-
var _polyfillHost = "-shadowcsshost";
|
|
2307
|
-
var _polyfillSlotted = "-shadowcssslotted";
|
|
2308
|
-
var _polyfillHostContext = "-shadowcsscontext";
|
|
2309
|
-
var _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
|
|
2310
|
-
var _cssColonHostRe = new RegExp("(" + _polyfillHost + _parenSuffix, "gim");
|
|
2311
|
-
var _cssColonHostContextRe = new RegExp("(" + _polyfillHostContext + _parenSuffix, "gim");
|
|
2312
|
-
var _cssColonSlottedRe = new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim");
|
|
2313
|
-
var _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
|
|
2314
|
-
|
|
2315
|
-
// src/runtime/vdom/set-accessor.ts
|
|
2316
|
-
var CAPTURE_EVENT_SUFFIX = "Capture";
|
|
2317
|
-
var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
|
|
2318
|
-
|
|
2319
|
-
// src/runtime/mixin.ts
|
|
2320
|
-
var baseClass = BUILD.lazyLoad ? class {
|
|
2321
|
-
} : globalThis.HTMLElement || class {
|
|
2322
|
-
};
|
|
2323
|
-
|
|
2324
|
-
// src/utils/util.ts
|
|
2325
|
-
var lowerPathParam = (fn) => (p) => fn(p.toLowerCase());
|
|
2326
|
-
var isDtsFile = lowerPathParam((p) => p.endsWith(".d.ts") || p.endsWith(".d.mts") || p.endsWith(".d.cts"));
|
|
2327
|
-
var isTsFile = lowerPathParam(
|
|
2328
|
-
(p) => !isDtsFile(p) && (p.endsWith(".ts") || p.endsWith(".mts") || p.endsWith(".cts"))
|
|
2329
|
-
);
|
|
2330
|
-
var isTsxFile = lowerPathParam(
|
|
2331
|
-
(p) => p.endsWith(".tsx") || p.endsWith(".mtsx") || p.endsWith(".ctsx")
|
|
2332
|
-
);
|
|
2333
|
-
var isJsxFile = lowerPathParam(
|
|
2334
|
-
(p) => p.endsWith(".jsx") || p.endsWith(".mjsx") || p.endsWith(".cjsx")
|
|
2335
|
-
);
|
|
2336
|
-
var isJsFile = lowerPathParam((p) => p.endsWith(".js") || p.endsWith(".mjs") || p.endsWith(".cjs"));
|
|
2337
|
-
|
|
2338
|
-
// src/screenshot/connector-local.ts
|
|
2339
|
-
var import_path4 = require("path");
|
|
2340
|
-
var ScreenshotLocalConnector = class extends ScreenshotConnector {
|
|
2341
|
-
async publishBuild(results) {
|
|
2342
|
-
if (this.updateMaster || !results.masterBuild) {
|
|
2343
|
-
results.masterBuild = {
|
|
2344
|
-
id: "master",
|
|
2345
|
-
message: "Master",
|
|
2346
|
-
appNamespace: this.appNamespace,
|
|
2347
|
-
timestamp: Date.now(),
|
|
2348
|
-
screenshots: []
|
|
2349
|
-
};
|
|
2350
|
-
}
|
|
2351
|
-
results.currentBuild.screenshots.forEach((currentScreenshot) => {
|
|
2352
|
-
const masterHasScreenshot = results.masterBuild.screenshots.some((masterScreenshot) => {
|
|
2353
|
-
return currentScreenshot.id === masterScreenshot.id;
|
|
2354
|
-
});
|
|
2355
|
-
if (!masterHasScreenshot) {
|
|
2356
|
-
results.masterBuild.screenshots.push(Object.assign({}, currentScreenshot));
|
|
2357
|
-
}
|
|
2358
|
-
});
|
|
2359
|
-
this.sortScreenshots(results.masterBuild.screenshots);
|
|
2360
|
-
await writeFile(this.masterBuildFilePath, JSON.stringify(results.masterBuild, null, 2));
|
|
2361
|
-
await this.generateJsonpDataUris(results.currentBuild);
|
|
2362
|
-
const compareAppSourceDir = (0, import_path4.join)(this.packageDir, "screenshot", "compare");
|
|
2363
|
-
const appSrcUrl = normalizePath((0, import_path4.relative)(this.screenshotDir, compareAppSourceDir));
|
|
2364
|
-
const imagesUrl = normalizePath((0, import_path4.relative)(this.screenshotDir, this.imagesDir));
|
|
2365
|
-
const jsonpUrl = normalizePath((0, import_path4.relative)(this.screenshotDir, this.cacheDir));
|
|
2366
|
-
const compareAppHtml = createLocalCompareApp(
|
|
2367
|
-
this.appNamespace,
|
|
2368
|
-
appSrcUrl,
|
|
2369
|
-
imagesUrl,
|
|
2370
|
-
jsonpUrl,
|
|
2371
|
-
results.masterBuild,
|
|
2372
|
-
results.currentBuild
|
|
2373
|
-
);
|
|
2374
|
-
const compareAppFileName = "compare.html";
|
|
2375
|
-
const compareAppFilePath = (0, import_path4.join)(this.screenshotDir, compareAppFileName);
|
|
2376
|
-
await writeFile(compareAppFilePath, compareAppHtml);
|
|
2377
|
-
const gitIgnorePath = (0, import_path4.join)(this.screenshotDir, ".gitignore");
|
|
2378
|
-
const gitIgnoreExists = await fileExists(gitIgnorePath);
|
|
2379
|
-
if (!gitIgnoreExists) {
|
|
2380
|
-
const content = [this.imagesDirName, this.buildsDirName, compareAppFileName];
|
|
2381
|
-
await writeFile(gitIgnorePath, content.join("\n"));
|
|
2382
|
-
}
|
|
2383
|
-
const url = new URL(`file://${compareAppFilePath}`);
|
|
2384
|
-
results.compare.url = url.href;
|
|
2385
|
-
return results;
|
|
2386
|
-
}
|
|
2387
|
-
async getScreenshotCache() {
|
|
2388
|
-
let screenshotCache = null;
|
|
2389
|
-
try {
|
|
2390
|
-
screenshotCache = JSON.parse(await readFile(this.screenshotCacheFilePath));
|
|
2391
|
-
} catch (e) {
|
|
2392
|
-
}
|
|
2393
|
-
return screenshotCache;
|
|
2394
|
-
}
|
|
2395
|
-
async updateScreenshotCache(cache, buildResults) {
|
|
2396
|
-
cache = await super.updateScreenshotCache(cache, buildResults);
|
|
2397
|
-
await writeFile(this.screenshotCacheFilePath, JSON.stringify(cache, null, 2));
|
|
2398
|
-
return cache;
|
|
2399
|
-
}
|
|
2400
|
-
};
|
|
2401
|
-
function createLocalCompareApp(namespace, appSrcUrl, imagesUrl, jsonpUrl, a, b) {
|
|
2402
|
-
return `<!doctype html>
|
|
2403
|
-
<html dir="ltr" lang="en">
|
|
2404
|
-
<head>
|
|
2405
|
-
<meta charset="utf-8">
|
|
2406
|
-
<title>Local ${namespace || ""} - Stencil Screenshot Visual Diff</title>
|
|
2407
|
-
<meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
2408
|
-
<meta http-equiv="x-ua-compatible" content="IE=Edge">
|
|
2409
|
-
<link href="${appSrcUrl}/build/app.css" rel="stylesheet">
|
|
2410
|
-
<script type="module" src="${appSrcUrl}/build/app.esm.js"></script>
|
|
2411
|
-
<script nomodule src="${appSrcUrl}/build/app.js"></script>
|
|
2412
|
-
<link rel="icon" type="image/x-icon" href="${appSrcUrl}/assets/favicon.ico">
|
|
2413
|
-
</head>
|
|
2414
|
-
<body>
|
|
2415
|
-
<script>
|
|
2416
|
-
(function() {
|
|
2417
|
-
var app = document.createElement('screenshot-compare');
|
|
2418
|
-
app.appSrcUrl = '${appSrcUrl}';
|
|
2419
|
-
app.imagesUrl = '${imagesUrl}/';
|
|
2420
|
-
app.jsonpUrl = '${jsonpUrl}/';
|
|
2421
|
-
app.a = ${JSON.stringify(a)};
|
|
2422
|
-
app.b = ${JSON.stringify(b)};
|
|
2423
|
-
document.body.appendChild(app);
|
|
2424
|
-
})();
|
|
2425
|
-
</script>
|
|
2426
|
-
</body>
|
|
2427
|
-
</html>`;
|
|
2428
|
-
}
|
|
2429
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
2430
|
-
0 && (module.exports = {
|
|
2431
|
-
ScreenshotConnector,
|
|
2432
|
-
ScreenshotLocalConnector
|
|
2433
|
-
});
|