immosquare-cleaner 0.1.65 → 0.1.67
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.
- checksums.yaml +4 -4
- data/bin/immosquare-cleaner +4 -0
- data/lib/immosquare-cleaner/version.rb +1 -1
- data/lib/immosquare-cleaner.rb +21 -20
- data/linters/eslint.config.mjs +14 -0
- data/linters/rubocop-3.3.6.yml +93 -0
- data/linters/rubocop-3.4.1.yml +0 -3
- data/node_modules/.bin/jscodeshift +1 -0
- data/node_modules/@babel/compat-data/data/plugins.json +7 -6
- data/node_modules/@babel/compat-data/package.json +2 -2
- data/node_modules/@babel/core/lib/config/files/configuration.js +0 -3
- data/node_modules/@babel/core/lib/config/files/configuration.js.map +1 -1
- data/node_modules/@babel/core/lib/config/files/module-types.js +63 -74
- data/node_modules/@babel/core/lib/config/files/module-types.js.map +1 -1
- data/node_modules/@babel/core/lib/config/files/plugins.js +0 -1
- data/node_modules/@babel/core/lib/config/files/plugins.js.map +1 -1
- data/node_modules/@babel/core/lib/config/partial.js +1 -1
- data/node_modules/@babel/core/lib/config/partial.js.map +1 -1
- data/node_modules/@babel/core/lib/index.js +2 -1
- data/node_modules/@babel/core/lib/index.js.map +1 -1
- data/node_modules/@babel/core/lib/parser/index.js.map +1 -1
- data/node_modules/@babel/core/lib/transformation/file/babel-7-helpers.cjs +1 -3
- data/node_modules/@babel/core/lib/transformation/file/babel-7-helpers.cjs.map +1 -1
- data/node_modules/@babel/core/lib/transformation/file/file.js +4 -2
- data/node_modules/@babel/core/lib/transformation/file/file.js.map +1 -1
- data/node_modules/@babel/core/lib/transformation/normalize-file.js.map +1 -1
- data/node_modules/@babel/core/lib/transformation/util/clone-deep.js +7 -27
- data/node_modules/@babel/core/lib/transformation/util/clone-deep.js.map +1 -1
- data/node_modules/@babel/core/package.json +14 -13
- data/node_modules/@babel/generator/lib/generators/classes.js +4 -7
- data/node_modules/@babel/generator/lib/generators/classes.js.map +1 -1
- data/node_modules/@babel/generator/lib/generators/expressions.js +3 -9
- data/node_modules/@babel/generator/lib/generators/expressions.js.map +1 -1
- data/node_modules/@babel/generator/lib/generators/jsx.js +1 -6
- data/node_modules/@babel/generator/lib/generators/jsx.js.map +1 -1
- data/node_modules/@babel/generator/lib/generators/template-literals.js +11 -16
- data/node_modules/@babel/generator/lib/generators/template-literals.js.map +1 -1
- data/node_modules/@babel/generator/lib/generators/types.js +9 -0
- data/node_modules/@babel/generator/lib/generators/types.js.map +1 -1
- data/node_modules/@babel/generator/lib/generators/typescript.js +18 -36
- data/node_modules/@babel/generator/lib/generators/typescript.js.map +1 -1
- data/node_modules/@babel/generator/lib/node/parentheses.js +3 -40
- data/node_modules/@babel/generator/lib/node/parentheses.js.map +1 -1
- data/node_modules/@babel/generator/lib/printer.js +3 -4
- data/node_modules/@babel/generator/lib/printer.js.map +1 -1
- data/node_modules/@babel/generator/package.json +5 -5
- data/node_modules/@babel/helper-compilation-targets/lib/index.js +1 -1
- data/node_modules/@babel/helper-compilation-targets/lib/index.js.map +1 -1
- data/node_modules/@babel/helper-compilation-targets/package.json +2 -2
- data/node_modules/@babel/helper-create-class-features-plugin/lib/decorators-2018-09.js +9 -1
- data/node_modules/@babel/helper-create-class-features-plugin/lib/decorators-2018-09.js.map +1 -1
- data/node_modules/@babel/helper-create-class-features-plugin/lib/decorators.js +0 -9
- data/node_modules/@babel/helper-create-class-features-plugin/lib/decorators.js.map +1 -1
- data/node_modules/@babel/helper-create-class-features-plugin/lib/features.js +1 -1
- data/node_modules/@babel/helper-create-class-features-plugin/lib/features.js.map +1 -1
- data/node_modules/@babel/helper-create-class-features-plugin/lib/index.js +8 -8
- data/node_modules/@babel/helper-create-class-features-plugin/lib/index.js.map +1 -1
- data/node_modules/@babel/helper-create-class-features-plugin/package.json +5 -5
- data/node_modules/@babel/helper-plugin-utils/lib/index.js.map +1 -1
- data/node_modules/@babel/helper-plugin-utils/package.json +2 -2
- data/node_modules/@babel/helper-replace-supers/lib/index.js.map +1 -1
- data/node_modules/@babel/helper-replace-supers/package.json +3 -3
- data/node_modules/@babel/helpers/lib/helpers/asyncIterator.js.map +1 -1
- data/node_modules/@babel/helpers/lib/helpers/isNativeFunction.js.map +1 -1
- data/node_modules/@babel/helpers/lib/helpers/objectWithoutProperties.js +1 -1
- data/node_modules/@babel/helpers/lib/helpers/objectWithoutProperties.js.map +1 -1
- data/node_modules/@babel/helpers/lib/helpers/objectWithoutPropertiesLoose.js +1 -1
- data/node_modules/@babel/helpers/lib/helpers/objectWithoutPropertiesLoose.js.map +1 -1
- data/node_modules/@babel/helpers/lib/helpers/wrapRegExp.js +3 -7
- data/node_modules/@babel/helpers/lib/helpers/wrapRegExp.js.map +1 -1
- data/node_modules/@babel/helpers/lib/helpers-generated.js +3 -3
- data/node_modules/@babel/helpers/lib/helpers-generated.js.map +1 -1
- data/node_modules/@babel/helpers/package.json +5 -5
- data/node_modules/@babel/parser/lib/index.js +236 -426
- data/node_modules/@babel/parser/lib/index.js.map +1 -1
- data/node_modules/@babel/parser/package.json +2 -2
- data/node_modules/@babel/parser/typings/babel-parser.d.ts +164 -127
- data/node_modules/@babel/plugin-transform-flow-strip-types/lib/index.js +0 -6
- data/node_modules/@babel/plugin-transform-flow-strip-types/lib/index.js.map +1 -1
- data/node_modules/@babel/plugin-transform-flow-strip-types/package.json +4 -4
- data/node_modules/@babel/plugin-transform-nullish-coalescing-operator/lib/index.js +2 -3
- data/node_modules/@babel/plugin-transform-nullish-coalescing-operator/lib/index.js.map +1 -1
- data/node_modules/@babel/plugin-transform-nullish-coalescing-operator/package.json +3 -3
- data/node_modules/@babel/plugin-transform-typescript/lib/const-enum.js +1 -3
- data/node_modules/@babel/plugin-transform-typescript/lib/const-enum.js.map +1 -1
- data/node_modules/@babel/plugin-transform-typescript/lib/enum.js +11 -24
- data/node_modules/@babel/plugin-transform-typescript/lib/enum.js.map +1 -1
- data/node_modules/@babel/plugin-transform-typescript/lib/index.js +9 -38
- data/node_modules/@babel/plugin-transform-typescript/lib/index.js.map +1 -1
- data/node_modules/@babel/plugin-transform-typescript/lib/namespace.js +0 -2
- data/node_modules/@babel/plugin-transform-typescript/lib/namespace.js.map +1 -1
- data/node_modules/@babel/plugin-transform-typescript/package.json +5 -5
- data/node_modules/@babel/template/lib/options.js.map +1 -1
- data/node_modules/@babel/template/lib/parse.js.map +1 -1
- data/node_modules/@babel/template/package.json +4 -4
- data/node_modules/@babel/traverse/lib/cache.js +5 -4
- data/node_modules/@babel/traverse/lib/cache.js.map +1 -1
- data/node_modules/@babel/traverse/lib/path/conversion.js +2 -1
- data/node_modules/@babel/traverse/lib/path/conversion.js.map +1 -1
- data/node_modules/@babel/traverse/lib/path/evaluation.js +0 -17
- data/node_modules/@babel/traverse/lib/path/evaluation.js.map +1 -1
- data/node_modules/@babel/traverse/lib/path/lib/hoister.js.map +1 -1
- data/node_modules/@babel/traverse/lib/path/modification.js +1 -1
- data/node_modules/@babel/traverse/lib/path/modification.js.map +1 -1
- data/node_modules/@babel/traverse/lib/path/replacement.js.map +1 -1
- data/node_modules/@babel/traverse/lib/scope/index.js +2 -9
- data/node_modules/@babel/traverse/lib/scope/index.js.map +1 -1
- data/node_modules/@babel/traverse/lib/visitors.js +1 -1
- data/node_modules/@babel/traverse/lib/visitors.js.map +1 -1
- data/node_modules/@babel/traverse/package.json +6 -6
- data/node_modules/@babel/types/lib/asserts/generated/index.js +0 -8
- data/node_modules/@babel/types/lib/asserts/generated/index.js.map +1 -1
- data/node_modules/@babel/types/lib/ast-types/generated/index.js.map +1 -1
- data/node_modules/@babel/types/lib/builders/generated/index.js +2858 -22
- data/node_modules/@babel/types/lib/builders/generated/index.js.map +1 -1
- data/node_modules/@babel/types/lib/builders/generated/uppercase.js +255 -267
- data/node_modules/@babel/types/lib/builders/generated/uppercase.js.map +1 -1
- data/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js.map +1 -1
- data/node_modules/@babel/types/lib/converters/toSequenceExpression.js.map +1 -1
- data/node_modules/@babel/types/lib/definitions/core.js +17 -26
- data/node_modules/@babel/types/lib/definitions/core.js.map +1 -1
- data/node_modules/@babel/types/lib/definitions/flow.js +3 -6
- data/node_modules/@babel/types/lib/definitions/flow.js.map +1 -1
- data/node_modules/@babel/types/lib/definitions/jsx.js +4 -9
- data/node_modules/@babel/types/lib/definitions/jsx.js.map +1 -1
- data/node_modules/@babel/types/lib/definitions/typescript.js +26 -51
- data/node_modules/@babel/types/lib/definitions/typescript.js.map +1 -1
- data/node_modules/@babel/types/lib/definitions/utils.js +2 -2
- data/node_modules/@babel/types/lib/definitions/utils.js.map +1 -1
- data/node_modules/@babel/types/lib/index-legacy.d.ts +7 -27
- data/node_modules/@babel/types/lib/index.d.ts +1876 -1898
- data/node_modules/@babel/types/lib/index.js +21 -10
- data/node_modules/@babel/types/lib/index.js.flow +6 -26
- data/node_modules/@babel/types/lib/index.js.map +1 -1
- data/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js +8 -9
- data/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js.map +1 -1
- data/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js +0 -1
- data/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js.map +1 -1
- data/node_modules/@babel/types/lib/validators/generated/index.js +0 -17
- data/node_modules/@babel/types/lib/validators/generated/index.js.map +1 -1
- data/node_modules/@babel/types/package.json +12 -12
- data/node_modules/@eslint-community/eslint-utils/index.js +1 -21
- data/node_modules/@eslint-community/eslint-utils/index.js.map +1 -1
- data/node_modules/@eslint-community/eslint-utils/index.mjs +1 -21
- data/node_modules/@eslint-community/eslint-utils/index.mjs.map +1 -1
- data/node_modules/@eslint-community/eslint-utils/package.json +1 -1
- data/node_modules/acorn/CHANGELOG.md +0 -12
- data/node_modules/acorn/dist/acorn.js +24 -33
- data/node_modules/acorn/dist/acorn.mjs +24 -33
- data/node_modules/acorn/package.json +1 -1
- data/node_modules/browserslist/index.js +4 -23
- data/node_modules/browserslist/node.js +60 -69
- data/node_modules/browserslist/package.json +1 -1
- data/node_modules/call-bind-apply-helpers/CHANGELOG.md +0 -7
- data/node_modules/call-bind-apply-helpers/index.d.ts +20 -38
- data/node_modules/call-bind-apply-helpers/index.js +1 -1
- data/node_modules/call-bind-apply-helpers/package.json +8 -8
- data/node_modules/call-bind-apply-helpers/test/index.js +4 -4
- data/node_modules/call-bound/CHANGELOG.md +0 -8
- data/node_modules/call-bound/index.d.ts +10 -91
- data/node_modules/call-bound/index.js +3 -4
- data/node_modules/call-bound/package.json +10 -10
- data/node_modules/call-bound/test/index.js +4 -11
- data/node_modules/call-bound/tsconfig.json +1 -2
- data/node_modules/caniuse-lite/data/agents.js +1 -1
- data/node_modules/caniuse-lite/data/browserVersions.js +1 -1
- data/node_modules/caniuse-lite/data/features/aac.js +1 -1
- data/node_modules/caniuse-lite/data/features/abortcontroller.js +1 -1
- data/node_modules/caniuse-lite/data/features/ac3-ec3.js +1 -1
- data/node_modules/caniuse-lite/data/features/accelerometer.js +1 -1
- data/node_modules/caniuse-lite/data/features/addeventlistener.js +1 -1
- data/node_modules/caniuse-lite/data/features/alternate-stylesheet.js +1 -1
- data/node_modules/caniuse-lite/data/features/ambient-light.js +1 -1
- data/node_modules/caniuse-lite/data/features/apng.js +1 -1
- data/node_modules/caniuse-lite/data/features/array-find-index.js +1 -1
- data/node_modules/caniuse-lite/data/features/array-find.js +1 -1
- data/node_modules/caniuse-lite/data/features/array-flat.js +1 -1
- data/node_modules/caniuse-lite/data/features/array-includes.js +1 -1
- data/node_modules/caniuse-lite/data/features/arrow-functions.js +1 -1
- data/node_modules/caniuse-lite/data/features/asmjs.js +1 -1
- data/node_modules/caniuse-lite/data/features/async-clipboard.js +1 -1
- data/node_modules/caniuse-lite/data/features/async-functions.js +1 -1
- data/node_modules/caniuse-lite/data/features/atob-btoa.js +1 -1
- data/node_modules/caniuse-lite/data/features/audio-api.js +1 -1
- data/node_modules/caniuse-lite/data/features/audio.js +1 -1
- data/node_modules/caniuse-lite/data/features/audiotracks.js +1 -1
- data/node_modules/caniuse-lite/data/features/autofocus.js +1 -1
- data/node_modules/caniuse-lite/data/features/auxclick.js +1 -1
- data/node_modules/caniuse-lite/data/features/av1.js +1 -1
- data/node_modules/caniuse-lite/data/features/avif.js +1 -1
- data/node_modules/caniuse-lite/data/features/background-attachment.js +1 -1
- data/node_modules/caniuse-lite/data/features/background-clip-text.js +1 -1
- data/node_modules/caniuse-lite/data/features/background-img-opts.js +1 -1
- data/node_modules/caniuse-lite/data/features/background-position-x-y.js +1 -1
- data/node_modules/caniuse-lite/data/features/background-repeat-round-space.js +1 -1
- data/node_modules/caniuse-lite/data/features/background-sync.js +1 -1
- data/node_modules/caniuse-lite/data/features/battery-status.js +1 -1
- data/node_modules/caniuse-lite/data/features/beacon.js +1 -1
- data/node_modules/caniuse-lite/data/features/beforeafterprint.js +1 -1
- data/node_modules/caniuse-lite/data/features/bigint.js +1 -1
- data/node_modules/caniuse-lite/data/features/blobbuilder.js +1 -1
- data/node_modules/caniuse-lite/data/features/bloburls.js +1 -1
- data/node_modules/caniuse-lite/data/features/border-image.js +1 -1
- data/node_modules/caniuse-lite/data/features/border-radius.js +1 -1
- data/node_modules/caniuse-lite/data/features/broadcastchannel.js +1 -1
- data/node_modules/caniuse-lite/data/features/brotli.js +1 -1
- data/node_modules/caniuse-lite/data/features/calc.js +1 -1
- data/node_modules/caniuse-lite/data/features/canvas-blending.js +1 -1
- data/node_modules/caniuse-lite/data/features/canvas-text.js +1 -1
- data/node_modules/caniuse-lite/data/features/canvas.js +1 -1
- data/node_modules/caniuse-lite/data/features/ch-unit.js +1 -1
- data/node_modules/caniuse-lite/data/features/chacha20-poly1305.js +1 -1
- data/node_modules/caniuse-lite/data/features/channel-messaging.js +1 -1
- data/node_modules/caniuse-lite/data/features/childnode-remove.js +1 -1
- data/node_modules/caniuse-lite/data/features/classlist.js +1 -1
- data/node_modules/caniuse-lite/data/features/client-hints-dpr-width-viewport.js +1 -1
- data/node_modules/caniuse-lite/data/features/clipboard.js +1 -1
- data/node_modules/caniuse-lite/data/features/colr-v1.js +1 -1
- data/node_modules/caniuse-lite/data/features/colr.js +1 -1
- data/node_modules/caniuse-lite/data/features/comparedocumentposition.js +1 -1
- data/node_modules/caniuse-lite/data/features/console-basic.js +1 -1
- data/node_modules/caniuse-lite/data/features/console-time.js +1 -1
- data/node_modules/caniuse-lite/data/features/const.js +1 -1
- data/node_modules/caniuse-lite/data/features/constraint-validation.js +1 -1
- data/node_modules/caniuse-lite/data/features/contenteditable.js +1 -1
- data/node_modules/caniuse-lite/data/features/contentsecuritypolicy.js +1 -1
- data/node_modules/caniuse-lite/data/features/contentsecuritypolicy2.js +1 -1
- data/node_modules/caniuse-lite/data/features/cookie-store-api.js +1 -1
- data/node_modules/caniuse-lite/data/features/cors.js +1 -1
- data/node_modules/caniuse-lite/data/features/createimagebitmap.js +1 -1
- data/node_modules/caniuse-lite/data/features/credential-management.js +1 -1
- data/node_modules/caniuse-lite/data/features/cryptography.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-all.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-anchor-positioning.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-animation.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-any-link.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-appearance.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-at-counter-style.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-autofill.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-backdrop-filter.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-background-offsets.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-backgroundblendmode.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-boxdecorationbreak.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-boxshadow.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-canvas.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-caret-color.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-cascade-layers.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-cascade-scope.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-case-insensitive.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-clip-path.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-color-adjust.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-color-function.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-conic-gradients.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-container-queries-style.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-container-queries.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-container-query-units.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-containment.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-content-visibility.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-counters.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-crisp-edges.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-cross-fade.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-default-pseudo.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-descendant-gtgt.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-deviceadaptation.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-dir-pseudo.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-display-contents.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-element-function.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-env-function.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-exclusions.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-featurequeries.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-file-selector-button.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-filter-function.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-filters.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-first-letter.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-first-line.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-fixed.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-focus-visible.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-focus-within.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-font-palette.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-font-rendering-controls.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-font-stretch.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-gencontent.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-gradients.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-grid-animation.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-grid.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-hanging-punctuation.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-has.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-hyphens.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-image-orientation.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-image-set.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-in-out-of-range.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-indeterminate-pseudo.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-initial-letter.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-initial-value.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-lch-lab.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-letter-spacing.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-line-clamp.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-logical-props.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-marker-pseudo.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-masks.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-matches-pseudo.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-math-functions.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-media-interaction.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-media-range-syntax.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-media-resolution.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-media-scripting.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-mediaqueries.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-mixblendmode.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-module-scripts.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-motion-paths.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-namespaces.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-nesting.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-not-sel-list.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-nth-child-of.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-opacity.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-optional-pseudo.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-overflow-anchor.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-overflow-overlay.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-overflow.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-overscroll-behavior.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-page-break.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-paged-media.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-paint-api.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-placeholder-shown.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-placeholder.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-print-color-adjust.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-read-only-write.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-rebeccapurple.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-reflections.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-regions.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-relative-colors.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-repeating-gradients.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-resize.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-revert-value.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-rrggbbaa.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-scroll-behavior.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-scrollbar.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-sel2.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-sel3.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-selection.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-shapes.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-snappoints.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-sticky.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-subgrid.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-supports-api.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-table.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-text-align-last.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-text-box-trim.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-text-indent.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-text-justify.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-text-orientation.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-text-spacing.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-text-wrap-balance.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-textshadow.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-touch-action.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-transitions.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-unicode-bidi.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-unset-value.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-variables.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-when-else.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-widows-orphans.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-width-stretch.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-writing-mode.js +1 -1
- data/node_modules/caniuse-lite/data/features/css-zoom.js +1 -1
- data/node_modules/caniuse-lite/data/features/css3-attr.js +1 -1
- data/node_modules/caniuse-lite/data/features/css3-boxsizing.js +1 -1
- data/node_modules/caniuse-lite/data/features/css3-colors.js +1 -1
- data/node_modules/caniuse-lite/data/features/css3-cursors-grab.js +1 -1
- data/node_modules/caniuse-lite/data/features/css3-cursors-newer.js +1 -1
- data/node_modules/caniuse-lite/data/features/css3-cursors.js +1 -1
- data/node_modules/caniuse-lite/data/features/css3-tabsize.js +1 -1
- data/node_modules/caniuse-lite/data/features/currentcolor.js +1 -1
- data/node_modules/caniuse-lite/data/features/custom-elements.js +1 -1
- data/node_modules/caniuse-lite/data/features/custom-elementsv1.js +1 -1
- data/node_modules/caniuse-lite/data/features/customevent.js +1 -1
- data/node_modules/caniuse-lite/data/features/datalist.js +1 -1
- data/node_modules/caniuse-lite/data/features/dataset.js +1 -1
- data/node_modules/caniuse-lite/data/features/datauri.js +1 -1
- data/node_modules/caniuse-lite/data/features/date-tolocaledatestring.js +1 -1
- data/node_modules/caniuse-lite/data/features/declarative-shadow-dom.js +1 -1
- data/node_modules/caniuse-lite/data/features/decorators.js +1 -1
- data/node_modules/caniuse-lite/data/features/details.js +1 -1
- data/node_modules/caniuse-lite/data/features/deviceorientation.js +1 -1
- data/node_modules/caniuse-lite/data/features/devicepixelratio.js +1 -1
- data/node_modules/caniuse-lite/data/features/dialog.js +1 -1
- data/node_modules/caniuse-lite/data/features/dispatchevent.js +1 -1
- data/node_modules/caniuse-lite/data/features/dnssec.js +1 -1
- data/node_modules/caniuse-lite/data/features/do-not-track.js +1 -1
- data/node_modules/caniuse-lite/data/features/document-currentscript.js +1 -1
- data/node_modules/caniuse-lite/data/features/document-evaluate-xpath.js +1 -1
- data/node_modules/caniuse-lite/data/features/document-execcommand.js +1 -1
- data/node_modules/caniuse-lite/data/features/document-policy.js +1 -1
- data/node_modules/caniuse-lite/data/features/document-scrollingelement.js +1 -1
- data/node_modules/caniuse-lite/data/features/documenthead.js +1 -1
- data/node_modules/caniuse-lite/data/features/dom-manip-convenience.js +1 -1
- data/node_modules/caniuse-lite/data/features/dom-range.js +1 -1
- data/node_modules/caniuse-lite/data/features/domcontentloaded.js +1 -1
- data/node_modules/caniuse-lite/data/features/dommatrix.js +1 -1
- data/node_modules/caniuse-lite/data/features/download.js +1 -1
- data/node_modules/caniuse-lite/data/features/dragndrop.js +1 -1
- data/node_modules/caniuse-lite/data/features/element-closest.js +1 -1
- data/node_modules/caniuse-lite/data/features/element-from-point.js +1 -1
- data/node_modules/caniuse-lite/data/features/element-scroll-methods.js +1 -1
- data/node_modules/caniuse-lite/data/features/eme.js +1 -1
- data/node_modules/caniuse-lite/data/features/eot.js +1 -1
- data/node_modules/caniuse-lite/data/features/es5.js +1 -1
- data/node_modules/caniuse-lite/data/features/es6-class.js +1 -1
- data/node_modules/caniuse-lite/data/features/es6-generators.js +1 -1
- data/node_modules/caniuse-lite/data/features/es6-module-dynamic-import.js +1 -1
- data/node_modules/caniuse-lite/data/features/es6-module.js +1 -1
- data/node_modules/caniuse-lite/data/features/es6-number.js +1 -1
- data/node_modules/caniuse-lite/data/features/es6-string-includes.js +1 -1
- data/node_modules/caniuse-lite/data/features/es6.js +1 -1
- data/node_modules/caniuse-lite/data/features/eventsource.js +1 -1
- data/node_modules/caniuse-lite/data/features/extended-system-fonts.js +1 -1
- data/node_modules/caniuse-lite/data/features/feature-policy.js +1 -1
- data/node_modules/caniuse-lite/data/features/fetch.js +1 -1
- data/node_modules/caniuse-lite/data/features/fieldset-disabled.js +1 -1
- data/node_modules/caniuse-lite/data/features/fileapi.js +1 -1
- data/node_modules/caniuse-lite/data/features/filereader.js +1 -1
- data/node_modules/caniuse-lite/data/features/filereadersync.js +1 -1
- data/node_modules/caniuse-lite/data/features/filesystem.js +1 -1
- data/node_modules/caniuse-lite/data/features/flac.js +1 -1
- data/node_modules/caniuse-lite/data/features/flexbox-gap.js +1 -1
- data/node_modules/caniuse-lite/data/features/flexbox.js +1 -1
- data/node_modules/caniuse-lite/data/features/flow-root.js +1 -1
- data/node_modules/caniuse-lite/data/features/focusin-focusout-events.js +1 -1
- data/node_modules/caniuse-lite/data/features/font-family-system-ui.js +1 -1
- data/node_modules/caniuse-lite/data/features/font-feature.js +1 -1
- data/node_modules/caniuse-lite/data/features/font-kerning.js +1 -1
- data/node_modules/caniuse-lite/data/features/font-loading.js +1 -1
- data/node_modules/caniuse-lite/data/features/font-size-adjust.js +1 -1
- data/node_modules/caniuse-lite/data/features/font-smooth.js +1 -1
- data/node_modules/caniuse-lite/data/features/font-unicode-range.js +1 -1
- data/node_modules/caniuse-lite/data/features/font-variant-alternates.js +1 -1
- data/node_modules/caniuse-lite/data/features/font-variant-numeric.js +1 -1
- data/node_modules/caniuse-lite/data/features/fontface.js +1 -1
- data/node_modules/caniuse-lite/data/features/form-attribute.js +1 -1
- data/node_modules/caniuse-lite/data/features/form-submit-attributes.js +1 -1
- data/node_modules/caniuse-lite/data/features/form-validation.js +1 -1
- data/node_modules/caniuse-lite/data/features/forms.js +1 -1
- data/node_modules/caniuse-lite/data/features/fullscreen.js +1 -1
- data/node_modules/caniuse-lite/data/features/gamepad.js +1 -1
- data/node_modules/caniuse-lite/data/features/geolocation.js +1 -1
- data/node_modules/caniuse-lite/data/features/getboundingclientrect.js +1 -1
- data/node_modules/caniuse-lite/data/features/getcomputedstyle.js +1 -1
- data/node_modules/caniuse-lite/data/features/getelementsbyclassname.js +1 -1
- data/node_modules/caniuse-lite/data/features/getrandomvalues.js +1 -1
- data/node_modules/caniuse-lite/data/features/gyroscope.js +1 -1
- data/node_modules/caniuse-lite/data/features/hardwareconcurrency.js +1 -1
- data/node_modules/caniuse-lite/data/features/hashchange.js +1 -1
- data/node_modules/caniuse-lite/data/features/heif.js +1 -1
- data/node_modules/caniuse-lite/data/features/hevc.js +1 -1
- data/node_modules/caniuse-lite/data/features/hidden.js +1 -1
- data/node_modules/caniuse-lite/data/features/high-resolution-time.js +1 -1
- data/node_modules/caniuse-lite/data/features/history.js +1 -1
- data/node_modules/caniuse-lite/data/features/html-media-capture.js +1 -1
- data/node_modules/caniuse-lite/data/features/html5semantic.js +1 -1
- data/node_modules/caniuse-lite/data/features/http-live-streaming.js +1 -1
- data/node_modules/caniuse-lite/data/features/http2.js +1 -1
- data/node_modules/caniuse-lite/data/features/http3.js +1 -1
- data/node_modules/caniuse-lite/data/features/iframe-sandbox.js +1 -1
- data/node_modules/caniuse-lite/data/features/iframe-seamless.js +1 -1
- data/node_modules/caniuse-lite/data/features/iframe-srcdoc.js +1 -1
- data/node_modules/caniuse-lite/data/features/imagecapture.js +1 -1
- data/node_modules/caniuse-lite/data/features/ime.js +1 -1
- data/node_modules/caniuse-lite/data/features/img-naturalwidth-naturalheight.js +1 -1
- data/node_modules/caniuse-lite/data/features/import-maps.js +1 -1
- data/node_modules/caniuse-lite/data/features/imports.js +1 -1
- data/node_modules/caniuse-lite/data/features/indeterminate-checkbox.js +1 -1
- data/node_modules/caniuse-lite/data/features/indexeddb.js +1 -1
- data/node_modules/caniuse-lite/data/features/indexeddb2.js +1 -1
- data/node_modules/caniuse-lite/data/features/inline-block.js +1 -1
- data/node_modules/caniuse-lite/data/features/innertext.js +1 -1
- data/node_modules/caniuse-lite/data/features/input-autocomplete-onoff.js +1 -1
- data/node_modules/caniuse-lite/data/features/input-color.js +1 -1
- data/node_modules/caniuse-lite/data/features/input-datetime.js +1 -1
- data/node_modules/caniuse-lite/data/features/input-email-tel-url.js +1 -1
- data/node_modules/caniuse-lite/data/features/input-event.js +1 -1
- data/node_modules/caniuse-lite/data/features/input-file-accept.js +1 -1
- data/node_modules/caniuse-lite/data/features/input-file-directory.js +1 -1
- data/node_modules/caniuse-lite/data/features/input-file-multiple.js +1 -1
- data/node_modules/caniuse-lite/data/features/input-inputmode.js +1 -1
- data/node_modules/caniuse-lite/data/features/input-minlength.js +1 -1
- data/node_modules/caniuse-lite/data/features/input-number.js +1 -1
- data/node_modules/caniuse-lite/data/features/input-pattern.js +1 -1
- data/node_modules/caniuse-lite/data/features/input-placeholder.js +1 -1
- data/node_modules/caniuse-lite/data/features/input-range.js +1 -1
- data/node_modules/caniuse-lite/data/features/input-search.js +1 -1
- data/node_modules/caniuse-lite/data/features/input-selection.js +1 -1
- data/node_modules/caniuse-lite/data/features/insert-adjacent.js +1 -1
- data/node_modules/caniuse-lite/data/features/insertadjacenthtml.js +1 -1
- data/node_modules/caniuse-lite/data/features/internationalization.js +1 -1
- data/node_modules/caniuse-lite/data/features/intersectionobserver-v2.js +1 -1
- data/node_modules/caniuse-lite/data/features/intersectionobserver.js +1 -1
- data/node_modules/caniuse-lite/data/features/intl-pluralrules.js +1 -1
- data/node_modules/caniuse-lite/data/features/intrinsic-width.js +1 -1
- data/node_modules/caniuse-lite/data/features/jpeg2000.js +1 -1
- data/node_modules/caniuse-lite/data/features/jpegxl.js +1 -1
- data/node_modules/caniuse-lite/data/features/jpegxr.js +1 -1
- data/node_modules/caniuse-lite/data/features/js-regexp-lookbehind.js +1 -1
- data/node_modules/caniuse-lite/data/features/json.js +1 -1
- data/node_modules/caniuse-lite/data/features/justify-content-space-evenly.js +1 -1
- data/node_modules/caniuse-lite/data/features/kerning-pairs-ligatures.js +1 -1
- data/node_modules/caniuse-lite/data/features/keyboardevent-charcode.js +1 -1
- data/node_modules/caniuse-lite/data/features/keyboardevent-code.js +1 -1
- data/node_modules/caniuse-lite/data/features/keyboardevent-getmodifierstate.js +1 -1
- data/node_modules/caniuse-lite/data/features/keyboardevent-key.js +1 -1
- data/node_modules/caniuse-lite/data/features/keyboardevent-location.js +1 -1
- data/node_modules/caniuse-lite/data/features/keyboardevent-which.js +1 -1
- data/node_modules/caniuse-lite/data/features/lazyload.js +1 -1
- data/node_modules/caniuse-lite/data/features/let.js +1 -1
- data/node_modules/caniuse-lite/data/features/link-icon-png.js +1 -1
- data/node_modules/caniuse-lite/data/features/link-icon-svg.js +1 -1
- data/node_modules/caniuse-lite/data/features/link-rel-dns-prefetch.js +1 -1
- data/node_modules/caniuse-lite/data/features/link-rel-modulepreload.js +1 -1
- data/node_modules/caniuse-lite/data/features/link-rel-preconnect.js +1 -1
- data/node_modules/caniuse-lite/data/features/link-rel-prefetch.js +1 -1
- data/node_modules/caniuse-lite/data/features/link-rel-preload.js +1 -1
- data/node_modules/caniuse-lite/data/features/link-rel-prerender.js +1 -1
- data/node_modules/caniuse-lite/data/features/loading-lazy-attr.js +1 -1
- data/node_modules/caniuse-lite/data/features/localecompare.js +1 -1
- data/node_modules/caniuse-lite/data/features/magnetometer.js +1 -1
- data/node_modules/caniuse-lite/data/features/matchesselector.js +1 -1
- data/node_modules/caniuse-lite/data/features/matchmedia.js +1 -1
- data/node_modules/caniuse-lite/data/features/mathml.js +1 -1
- data/node_modules/caniuse-lite/data/features/maxlength.js +1 -1
- data/node_modules/caniuse-lite/data/features/mdn-css-backdrop-pseudo-element.js +1 -1
- data/node_modules/caniuse-lite/data/features/mdn-css-unicode-bidi-isolate-override.js +1 -1
- data/node_modules/caniuse-lite/data/features/mdn-css-unicode-bidi-isolate.js +1 -1
- data/node_modules/caniuse-lite/data/features/mdn-css-unicode-bidi-plaintext.js +1 -1
- data/node_modules/caniuse-lite/data/features/mdn-text-decoration-color.js +1 -1
- data/node_modules/caniuse-lite/data/features/mdn-text-decoration-line.js +1 -1
- data/node_modules/caniuse-lite/data/features/mdn-text-decoration-shorthand.js +1 -1
- data/node_modules/caniuse-lite/data/features/mdn-text-decoration-style.js +1 -1
- data/node_modules/caniuse-lite/data/features/media-fragments.js +1 -1
- data/node_modules/caniuse-lite/data/features/mediacapture-fromelement.js +1 -1
- data/node_modules/caniuse-lite/data/features/mediarecorder.js +1 -1
- data/node_modules/caniuse-lite/data/features/mediasource.js +1 -1
- data/node_modules/caniuse-lite/data/features/menu.js +1 -1
- data/node_modules/caniuse-lite/data/features/meta-theme-color.js +1 -1
- data/node_modules/caniuse-lite/data/features/meter.js +1 -1
- data/node_modules/caniuse-lite/data/features/midi.js +1 -1
- data/node_modules/caniuse-lite/data/features/minmaxwh.js +1 -1
- data/node_modules/caniuse-lite/data/features/mp3.js +1 -1
- data/node_modules/caniuse-lite/data/features/mpeg-dash.js +1 -1
- data/node_modules/caniuse-lite/data/features/mpeg4.js +1 -1
- data/node_modules/caniuse-lite/data/features/multibackgrounds.js +1 -1
- data/node_modules/caniuse-lite/data/features/multicolumn.js +1 -1
- data/node_modules/caniuse-lite/data/features/mutation-events.js +1 -1
- data/node_modules/caniuse-lite/data/features/mutationobserver.js +1 -1
- data/node_modules/caniuse-lite/data/features/namevalue-storage.js +1 -1
- data/node_modules/caniuse-lite/data/features/native-filesystem-api.js +1 -1
- data/node_modules/caniuse-lite/data/features/nav-timing.js +1 -1
- data/node_modules/caniuse-lite/data/features/netinfo.js +1 -1
- data/node_modules/caniuse-lite/data/features/notifications.js +1 -1
- data/node_modules/caniuse-lite/data/features/object-entries.js +1 -1
- data/node_modules/caniuse-lite/data/features/object-fit.js +1 -1
- data/node_modules/caniuse-lite/data/features/object-observe.js +1 -1
- data/node_modules/caniuse-lite/data/features/object-values.js +1 -1
- data/node_modules/caniuse-lite/data/features/objectrtc.js +1 -1
- data/node_modules/caniuse-lite/data/features/offline-apps.js +1 -1
- data/node_modules/caniuse-lite/data/features/offscreencanvas.js +1 -1
- data/node_modules/caniuse-lite/data/features/ogg-vorbis.js +1 -1
- data/node_modules/caniuse-lite/data/features/ogv.js +1 -1
- data/node_modules/caniuse-lite/data/features/ol-reversed.js +1 -1
- data/node_modules/caniuse-lite/data/features/once-event-listener.js +1 -1
- data/node_modules/caniuse-lite/data/features/online-status.js +1 -1
- data/node_modules/caniuse-lite/data/features/opus.js +1 -1
- data/node_modules/caniuse-lite/data/features/orientation-sensor.js +1 -1
- data/node_modules/caniuse-lite/data/features/outline.js +1 -1
- data/node_modules/caniuse-lite/data/features/pad-start-end.js +1 -1
- data/node_modules/caniuse-lite/data/features/page-transition-events.js +1 -1
- data/node_modules/caniuse-lite/data/features/pagevisibility.js +1 -1
- data/node_modules/caniuse-lite/data/features/passive-event-listener.js +1 -1
- data/node_modules/caniuse-lite/data/features/passkeys.js +1 -1
- data/node_modules/caniuse-lite/data/features/passwordrules.js +1 -1
- data/node_modules/caniuse-lite/data/features/path2d.js +1 -1
- data/node_modules/caniuse-lite/data/features/payment-request.js +1 -1
- data/node_modules/caniuse-lite/data/features/pdf-viewer.js +1 -1
- data/node_modules/caniuse-lite/data/features/permissions-api.js +1 -1
- data/node_modules/caniuse-lite/data/features/permissions-policy.js +1 -1
- data/node_modules/caniuse-lite/data/features/picture-in-picture.js +1 -1
- data/node_modules/caniuse-lite/data/features/picture.js +1 -1
- data/node_modules/caniuse-lite/data/features/ping.js +1 -1
- data/node_modules/caniuse-lite/data/features/png-alpha.js +1 -1
- data/node_modules/caniuse-lite/data/features/pointer-events.js +1 -1
- data/node_modules/caniuse-lite/data/features/pointer.js +1 -1
- data/node_modules/caniuse-lite/data/features/pointerlock.js +1 -1
- data/node_modules/caniuse-lite/data/features/portals.js +1 -1
- data/node_modules/caniuse-lite/data/features/prefers-color-scheme.js +1 -1
- data/node_modules/caniuse-lite/data/features/prefers-reduced-motion.js +1 -1
- data/node_modules/caniuse-lite/data/features/progress.js +1 -1
- data/node_modules/caniuse-lite/data/features/promise-finally.js +1 -1
- data/node_modules/caniuse-lite/data/features/promises.js +1 -1
- data/node_modules/caniuse-lite/data/features/proximity.js +1 -1
- data/node_modules/caniuse-lite/data/features/proxy.js +1 -1
- data/node_modules/caniuse-lite/data/features/publickeypinning.js +1 -1
- data/node_modules/caniuse-lite/data/features/push-api.js +1 -1
- data/node_modules/caniuse-lite/data/features/queryselector.js +1 -1
- data/node_modules/caniuse-lite/data/features/readonly-attr.js +1 -1
- data/node_modules/caniuse-lite/data/features/referrer-policy.js +1 -1
- data/node_modules/caniuse-lite/data/features/registerprotocolhandler.js +1 -1
- data/node_modules/caniuse-lite/data/features/rel-noopener.js +1 -1
- data/node_modules/caniuse-lite/data/features/rel-noreferrer.js +1 -1
- data/node_modules/caniuse-lite/data/features/rellist.js +1 -1
- data/node_modules/caniuse-lite/data/features/rem.js +1 -1
- data/node_modules/caniuse-lite/data/features/requestanimationframe.js +1 -1
- data/node_modules/caniuse-lite/data/features/requestidlecallback.js +1 -1
- data/node_modules/caniuse-lite/data/features/resizeobserver.js +1 -1
- data/node_modules/caniuse-lite/data/features/resource-timing.js +1 -1
- data/node_modules/caniuse-lite/data/features/rest-parameters.js +1 -1
- data/node_modules/caniuse-lite/data/features/rtcpeerconnection.js +1 -1
- data/node_modules/caniuse-lite/data/features/ruby.js +1 -1
- data/node_modules/caniuse-lite/data/features/run-in.js +1 -1
- data/node_modules/caniuse-lite/data/features/same-site-cookie-attribute.js +1 -1
- data/node_modules/caniuse-lite/data/features/screen-orientation.js +1 -1
- data/node_modules/caniuse-lite/data/features/script-async.js +1 -1
- data/node_modules/caniuse-lite/data/features/script-defer.js +1 -1
- data/node_modules/caniuse-lite/data/features/scrollintoview.js +1 -1
- data/node_modules/caniuse-lite/data/features/scrollintoviewifneeded.js +1 -1
- data/node_modules/caniuse-lite/data/features/sdch.js +1 -1
- data/node_modules/caniuse-lite/data/features/selection-api.js +1 -1
- data/node_modules/caniuse-lite/data/features/selectlist.js +1 -1
- data/node_modules/caniuse-lite/data/features/server-timing.js +1 -1
- data/node_modules/caniuse-lite/data/features/serviceworkers.js +1 -1
- data/node_modules/caniuse-lite/data/features/setimmediate.js +1 -1
- data/node_modules/caniuse-lite/data/features/shadowdom.js +1 -1
- data/node_modules/caniuse-lite/data/features/shadowdomv1.js +1 -1
- data/node_modules/caniuse-lite/data/features/sharedarraybuffer.js +1 -1
- data/node_modules/caniuse-lite/data/features/sharedworkers.js +1 -1
- data/node_modules/caniuse-lite/data/features/sni.js +1 -1
- data/node_modules/caniuse-lite/data/features/spdy.js +1 -1
- data/node_modules/caniuse-lite/data/features/speech-recognition.js +1 -1
- data/node_modules/caniuse-lite/data/features/speech-synthesis.js +1 -1
- data/node_modules/caniuse-lite/data/features/spellcheck-attribute.js +1 -1
- data/node_modules/caniuse-lite/data/features/sql-storage.js +1 -1
- data/node_modules/caniuse-lite/data/features/srcset.js +1 -1
- data/node_modules/caniuse-lite/data/features/stream.js +1 -1
- data/node_modules/caniuse-lite/data/features/streams.js +1 -1
- data/node_modules/caniuse-lite/data/features/stricttransportsecurity.js +1 -1
- data/node_modules/caniuse-lite/data/features/style-scoped.js +1 -1
- data/node_modules/caniuse-lite/data/features/subresource-bundling.js +1 -1
- data/node_modules/caniuse-lite/data/features/subresource-integrity.js +1 -1
- data/node_modules/caniuse-lite/data/features/svg-css.js +1 -1
- data/node_modules/caniuse-lite/data/features/svg-filters.js +1 -1
- data/node_modules/caniuse-lite/data/features/svg-fonts.js +1 -1
- data/node_modules/caniuse-lite/data/features/svg-fragment.js +1 -1
- data/node_modules/caniuse-lite/data/features/svg-html.js +1 -1
- data/node_modules/caniuse-lite/data/features/svg-html5.js +1 -1
- data/node_modules/caniuse-lite/data/features/svg-img.js +1 -1
- data/node_modules/caniuse-lite/data/features/svg-smil.js +1 -1
- data/node_modules/caniuse-lite/data/features/svg.js +1 -1
- data/node_modules/caniuse-lite/data/features/sxg.js +1 -1
- data/node_modules/caniuse-lite/data/features/tabindex-attr.js +1 -1
- data/node_modules/caniuse-lite/data/features/template-literals.js +1 -1
- data/node_modules/caniuse-lite/data/features/template.js +1 -1
- data/node_modules/caniuse-lite/data/features/temporal.js +1 -1
- data/node_modules/caniuse-lite/data/features/testfeat.js +1 -1
- data/node_modules/caniuse-lite/data/features/text-decoration.js +1 -1
- data/node_modules/caniuse-lite/data/features/text-emphasis.js +1 -1
- data/node_modules/caniuse-lite/data/features/text-overflow.js +1 -1
- data/node_modules/caniuse-lite/data/features/text-size-adjust.js +1 -1
- data/node_modules/caniuse-lite/data/features/text-stroke.js +1 -1
- data/node_modules/caniuse-lite/data/features/textcontent.js +1 -1
- data/node_modules/caniuse-lite/data/features/textencoder.js +1 -1
- data/node_modules/caniuse-lite/data/features/tls1-1.js +1 -1
- data/node_modules/caniuse-lite/data/features/tls1-2.js +1 -1
- data/node_modules/caniuse-lite/data/features/tls1-3.js +1 -1
- data/node_modules/caniuse-lite/data/features/touch.js +1 -1
- data/node_modules/caniuse-lite/data/features/transforms2d.js +1 -1
- data/node_modules/caniuse-lite/data/features/transforms3d.js +1 -1
- data/node_modules/caniuse-lite/data/features/trusted-types.js +1 -1
- data/node_modules/caniuse-lite/data/features/ttf.js +1 -1
- data/node_modules/caniuse-lite/data/features/typedarrays.js +1 -1
- data/node_modules/caniuse-lite/data/features/u2f.js +1 -1
- data/node_modules/caniuse-lite/data/features/unhandledrejection.js +1 -1
- data/node_modules/caniuse-lite/data/features/upgradeinsecurerequests.js +1 -1
- data/node_modules/caniuse-lite/data/features/url-scroll-to-text-fragment.js +1 -1
- data/node_modules/caniuse-lite/data/features/url.js +1 -1
- data/node_modules/caniuse-lite/data/features/urlsearchparams.js +1 -1
- data/node_modules/caniuse-lite/data/features/use-strict.js +1 -1
- data/node_modules/caniuse-lite/data/features/user-select-none.js +1 -1
- data/node_modules/caniuse-lite/data/features/user-timing.js +1 -1
- data/node_modules/caniuse-lite/data/features/variable-fonts.js +1 -1
- data/node_modules/caniuse-lite/data/features/vector-effect.js +1 -1
- data/node_modules/caniuse-lite/data/features/vibration.js +1 -1
- data/node_modules/caniuse-lite/data/features/video.js +1 -1
- data/node_modules/caniuse-lite/data/features/videotracks.js +1 -1
- data/node_modules/caniuse-lite/data/features/view-transitions.js +1 -1
- data/node_modules/caniuse-lite/data/features/viewport-unit-variants.js +1 -1
- data/node_modules/caniuse-lite/data/features/viewport-units.js +1 -1
- data/node_modules/caniuse-lite/data/features/wai-aria.js +1 -1
- data/node_modules/caniuse-lite/data/features/wake-lock.js +1 -1
- data/node_modules/caniuse-lite/data/features/wasm-bigint.js +1 -1
- data/node_modules/caniuse-lite/data/features/wasm-bulk-memory.js +1 -1
- data/node_modules/caniuse-lite/data/features/wasm-extended-const.js +1 -1
- data/node_modules/caniuse-lite/data/features/wasm-gc.js +1 -1
- data/node_modules/caniuse-lite/data/features/wasm-multi-memory.js +1 -1
- data/node_modules/caniuse-lite/data/features/wasm-multi-value.js +1 -1
- data/node_modules/caniuse-lite/data/features/wasm-mutable-globals.js +1 -1
- data/node_modules/caniuse-lite/data/features/wasm-nontrapping-fptoint.js +1 -1
- data/node_modules/caniuse-lite/data/features/wasm-reference-types.js +1 -1
- data/node_modules/caniuse-lite/data/features/wasm-relaxed-simd.js +1 -1
- data/node_modules/caniuse-lite/data/features/wasm-signext.js +1 -1
- data/node_modules/caniuse-lite/data/features/wasm-simd.js +1 -1
- data/node_modules/caniuse-lite/data/features/wasm-tail-calls.js +1 -1
- data/node_modules/caniuse-lite/data/features/wasm-threads.js +1 -1
- data/node_modules/caniuse-lite/data/features/wasm.js +1 -1
- data/node_modules/caniuse-lite/data/features/wav.js +1 -1
- data/node_modules/caniuse-lite/data/features/wbr-element.js +1 -1
- data/node_modules/caniuse-lite/data/features/web-animation.js +1 -1
- data/node_modules/caniuse-lite/data/features/web-app-manifest.js +1 -1
- data/node_modules/caniuse-lite/data/features/web-bluetooth.js +1 -1
- data/node_modules/caniuse-lite/data/features/web-serial.js +1 -1
- data/node_modules/caniuse-lite/data/features/web-share.js +1 -1
- data/node_modules/caniuse-lite/data/features/webauthn.js +1 -1
- data/node_modules/caniuse-lite/data/features/webcodecs.js +1 -1
- data/node_modules/caniuse-lite/data/features/webgl.js +1 -1
- data/node_modules/caniuse-lite/data/features/webgl2.js +1 -1
- data/node_modules/caniuse-lite/data/features/webgpu.js +1 -1
- data/node_modules/caniuse-lite/data/features/webhid.js +1 -1
- data/node_modules/caniuse-lite/data/features/webkit-user-drag.js +1 -1
- data/node_modules/caniuse-lite/data/features/webm.js +1 -1
- data/node_modules/caniuse-lite/data/features/webnfc.js +1 -1
- data/node_modules/caniuse-lite/data/features/webp.js +1 -1
- data/node_modules/caniuse-lite/data/features/websockets.js +1 -1
- data/node_modules/caniuse-lite/data/features/webtransport.js +1 -1
- data/node_modules/caniuse-lite/data/features/webusb.js +1 -1
- data/node_modules/caniuse-lite/data/features/webvr.js +1 -1
- data/node_modules/caniuse-lite/data/features/webvtt.js +1 -1
- data/node_modules/caniuse-lite/data/features/webworkers.js +1 -1
- data/node_modules/caniuse-lite/data/features/webxr.js +1 -1
- data/node_modules/caniuse-lite/data/features/will-change.js +1 -1
- data/node_modules/caniuse-lite/data/features/woff.js +1 -1
- data/node_modules/caniuse-lite/data/features/woff2.js +1 -1
- data/node_modules/caniuse-lite/data/features/word-break.js +1 -1
- data/node_modules/caniuse-lite/data/features/wordwrap.js +1 -1
- data/node_modules/caniuse-lite/data/features/x-doc-messaging.js +1 -1
- data/node_modules/caniuse-lite/data/features/x-frame-options.js +1 -1
- data/node_modules/caniuse-lite/data/features/xhr2.js +1 -1
- data/node_modules/caniuse-lite/data/features/xhtml.js +1 -1
- data/node_modules/caniuse-lite/data/features/xhtmlsmil.js +1 -1
- data/node_modules/caniuse-lite/data/features/xml-serializer.js +1 -1
- data/node_modules/caniuse-lite/data/features/zstd.js +1 -1
- data/node_modules/caniuse-lite/data/regions/AD.js +1 -1
- data/node_modules/caniuse-lite/data/regions/AE.js +1 -1
- data/node_modules/caniuse-lite/data/regions/AF.js +1 -1
- data/node_modules/caniuse-lite/data/regions/AG.js +1 -1
- data/node_modules/caniuse-lite/data/regions/AI.js +1 -1
- data/node_modules/caniuse-lite/data/regions/AL.js +1 -1
- data/node_modules/caniuse-lite/data/regions/AM.js +1 -1
- data/node_modules/caniuse-lite/data/regions/AO.js +1 -1
- data/node_modules/caniuse-lite/data/regions/AR.js +1 -1
- data/node_modules/caniuse-lite/data/regions/AS.js +1 -1
- data/node_modules/caniuse-lite/data/regions/AT.js +1 -1
- data/node_modules/caniuse-lite/data/regions/AU.js +1 -1
- data/node_modules/caniuse-lite/data/regions/AW.js +1 -1
- data/node_modules/caniuse-lite/data/regions/AX.js +1 -1
- data/node_modules/caniuse-lite/data/regions/AZ.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BA.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BB.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BD.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BE.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BF.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BG.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BH.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BI.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BJ.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BM.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BN.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BO.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BR.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BS.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BT.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BW.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BY.js +1 -1
- data/node_modules/caniuse-lite/data/regions/BZ.js +1 -1
- data/node_modules/caniuse-lite/data/regions/CA.js +1 -1
- data/node_modules/caniuse-lite/data/regions/CD.js +1 -1
- data/node_modules/caniuse-lite/data/regions/CF.js +1 -1
- data/node_modules/caniuse-lite/data/regions/CG.js +1 -1
- data/node_modules/caniuse-lite/data/regions/CH.js +1 -1
- data/node_modules/caniuse-lite/data/regions/CI.js +1 -1
- data/node_modules/caniuse-lite/data/regions/CK.js +1 -1
- data/node_modules/caniuse-lite/data/regions/CL.js +1 -1
- data/node_modules/caniuse-lite/data/regions/CM.js +1 -1
- data/node_modules/caniuse-lite/data/regions/CN.js +1 -1
- data/node_modules/caniuse-lite/data/regions/CO.js +1 -1
- data/node_modules/caniuse-lite/data/regions/CR.js +1 -1
- data/node_modules/caniuse-lite/data/regions/CU.js +1 -1
- data/node_modules/caniuse-lite/data/regions/CV.js +1 -1
- data/node_modules/caniuse-lite/data/regions/CX.js +1 -1
- data/node_modules/caniuse-lite/data/regions/CY.js +1 -1
- data/node_modules/caniuse-lite/data/regions/CZ.js +1 -1
- data/node_modules/caniuse-lite/data/regions/DE.js +1 -1
- data/node_modules/caniuse-lite/data/regions/DJ.js +1 -1
- data/node_modules/caniuse-lite/data/regions/DK.js +1 -1
- data/node_modules/caniuse-lite/data/regions/DM.js +1 -1
- data/node_modules/caniuse-lite/data/regions/DO.js +1 -1
- data/node_modules/caniuse-lite/data/regions/DZ.js +1 -1
- data/node_modules/caniuse-lite/data/regions/EC.js +1 -1
- data/node_modules/caniuse-lite/data/regions/EE.js +1 -1
- data/node_modules/caniuse-lite/data/regions/EG.js +1 -1
- data/node_modules/caniuse-lite/data/regions/ER.js +1 -1
- data/node_modules/caniuse-lite/data/regions/ES.js +1 -1
- data/node_modules/caniuse-lite/data/regions/ET.js +1 -1
- data/node_modules/caniuse-lite/data/regions/FI.js +1 -1
- data/node_modules/caniuse-lite/data/regions/FJ.js +1 -1
- data/node_modules/caniuse-lite/data/regions/FK.js +1 -1
- data/node_modules/caniuse-lite/data/regions/FM.js +1 -1
- data/node_modules/caniuse-lite/data/regions/FO.js +1 -1
- data/node_modules/caniuse-lite/data/regions/FR.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GA.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GB.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GD.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GE.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GF.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GG.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GH.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GI.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GL.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GM.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GN.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GP.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GQ.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GR.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GT.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GU.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GW.js +1 -1
- data/node_modules/caniuse-lite/data/regions/GY.js +1 -1
- data/node_modules/caniuse-lite/data/regions/HK.js +1 -1
- data/node_modules/caniuse-lite/data/regions/HN.js +1 -1
- data/node_modules/caniuse-lite/data/regions/HR.js +1 -1
- data/node_modules/caniuse-lite/data/regions/HT.js +1 -1
- data/node_modules/caniuse-lite/data/regions/HU.js +1 -1
- data/node_modules/caniuse-lite/data/regions/ID.js +1 -1
- data/node_modules/caniuse-lite/data/regions/IE.js +1 -1
- data/node_modules/caniuse-lite/data/regions/IL.js +1 -1
- data/node_modules/caniuse-lite/data/regions/IM.js +1 -1
- data/node_modules/caniuse-lite/data/regions/IN.js +1 -1
- data/node_modules/caniuse-lite/data/regions/IQ.js +1 -1
- data/node_modules/caniuse-lite/data/regions/IR.js +1 -1
- data/node_modules/caniuse-lite/data/regions/IS.js +1 -1
- data/node_modules/caniuse-lite/data/regions/IT.js +1 -1
- data/node_modules/caniuse-lite/data/regions/JE.js +1 -1
- data/node_modules/caniuse-lite/data/regions/JM.js +1 -1
- data/node_modules/caniuse-lite/data/regions/JO.js +1 -1
- data/node_modules/caniuse-lite/data/regions/JP.js +1 -1
- data/node_modules/caniuse-lite/data/regions/KE.js +1 -1
- data/node_modules/caniuse-lite/data/regions/KG.js +1 -1
- data/node_modules/caniuse-lite/data/regions/KH.js +1 -1
- data/node_modules/caniuse-lite/data/regions/KI.js +1 -1
- data/node_modules/caniuse-lite/data/regions/KM.js +1 -1
- data/node_modules/caniuse-lite/data/regions/KN.js +1 -1
- data/node_modules/caniuse-lite/data/regions/KP.js +1 -1
- data/node_modules/caniuse-lite/data/regions/KR.js +1 -1
- data/node_modules/caniuse-lite/data/regions/KW.js +1 -1
- data/node_modules/caniuse-lite/data/regions/KY.js +1 -1
- data/node_modules/caniuse-lite/data/regions/KZ.js +1 -1
- data/node_modules/caniuse-lite/data/regions/LA.js +1 -1
- data/node_modules/caniuse-lite/data/regions/LB.js +1 -1
- data/node_modules/caniuse-lite/data/regions/LC.js +1 -1
- data/node_modules/caniuse-lite/data/regions/LI.js +1 -1
- data/node_modules/caniuse-lite/data/regions/LK.js +1 -1
- data/node_modules/caniuse-lite/data/regions/LR.js +1 -1
- data/node_modules/caniuse-lite/data/regions/LS.js +1 -1
- data/node_modules/caniuse-lite/data/regions/LT.js +1 -1
- data/node_modules/caniuse-lite/data/regions/LU.js +1 -1
- data/node_modules/caniuse-lite/data/regions/LV.js +1 -1
- data/node_modules/caniuse-lite/data/regions/LY.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MA.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MC.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MD.js +1 -1
- data/node_modules/caniuse-lite/data/regions/ME.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MG.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MH.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MK.js +1 -1
- data/node_modules/caniuse-lite/data/regions/ML.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MM.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MN.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MO.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MP.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MQ.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MR.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MS.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MT.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MU.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MV.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MW.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MX.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MY.js +1 -1
- data/node_modules/caniuse-lite/data/regions/MZ.js +1 -1
- data/node_modules/caniuse-lite/data/regions/NA.js +1 -1
- data/node_modules/caniuse-lite/data/regions/NC.js +1 -1
- data/node_modules/caniuse-lite/data/regions/NE.js +1 -1
- data/node_modules/caniuse-lite/data/regions/NF.js +1 -1
- data/node_modules/caniuse-lite/data/regions/NG.js +1 -1
- data/node_modules/caniuse-lite/data/regions/NI.js +1 -1
- data/node_modules/caniuse-lite/data/regions/NL.js +1 -1
- data/node_modules/caniuse-lite/data/regions/NO.js +1 -1
- data/node_modules/caniuse-lite/data/regions/NP.js +1 -1
- data/node_modules/caniuse-lite/data/regions/NR.js +1 -1
- data/node_modules/caniuse-lite/data/regions/NU.js +1 -1
- data/node_modules/caniuse-lite/data/regions/NZ.js +1 -1
- data/node_modules/caniuse-lite/data/regions/OM.js +1 -1
- data/node_modules/caniuse-lite/data/regions/PA.js +1 -1
- data/node_modules/caniuse-lite/data/regions/PE.js +1 -1
- data/node_modules/caniuse-lite/data/regions/PF.js +1 -1
- data/node_modules/caniuse-lite/data/regions/PG.js +1 -1
- data/node_modules/caniuse-lite/data/regions/PH.js +1 -1
- data/node_modules/caniuse-lite/data/regions/PK.js +1 -1
- data/node_modules/caniuse-lite/data/regions/PL.js +1 -1
- data/node_modules/caniuse-lite/data/regions/PM.js +1 -1
- data/node_modules/caniuse-lite/data/regions/PN.js +1 -1
- data/node_modules/caniuse-lite/data/regions/PR.js +1 -1
- data/node_modules/caniuse-lite/data/regions/PS.js +1 -1
- data/node_modules/caniuse-lite/data/regions/PT.js +1 -1
- data/node_modules/caniuse-lite/data/regions/PW.js +1 -1
- data/node_modules/caniuse-lite/data/regions/PY.js +1 -1
- data/node_modules/caniuse-lite/data/regions/QA.js +1 -1
- data/node_modules/caniuse-lite/data/regions/RE.js +1 -1
- data/node_modules/caniuse-lite/data/regions/RO.js +1 -1
- data/node_modules/caniuse-lite/data/regions/RS.js +1 -1
- data/node_modules/caniuse-lite/data/regions/RU.js +1 -1
- data/node_modules/caniuse-lite/data/regions/RW.js +1 -1
- data/node_modules/caniuse-lite/data/regions/SA.js +1 -1
- data/node_modules/caniuse-lite/data/regions/SB.js +1 -1
- data/node_modules/caniuse-lite/data/regions/SC.js +1 -1
- data/node_modules/caniuse-lite/data/regions/SD.js +1 -1
- data/node_modules/caniuse-lite/data/regions/SE.js +1 -1
- data/node_modules/caniuse-lite/data/regions/SG.js +1 -1
- data/node_modules/caniuse-lite/data/regions/SH.js +1 -1
- data/node_modules/caniuse-lite/data/regions/SI.js +1 -1
- data/node_modules/caniuse-lite/data/regions/SK.js +1 -1
- data/node_modules/caniuse-lite/data/regions/SL.js +1 -1
- data/node_modules/caniuse-lite/data/regions/SM.js +1 -1
- data/node_modules/caniuse-lite/data/regions/SN.js +1 -1
- data/node_modules/caniuse-lite/data/regions/SO.js +1 -1
- data/node_modules/caniuse-lite/data/regions/SR.js +1 -1
- data/node_modules/caniuse-lite/data/regions/ST.js +1 -1
- data/node_modules/caniuse-lite/data/regions/SV.js +1 -1
- data/node_modules/caniuse-lite/data/regions/SY.js +1 -1
- data/node_modules/caniuse-lite/data/regions/SZ.js +1 -1
- data/node_modules/caniuse-lite/data/regions/TC.js +1 -1
- data/node_modules/caniuse-lite/data/regions/TD.js +1 -1
- data/node_modules/caniuse-lite/data/regions/TG.js +1 -1
- data/node_modules/caniuse-lite/data/regions/TH.js +1 -1
- data/node_modules/caniuse-lite/data/regions/TJ.js +1 -1
- data/node_modules/caniuse-lite/data/regions/TL.js +1 -1
- data/node_modules/caniuse-lite/data/regions/TM.js +1 -1
- data/node_modules/caniuse-lite/data/regions/TN.js +1 -1
- data/node_modules/caniuse-lite/data/regions/TO.js +1 -1
- data/node_modules/caniuse-lite/data/regions/TR.js +1 -1
- data/node_modules/caniuse-lite/data/regions/TT.js +1 -1
- data/node_modules/caniuse-lite/data/regions/TV.js +1 -1
- data/node_modules/caniuse-lite/data/regions/TW.js +1 -1
- data/node_modules/caniuse-lite/data/regions/TZ.js +1 -1
- data/node_modules/caniuse-lite/data/regions/UA.js +1 -1
- data/node_modules/caniuse-lite/data/regions/UG.js +1 -1
- data/node_modules/caniuse-lite/data/regions/US.js +1 -1
- data/node_modules/caniuse-lite/data/regions/UY.js +1 -1
- data/node_modules/caniuse-lite/data/regions/UZ.js +1 -1
- data/node_modules/caniuse-lite/data/regions/VA.js +1 -1
- data/node_modules/caniuse-lite/data/regions/VC.js +1 -1
- data/node_modules/caniuse-lite/data/regions/VE.js +1 -1
- data/node_modules/caniuse-lite/data/regions/VG.js +1 -1
- data/node_modules/caniuse-lite/data/regions/VI.js +1 -1
- data/node_modules/caniuse-lite/data/regions/VN.js +1 -1
- data/node_modules/caniuse-lite/data/regions/VU.js +1 -1
- data/node_modules/caniuse-lite/data/regions/WF.js +1 -1
- data/node_modules/caniuse-lite/data/regions/WS.js +1 -1
- data/node_modules/caniuse-lite/data/regions/YE.js +1 -1
- data/node_modules/caniuse-lite/data/regions/YT.js +1 -1
- data/node_modules/caniuse-lite/data/regions/ZA.js +1 -1
- data/node_modules/caniuse-lite/data/regions/ZM.js +1 -1
- data/node_modules/caniuse-lite/data/regions/ZW.js +1 -1
- data/node_modules/caniuse-lite/data/regions/alt-af.js +1 -1
- data/node_modules/caniuse-lite/data/regions/alt-an.js +1 -1
- data/node_modules/caniuse-lite/data/regions/alt-as.js +1 -1
- data/node_modules/caniuse-lite/data/regions/alt-eu.js +1 -1
- data/node_modules/caniuse-lite/data/regions/alt-na.js +1 -1
- data/node_modules/caniuse-lite/data/regions/alt-oc.js +1 -1
- data/node_modules/caniuse-lite/data/regions/alt-sa.js +1 -1
- data/node_modules/caniuse-lite/data/regions/alt-ww.js +1 -1
- data/node_modules/caniuse-lite/package.json +1 -1
- data/node_modules/electron-to-chromium/chromium-versions.js +1 -4
- data/node_modules/electron-to-chromium/chromium-versions.json +1 -1
- data/node_modules/electron-to-chromium/full-chromium-versions.js +3 -75
- data/node_modules/electron-to-chromium/full-chromium-versions.json +1 -1
- data/node_modules/electron-to-chromium/full-versions.js +1 -45
- data/node_modules/electron-to-chromium/full-versions.json +1 -1
- data/node_modules/electron-to-chromium/package.json +1 -1
- data/node_modules/electron-to-chromium/versions.js +1 -8
- data/node_modules/electron-to-chromium/versions.json +1 -1
- data/node_modules/es-object-atoms/CHANGELOG.md +0 -21
- data/node_modules/es-object-atoms/README.md +0 -7
- data/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +2 -2
- data/node_modules/es-object-atoms/ToObject.d.ts +2 -6
- data/node_modules/es-object-atoms/package.json +8 -9
- data/node_modules/es-object-atoms/test/index.js +1 -11
- data/node_modules/es-shim-unscopables/CHANGELOG.md +0 -8
- data/node_modules/es-shim-unscopables/index.js +1 -2
- data/node_modules/es-shim-unscopables/package.json +11 -20
- data/node_modules/es-shim-unscopables/test/index.js +1 -4
- data/node_modules/es-shim-unscopables/test/with.js +0 -8
- data/node_modules/flatted/index.js +3 -3
- data/node_modules/flatted/min.js +1 -1
- data/node_modules/flatted/package.json +8 -21
- data/node_modules/flatted/python/flatted.py +4 -4
- data/node_modules/flatted/python/test.py +63 -0
- data/node_modules/flow-parser/flow_parser.js +5530 -5550
- data/node_modules/flow-parser/package.json +1 -1
- data/node_modules/for-each/README.md +4 -0
- data/node_modules/for-each/index.js +4 -11
- data/node_modules/for-each/package.json +36 -47
- data/node_modules/for-each/test/test.js +12 -54
- data/node_modules/get-intrinsic/CHANGELOG.md +0 -8
- data/node_modules/get-intrinsic/index.js +0 -1
- data/node_modules/get-intrinsic/package.json +8 -8
- data/node_modules/import-fresh/index.js +1 -2
- data/node_modules/import-fresh/package.json +1 -6
- data/node_modules/import-fresh/readme.md +8 -14
- data/node_modules/is-async-function/CHANGELOG.md +0 -13
- data/node_modules/is-async-function/index.d.ts +2 -4
- data/node_modules/is-async-function/index.js +18 -3
- data/node_modules/is-async-function/package.json +3 -8
- data/node_modules/is-boolean-object/CHANGELOG.md +0 -11
- data/node_modules/is-boolean-object/index.js +1 -1
- data/node_modules/is-boolean-object/package.json +6 -8
- data/node_modules/is-boolean-object/test/index.js +1 -24
- data/node_modules/is-weakref/CHANGELOG.md +0 -8
- data/node_modules/is-weakref/index.d.ts +1 -1
- data/node_modules/is-weakref/index.js +1 -3
- data/node_modules/is-weakref/package.json +6 -6
- data/node_modules/jscodeshift/CHANGELOG.md +226 -0
- data/node_modules/jscodeshift/CODE_OF_CONDUCT.md +3 -0
- data/node_modules/jscodeshift/CONTRIBUTING.md +48 -0
- data/node_modules/{async-function → jscodeshift}/LICENSE +1 -1
- data/node_modules/jscodeshift/README.md +671 -0
- data/node_modules/jscodeshift/bin/jscodeshift.js +182 -0
- data/node_modules/jscodeshift/bin/jscodeshift.sh +12 -0
- data/node_modules/jscodeshift/dist/Collection.js +472 -0
- data/node_modules/jscodeshift/dist/Runner.js +322 -0
- data/node_modules/jscodeshift/dist/Worker.js +210 -0
- data/node_modules/jscodeshift/dist/__testfixtures__/test-async-transform.input.js +1 -0
- data/node_modules/jscodeshift/dist/__testfixtures__/test-async-transform.js +11 -0
- data/node_modules/jscodeshift/dist/__testfixtures__/test-async-transform.output.js +1 -0
- data/node_modules/jscodeshift/dist/__testfixtures__/test-sync-transform.input.js +1 -0
- data/node_modules/jscodeshift/dist/__testfixtures__/test-sync-transform.js +7 -0
- data/node_modules/jscodeshift/dist/__testfixtures__/test-sync-transform.output.js +1 -0
- data/node_modules/jscodeshift/dist/argsParser.js +273 -0
- data/node_modules/jscodeshift/dist/collections/ImportDeclaration.js +113 -0
- data/node_modules/jscodeshift/dist/collections/JSXElement.js +221 -0
- data/node_modules/jscodeshift/dist/collections/Node.js +187 -0
- data/node_modules/jscodeshift/dist/collections/VariableDeclarator.js +210 -0
- data/node_modules/jscodeshift/dist/collections/index.js +14 -0
- data/node_modules/jscodeshift/dist/core.js +183 -0
- data/node_modules/jscodeshift/dist/getParser.js +25 -0
- data/node_modules/jscodeshift/dist/ignoreFiles.js +68 -0
- data/node_modules/jscodeshift/dist/matchNode.js +40 -0
- data/node_modules/jscodeshift/dist/template.js +173 -0
- data/node_modules/jscodeshift/dist/testUtils.js +173 -0
- data/node_modules/jscodeshift/dist/utils/intersection.js +27 -0
- data/node_modules/jscodeshift/dist/utils/once.js +21 -0
- data/node_modules/jscodeshift/dist/utils/union.js +20 -0
- data/node_modules/jscodeshift/index.js +9 -0
- data/node_modules/jscodeshift/package.json +74 -0
- data/node_modules/jscodeshift/parser/babel5Compat.js +50 -0
- data/node_modules/jscodeshift/parser/babylon.js +57 -0
- data/node_modules/jscodeshift/parser/flow.js +34 -0
- data/node_modules/jscodeshift/parser/ts.js +24 -0
- data/node_modules/jscodeshift/parser/tsOptions.js +46 -0
- data/node_modules/jscodeshift/parser/tsx.js +27 -0
- data/node_modules/jscodeshift/src/Collection.js +472 -0
- data/node_modules/jscodeshift/src/Runner.js +322 -0
- data/node_modules/jscodeshift/src/Worker.js +210 -0
- data/node_modules/jscodeshift/src/__testfixtures__/test-async-transform.input.js +1 -0
- data/node_modules/jscodeshift/src/__testfixtures__/test-async-transform.js +11 -0
- data/node_modules/jscodeshift/src/__testfixtures__/test-async-transform.output.js +1 -0
- data/node_modules/jscodeshift/src/__testfixtures__/test-sync-transform.input.js +1 -0
- data/node_modules/jscodeshift/src/__testfixtures__/test-sync-transform.js +7 -0
- data/node_modules/jscodeshift/src/__testfixtures__/test-sync-transform.output.js +1 -0
- data/node_modules/jscodeshift/src/argsParser.js +273 -0
- data/node_modules/jscodeshift/src/collections/ImportDeclaration.js +113 -0
- data/node_modules/jscodeshift/src/collections/JSXElement.js +221 -0
- data/node_modules/jscodeshift/src/collections/Node.js +187 -0
- data/node_modules/jscodeshift/src/collections/VariableDeclarator.js +210 -0
- data/node_modules/jscodeshift/src/collections/index.js +14 -0
- data/node_modules/jscodeshift/src/core.js +183 -0
- data/node_modules/jscodeshift/src/getParser.js +25 -0
- data/node_modules/jscodeshift/src/ignoreFiles.js +68 -0
- data/node_modules/jscodeshift/src/matchNode.js +40 -0
- data/node_modules/jscodeshift/src/template.js +173 -0
- data/node_modules/jscodeshift/src/testUtils.js +173 -0
- data/node_modules/jscodeshift/src/utils/intersection.js +27 -0
- data/node_modules/jscodeshift/src/utils/once.js +21 -0
- data/node_modules/jscodeshift/src/utils/union.js +20 -0
- data/node_modules/jscodeshift/utils/requirePackage.js +24 -0
- data/node_modules/jscodeshift/utils/testUtils.js +49 -0
- data/node_modules/jscodeshift/website/README.md +44 -0
- data/node_modules/jscodeshift/website/astro.config.mjs +36 -0
- data/node_modules/jscodeshift/website/package.json +17 -0
- data/node_modules/jscodeshift/website/public/favicon.svg +1 -0
- data/node_modules/jscodeshift/website/src/assets/houston.webp +0 -0
- data/node_modules/jscodeshift/website/src/content/config.ts +6 -0
- data/node_modules/jscodeshift/website/src/content/docs/build/api-reference.mdx +406 -0
- data/node_modules/jscodeshift/website/src/content/docs/build/ast-grammar.mdx +3086 -0
- data/node_modules/jscodeshift/website/src/content/docs/index.mdx +15 -0
- data/node_modules/jscodeshift/website/src/content/docs/overview/introduction.mdx +45 -0
- data/node_modules/jscodeshift/website/src/content/docs/run/cli.mdx +161 -0
- data/node_modules/jscodeshift/website/src/env.d.ts +2 -0
- data/node_modules/jscodeshift/website/tsconfig.json +3 -0
- data/node_modules/object-inspect/CHANGELOG.md +0 -8
- data/node_modules/object-inspect/index.js +7 -10
- data/node_modules/object-inspect/package.json +4 -5
- data/node_modules/object-inspect/test/values.js +0 -50
- data/node_modules/possible-typed-array-names/CHANGELOG.md +0 -14
- data/node_modules/possible-typed-array-names/README.md +2 -4
- data/node_modules/possible-typed-array-names/index.d.ts +0 -1
- data/node_modules/possible-typed-array-names/index.js +0 -1
- data/node_modules/possible-typed-array-names/package.json +9 -10
- data/node_modules/possible-typed-array-names/test/index.js +3 -6
- data/node_modules/possible-typed-array-names/tsconfig.json +42 -2
- data/node_modules/recast/lib/lines.d.ts +2 -2
- data/node_modules/recast/lib/printer.js +5 -17
- data/node_modules/recast/package.json +1 -1
- data/node_modules/typescript/README.md +1 -1
- data/node_modules/typescript/lib/_tsc.js +500 -931
- data/node_modules/typescript/lib/_tsserver.js +7 -43
- data/node_modules/typescript/lib/cancellationToken.js +90 -0
- data/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +8 -14
- data/node_modules/typescript/lib/de/diagnosticMessages.generated.json +8 -14
- data/node_modules/typescript/lib/es/diagnosticMessages.generated.json +8 -14
- data/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +8 -14
- data/node_modules/typescript/lib/it/diagnosticMessages.generated.json +8 -14
- data/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +8 -14
- data/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +8 -14
- data/node_modules/typescript/lib/lib.dom.d.ts +142 -769
- data/node_modules/typescript/lib/lib.dom.iterable.d.ts +7 -9
- data/node_modules/typescript/lib/lib.es2015.iterable.d.ts +54 -69
- data/node_modules/typescript/lib/lib.es2020.bigint.d.ts +7 -41
- data/node_modules/typescript/lib/lib.es2023.array.d.ts +24 -24
- data/node_modules/typescript/lib/lib.es5.d.ts +51 -60
- data/node_modules/typescript/lib/lib.esnext.d.ts +0 -2
- data/node_modules/typescript/lib/lib.esnext.iterator.d.ts +1 -1
- data/node_modules/typescript/lib/lib.webworker.d.ts +55 -262
- data/node_modules/typescript/lib/lib.webworker.iterable.d.ts +7 -6
- data/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +8 -14
- data/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +8 -14
- data/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +8 -14
- data/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +8 -14
- data/node_modules/typescript/lib/typescript.d.ts +3 -14
- data/node_modules/typescript/lib/typescript.js +570 -1035
- data/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +8 -14
- data/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +8 -14
- data/node_modules/typescript/package.json +22 -22
- data/node_modules/update-browserslist-db/index.js +7 -5
- data/node_modules/update-browserslist-db/package.json +2 -2
- data/node_modules/which-typed-array/CHANGELOG.md +0 -10
- data/node_modules/which-typed-array/index.js +20 -21
- data/node_modules/which-typed-array/package.json +7 -9
- data/node_modules/which-typed-array/tsconfig.json +1 -1
- data/package.json +1 -0
- metadata +85 -28
- data/node_modules/@babel/generator/lib/generators/deprecated.js +0 -28
- data/node_modules/@babel/generator/lib/generators/deprecated.js.map +0 -1
- data/node_modules/@babel/types/lib/builders/generated/lowercase.js +0 -2886
- data/node_modules/@babel/types/lib/builders/generated/lowercase.js.map +0 -1
- data/node_modules/async-function/CHANGELOG.md +0 -16
- data/node_modules/async-function/README.md +0 -51
- data/node_modules/async-function/index.d.mts +0 -3
- data/node_modules/async-function/index.d.ts +0 -13
- data/node_modules/async-function/index.js +0 -8
- data/node_modules/async-function/index.mjs +0 -4
- data/node_modules/async-function/legacy.js +0 -18
- data/node_modules/async-function/package.json +0 -86
- data/node_modules/async-function/require.mjs +0 -5
- data/node_modules/async-function/test/index.js +0 -40
- data/node_modules/async-function/tsconfig.json +0 -9
- data/node_modules/es-object-atoms/isObject.d.ts +0 -3
- data/node_modules/es-object-atoms/isObject.js +0 -6
- data/node_modules/es-shim-unscopables/index.d.ts +0 -8
- data/node_modules/es-shim-unscopables/tsconfig.json +0 -10
- data/node_modules/for-each/CHANGELOG.md +0 -107
- data/node_modules/for-each/index.d.ts +0 -35
- data/node_modules/for-each/tsconfig.json +0 -8
- data/node_modules/typescript/lib/lib.esnext.float16.d.ts +0 -443
- data/node_modules/typescript/lib/lib.esnext.promise.d.ts +0 -34
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["VALID_OBJECT_CALLEES","VALID_IDENTIFIER_CALLEES","INVALID_METHODS","isValidObjectCallee","val","includes","isValidIdentifierCallee","isInvalidMethod","evaluateTruthy","res","evaluate","confident","value","deopt","path","state","deoptPath","Globals","Map","undefined","Infinity","NaN","evaluateCached","node","seen","has","existing","get","resolved","item","set","_evaluate","isSequenceExpression","exprs","length","isStringLiteral","isNumericLiteral","isBooleanLiteral","isNullLiteral","isTemplateLiteral","evaluateQuasis","quasis","isTaggedTemplateExpression","isMemberExpression","object","name","property","isIdentifier","scope","getBinding","quasi","isConditionalExpression","testResult","isExpressionWrapper","parentPath","isCallExpression","callee","isLiteral","type","key","computed","isReferencedIdentifier","binding","constantViolations","start","end","bindingPathScope","kind","hasUnsafeBlock","isBlockStatement","parent","_scope$path$parentPat","hasValue","resolve","isUnaryExpression","prefix","operator","argument","isFunction","isClass","arg","isArrayExpression","arr","elems","elem","elemValue","push","isObjectExpression","obj","props","prop","isObjectMethod","isSpreadElement","keyPath","valuePath","isLogicalExpression","wasConfident","left","leftConfident","right","rightConfident","isBinaryExpression","Math","pow","context","func","global","hasOwnProperty","call","args","map","apply","raw","str","i","cooked","expr","String"],"sources":["../../src/path/evaluation.ts"],"sourcesContent":["import type NodePath from \"./index.ts\";\nimport type * as t from \"@babel/types\";\n\n// This file contains Babels metainterpreter that can evaluate static code.\n\nconst VALID_OBJECT_CALLEES = [\"Number\", \"String\", \"Math\"] as const;\nconst VALID_IDENTIFIER_CALLEES = [\n \"isFinite\",\n \"isNaN\",\n \"parseFloat\",\n \"parseInt\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n process.env.BABEL_8_BREAKING ? \"btoa\" : null,\n process.env.BABEL_8_BREAKING ? \"atob\" : null,\n] as const;\n\nconst INVALID_METHODS = [\"random\"] as const;\n\nfunction isValidObjectCallee(\n val: string,\n): val is (typeof VALID_OBJECT_CALLEES)[number] {\n return VALID_OBJECT_CALLEES.includes(\n // @ts-expect-error val is a string\n val,\n );\n}\n\nfunction isValidIdentifierCallee(\n val: string,\n): val is (typeof VALID_IDENTIFIER_CALLEES)[number] {\n return VALID_IDENTIFIER_CALLEES.includes(\n // @ts-expect-error val is a string\n val,\n );\n}\n\nfunction isInvalidMethod(val: string): val is (typeof INVALID_METHODS)[number] {\n return INVALID_METHODS.includes(\n // @ts-expect-error val is a string\n val,\n );\n}\n\n/**\n * Walk the input `node` and statically evaluate if it's truthy.\n *\n * Returning `true` when we're sure that the expression will evaluate to a\n * truthy value, `false` if we're sure that it will evaluate to a falsy\n * value and `undefined` if we aren't sure. Because of this please do not\n * rely on coercion when using this method and check with === if it's false.\n *\n * For example do:\n *\n * if (t.evaluateTruthy(node) === false) falsyLogic();\n *\n * **AND NOT**\n *\n * if (!t.evaluateTruthy(node)) falsyLogic();\n *\n */\n\nexport function evaluateTruthy(this: NodePath): boolean {\n const res = this.evaluate();\n if (res.confident) return !!res.value;\n}\n\ntype State = {\n confident: boolean;\n deoptPath: NodePath | null;\n seen: Map<t.Node, Result>;\n};\n\ntype Result = {\n resolved: boolean;\n value?: any;\n};\n/**\n * Deopts the evaluation\n */\nfunction deopt(path: NodePath, state: State) {\n if (!state.confident) return;\n state.deoptPath = path;\n state.confident = false;\n}\n\nconst Globals = new Map([\n [\"undefined\", undefined],\n [\"Infinity\", Infinity],\n [\"NaN\", NaN],\n]);\n\n/**\n * We wrap the _evaluate method so we can track `seen` nodes, we push an item\n * to the map before we actually evaluate it so we can deopt on self recursive\n * nodes such as:\n *\n * var g = a ? 1 : 2,\n * a = g * this.foo\n */\nfunction evaluateCached(path: NodePath, state: State): any {\n const { node } = path;\n const { seen } = state;\n\n if (seen.has(node)) {\n const existing = seen.get(node);\n if (existing.resolved) {\n return existing.value;\n } else {\n deopt(path, state);\n return;\n }\n } else {\n const item: Result = { resolved: false };\n seen.set(node, item);\n\n const val = _evaluate(path, state);\n if (state.confident) {\n item.resolved = true;\n item.value = val;\n }\n return val;\n }\n}\n\nfunction _evaluate(path: NodePath, state: State): any {\n if (!state.confident) return;\n\n if (path.isSequenceExpression()) {\n const exprs = path.get(\"expressions\");\n return evaluateCached(exprs[exprs.length - 1], state);\n }\n\n if (\n path.isStringLiteral() ||\n path.isNumericLiteral() ||\n path.isBooleanLiteral()\n ) {\n return path.node.value;\n }\n\n if (path.isNullLiteral()) {\n return null;\n }\n\n if (path.isTemplateLiteral()) {\n return evaluateQuasis(path, path.node.quasis, state);\n }\n\n if (\n path.isTaggedTemplateExpression() &&\n path.get(\"tag\").isMemberExpression()\n ) {\n const object = path.get(\"tag.object\") as NodePath;\n const {\n // @ts-expect-error todo(flow->ts): possible bug, object is can be any expression and so name might be undefined\n node: { name },\n } = object;\n const property = path.get(\"tag.property\") as NodePath;\n\n if (\n object.isIdentifier() &&\n name === \"String\" &&\n // todo(flow->ts): was changed from getBinding(name, true)\n // should this be hasBinding(name, true) as the binding is never used later?\n !path.scope.getBinding(name) &&\n property.isIdentifier() &&\n property.node.name === \"raw\"\n ) {\n return evaluateQuasis(path, path.node.quasi.quasis, state, true);\n }\n }\n\n if (path.isConditionalExpression()) {\n const testResult = evaluateCached(path.get(\"test\"), state);\n if (!state.confident) return;\n if (testResult) {\n return evaluateCached(path.get(\"consequent\"), state);\n } else {\n return evaluateCached(path.get(\"alternate\"), state);\n }\n }\n\n if (path.isExpressionWrapper()) {\n // TypeCastExpression, ExpressionStatement etc\n return evaluateCached(path.get(\"expression\"), state);\n }\n\n // \"foo\".length, \"foo\"[0]\n if (\n path.isMemberExpression() &&\n !path.parentPath.isCallExpression({ callee: path.node })\n ) {\n const property = path.get(\"property\");\n const object = path.get(\"object\");\n\n if (object.isLiteral()) {\n // @ts-expect-error todo(flow->ts): instead of typeof - would it be better to check type of ast node?\n const value = object.node.value;\n const type = typeof value;\n\n let key = null;\n if (path.node.computed) {\n key = evaluateCached(property, state);\n if (!state.confident) return;\n } else if (property.isIdentifier()) {\n key = property.node.name;\n }\n if (\n (type === \"number\" || type === \"string\") &&\n key != null &&\n (typeof key === \"number\" || typeof key === \"string\")\n ) {\n return value[key];\n }\n }\n }\n\n if (path.isReferencedIdentifier()) {\n const binding = path.scope.getBinding(path.node.name);\n\n if (binding) {\n if (\n binding.constantViolations.length > 0 ||\n path.node.start < binding.path.node.end\n ) {\n deopt(binding.path, state);\n return;\n }\n const bindingPathScope = binding.path.scope;\n if (binding.kind === \"var\" && bindingPathScope !== binding.scope) {\n let hasUnsafeBlock =\n !bindingPathScope.path.parentPath.isBlockStatement();\n for (let scope = bindingPathScope.parent; scope; scope = scope.parent) {\n if (scope === path.scope) {\n if (hasUnsafeBlock) {\n deopt(binding.path, state);\n return;\n }\n break;\n }\n if (scope.path.parentPath?.isBlockStatement()) {\n hasUnsafeBlock = true;\n }\n }\n }\n if (binding.hasValue) {\n return binding.value;\n }\n }\n\n const name = path.node.name;\n if (Globals.has(name)) {\n if (!binding) {\n return Globals.get(name);\n }\n deopt(binding.path, state);\n return;\n }\n\n const resolved = path.resolve();\n if (resolved === path) {\n deopt(path, state);\n return;\n } else {\n return evaluateCached(resolved, state);\n }\n }\n\n if (path.isUnaryExpression({ prefix: true })) {\n if (path.node.operator === \"void\") {\n // we don't need to evaluate the argument to know what this will return\n return undefined;\n }\n\n const argument = path.get(\"argument\");\n if (\n path.node.operator === \"typeof\" &&\n (argument.isFunction() || argument.isClass())\n ) {\n return \"function\";\n }\n\n const arg = evaluateCached(argument, state);\n if (!state.confident) return;\n switch (path.node.operator) {\n case \"!\":\n return !arg;\n case \"+\":\n return +arg;\n case \"-\":\n return -arg;\n case \"~\":\n return ~arg;\n case \"typeof\":\n return typeof arg;\n }\n }\n\n if (path.isArrayExpression()) {\n const arr = [];\n const elems: Array<NodePath> = path.get(\"elements\");\n for (const elem of elems) {\n const elemValue = elem.evaluate();\n\n if (elemValue.confident) {\n arr.push(elemValue.value);\n } else {\n deopt(elemValue.deopt, state);\n return;\n }\n }\n return arr;\n }\n\n if (path.isObjectExpression()) {\n const obj = {};\n const props = path.get(\"properties\");\n for (const prop of props) {\n if (prop.isObjectMethod() || prop.isSpreadElement()) {\n deopt(prop, state);\n return;\n }\n const keyPath = prop.get(\"key\");\n let key;\n if (prop.node.computed) {\n key = keyPath.evaluate();\n if (!key.confident) {\n deopt(key.deopt, state);\n return;\n }\n key = key.value;\n } else if (keyPath.isIdentifier()) {\n key = keyPath.node.name;\n } else {\n key = (\n keyPath.node as t.StringLiteral | t.NumericLiteral | t.BigIntLiteral\n ).value;\n }\n const valuePath = prop.get(\"value\");\n let value = valuePath.evaluate();\n if (!value.confident) {\n deopt(value.deopt, state);\n return;\n }\n value = value.value;\n // @ts-expect-error key is any type\n obj[key] = value;\n }\n return obj;\n }\n\n if (path.isLogicalExpression()) {\n // If we are confident that the left side of an && is false, or the left\n // side of an || is true, we can be confident about the entire expression\n const wasConfident = state.confident;\n const left = evaluateCached(path.get(\"left\"), state);\n const leftConfident = state.confident;\n state.confident = wasConfident;\n const right = evaluateCached(path.get(\"right\"), state);\n const rightConfident = state.confident;\n\n switch (path.node.operator) {\n case \"||\":\n // TODO consider having a \"truthy type\" that doesn't bail on\n // left uncertainty but can still evaluate to truthy.\n state.confident = leftConfident && (!!left || rightConfident);\n if (!state.confident) return;\n\n return left || right;\n case \"&&\":\n state.confident = leftConfident && (!left || rightConfident);\n if (!state.confident) return;\n\n return left && right;\n case \"??\":\n state.confident = leftConfident && (left != null || rightConfident);\n if (!state.confident) return;\n\n return left ?? right;\n }\n }\n\n if (path.isBinaryExpression()) {\n const left = evaluateCached(path.get(\"left\"), state);\n if (!state.confident) return;\n const right = evaluateCached(path.get(\"right\"), state);\n if (!state.confident) return;\n\n switch (path.node.operator) {\n case \"-\":\n return left - right;\n case \"+\":\n return left + right;\n case \"/\":\n return left / right;\n case \"*\":\n return left * right;\n case \"%\":\n return left % right;\n case \"**\":\n return left ** right;\n case \"<\":\n return left < right;\n case \">\":\n return left > right;\n case \"<=\":\n return left <= right;\n case \">=\":\n return left >= right;\n case \"==\":\n return left == right; // eslint-disable-line eqeqeq\n case \"!=\":\n return left != right; // eslint-disable-line eqeqeq\n case \"===\":\n return left === right;\n case \"!==\":\n return left !== right;\n case \"|\":\n return left | right;\n case \"&\":\n return left & right;\n case \"^\":\n return left ^ right;\n case \"<<\":\n return left << right;\n case \">>\":\n return left >> right;\n case \">>>\":\n return left >>> right;\n }\n }\n\n if (path.isCallExpression()) {\n const callee = path.get(\"callee\");\n let context;\n let func;\n\n // Number(1);\n if (\n callee.isIdentifier() &&\n !path.scope.getBinding(callee.node.name) &&\n (isValidObjectCallee(callee.node.name) ||\n isValidIdentifierCallee(callee.node.name))\n ) {\n func = global[callee.node.name];\n }\n\n if (callee.isMemberExpression()) {\n const object = callee.get(\"object\");\n const property = callee.get(\"property\");\n\n // Math.min(1, 2)\n if (\n object.isIdentifier() &&\n property.isIdentifier() &&\n isValidObjectCallee(object.node.name) &&\n !isInvalidMethod(property.node.name)\n ) {\n context = global[object.node.name];\n const key = property.node.name;\n if (Object.hasOwn(context, key)) {\n func = context[key as keyof typeof context];\n }\n }\n\n // \"abc\".charCodeAt(4)\n if (object.isLiteral() && property.isIdentifier()) {\n // @ts-expect-error todo(flow->ts): consider checking ast node type instead of value type (StringLiteral and NumberLiteral)\n const type = typeof object.node.value;\n if (type === \"string\" || type === \"number\") {\n // @ts-expect-error todo(flow->ts): consider checking ast node type instead of value type\n context = object.node.value;\n func = context[property.node.name];\n }\n }\n }\n\n if (func) {\n const args = path.get(\"arguments\").map(arg => evaluateCached(arg, state));\n if (!state.confident) return;\n\n return func.apply(context, args);\n }\n }\n\n deopt(path, state);\n}\n\nfunction evaluateQuasis(\n path: NodePath<t.TaggedTemplateExpression | t.TemplateLiteral>,\n quasis: Array<any>,\n state: State,\n raw = false,\n) {\n let str = \"\";\n\n let i = 0;\n const exprs: Array<NodePath<t.Node>> = path.isTemplateLiteral()\n ? path.get(\"expressions\")\n : path.get(\"quasi.expressions\");\n\n for (const elem of quasis) {\n // not confident, evaluated an expression we don't like\n if (!state.confident) break;\n\n // add on element\n str += raw ? elem.value.raw : elem.value.cooked;\n\n // add on interpolated expression if it's present\n const expr = exprs[i++];\n if (expr) str += String(evaluateCached(expr, state));\n }\n\n if (!state.confident) return;\n return str;\n}\n\n/**\n * Walk the input `node` and statically evaluate it.\n *\n * Returns an object in the form `{ confident, value, deopt }`. `confident`\n * indicates whether or not we had to drop out of evaluating the expression\n * because of hitting an unknown node that we couldn't confidently find the\n * value of, in which case `deopt` is the path of said node.\n *\n * Example:\n *\n * t.evaluate(parse(\"5 + 5\")) // { confident: true, value: 10 }\n * t.evaluate(parse(\"!true\")) // { confident: true, value: false }\n * t.evaluate(parse(\"foo + foo\")) // { confident: false, value: undefined, deopt: NodePath }\n *\n */\n\nexport function evaluate(this: NodePath): {\n confident: boolean;\n value: any;\n deopt?: NodePath;\n} {\n const state: State = {\n confident: true,\n deoptPath: null,\n seen: new Map(),\n };\n let value = evaluateCached(this, state);\n if (!state.confident) value = undefined;\n\n return {\n confident: state.confident,\n deopt: state.deoptPath,\n value: value,\n };\n}\n"],"mappings":";;;;;;;AAKA,MAAMA,oBAAoB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU;AAClE,MAAMC,wBAAwB,GAAG,CAC/B,UAAU,EACV,OAAO,EACP,YAAY,EACZ,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,WAAW,EACX,oBAAoB,EACoB,IAAI,EACJ,IAAI,CACpC;AAEV,MAAMC,eAAe,GAAG,CAAC,QAAQ,CAAU;AAE3C,SAASC,mBAAmBA,CAC1BC,GAAW,EACmC;EAC9C,OAAOJ,oBAAoB,CAACK,QAAQ,CAElCD,GACF,CAAC;AACH;AAEA,SAASE,uBAAuBA,CAC9BF,GAAW,EACuC;EAClD,OAAOH,wBAAwB,CAACI,QAAQ,CAEtCD,GACF,CAAC;AACH;AAEA,SAASG,eAAeA,CAACH,GAAW,EAA2C;EAC7E,OAAOF,eAAe,CAACG,QAAQ,CAE7BD,GACF,CAAC;AACH;AAoBO,SAASI,cAAcA,CAAA,EAA0B;EACtD,MAAMC,GAAG,GAAG,IAAI,CAACC,QAAQ,CAAC,CAAC;EAC3B,IAAID,GAAG,CAACE,SAAS,EAAE,OAAO,CAAC,CAACF,GAAG,CAACG,KAAK;AACvC;AAeA,SAASC,KAAKA,CAACC,IAAc,EAAEC,KAAY,EAAE;EAC3C,IAAI,CAACA,KAAK,CAACJ,SAAS,EAAE;EACtBI,KAAK,CAACC,SAAS,GAAGF,IAAI;EACtBC,KAAK,CAACJ,S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AAEE,KAAK,CAACC,SAAS;IACtBJ,KAAK,EAAEA;EACT,CAAC;AACH","ignoreList":[]}
|
1
|
+
{"version":3,"names":["VALID_OBJECT_CALLEES","VALID_IDENTIFIER_CALLEES","INVALID_METHODS","isValidObjectCallee","val","includes","isValidIdentifierCallee","isInvalidMethod","evaluateTruthy","res","evaluate","confident","value","deopt","path","state","deoptPath","Globals","Map","undefined","Infinity","NaN","evaluateCached","node","seen","has","existing","get","resolved","item","set","_evaluate","isSequenceExpression","exprs","length","isStringLiteral","isNumericLiteral","isBooleanLiteral","isNullLiteral","isTemplateLiteral","evaluateQuasis","quasis","isTaggedTemplateExpression","isMemberExpression","object","name","property","isIdentifier","scope","getBinding","quasi","isConditionalExpression","testResult","isExpressionWrapper","parentPath","isCallExpression","callee","isLiteral","type","key","computed","isReferencedIdentifier","binding","constantViolations","start","end","hasValue","resolve","isUnaryExpression","prefix","operator","argument","isFunction","isClass","arg","isArrayExpression","arr","elems","elem","elemValue","push","isObjectExpression","obj","props","prop","isObjectMethod","isSpreadElement","keyPath","valuePath","isLogicalExpression","wasConfident","left","leftConfident","right","rightConfident","isBinaryExpression","Math","pow","context","func","global","hasOwnProperty","call","args","map","apply","raw","str","i","cooked","expr","String"],"sources":["../../src/path/evaluation.ts"],"sourcesContent":["import type NodePath from \"./index.ts\";\nimport type * as t from \"@babel/types\";\n\n// This file contains Babels metainterpreter that can evaluate static code.\n\nconst VALID_OBJECT_CALLEES = [\"Number\", \"String\", \"Math\"] as const;\nconst VALID_IDENTIFIER_CALLEES = [\n \"isFinite\",\n \"isNaN\",\n \"parseFloat\",\n \"parseInt\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n process.env.BABEL_8_BREAKING ? \"btoa\" : null,\n process.env.BABEL_8_BREAKING ? \"atob\" : null,\n] as const;\n\nconst INVALID_METHODS = [\"random\"] as const;\n\nfunction isValidObjectCallee(\n val: string,\n): val is (typeof VALID_OBJECT_CALLEES)[number] {\n return VALID_OBJECT_CALLEES.includes(\n // @ts-expect-error val is a string\n val,\n );\n}\n\nfunction isValidIdentifierCallee(\n val: string,\n): val is (typeof VALID_IDENTIFIER_CALLEES)[number] {\n return VALID_IDENTIFIER_CALLEES.includes(\n // @ts-expect-error val is a string\n val,\n );\n}\n\nfunction isInvalidMethod(val: string): val is (typeof INVALID_METHODS)[number] {\n return INVALID_METHODS.includes(\n // @ts-expect-error val is a string\n val,\n );\n}\n\n/**\n * Walk the input `node` and statically evaluate if it's truthy.\n *\n * Returning `true` when we're sure that the expression will evaluate to a\n * truthy value, `false` if we're sure that it will evaluate to a falsy\n * value and `undefined` if we aren't sure. Because of this please do not\n * rely on coercion when using this method and check with === if it's false.\n *\n * For example do:\n *\n * if (t.evaluateTruthy(node) === false) falsyLogic();\n *\n * **AND NOT**\n *\n * if (!t.evaluateTruthy(node)) falsyLogic();\n *\n */\n\nexport function evaluateTruthy(this: NodePath): boolean {\n const res = this.evaluate();\n if (res.confident) return !!res.value;\n}\n\ntype State = {\n confident: boolean;\n deoptPath: NodePath | null;\n seen: Map<t.Node, Result>;\n};\n\ntype Result = {\n resolved: boolean;\n value?: any;\n};\n/**\n * Deopts the evaluation\n */\nfunction deopt(path: NodePath, state: State) {\n if (!state.confident) return;\n state.deoptPath = path;\n state.confident = false;\n}\n\nconst Globals = new Map([\n [\"undefined\", undefined],\n [\"Infinity\", Infinity],\n [\"NaN\", NaN],\n]);\n\n/**\n * We wrap the _evaluate method so we can track `seen` nodes, we push an item\n * to the map before we actually evaluate it so we can deopt on self recursive\n * nodes such as:\n *\n * var g = a ? 1 : 2,\n * a = g * this.foo\n */\nfunction evaluateCached(path: NodePath, state: State): any {\n const { node } = path;\n const { seen } = state;\n\n if (seen.has(node)) {\n const existing = seen.get(node);\n if (existing.resolved) {\n return existing.value;\n } else {\n deopt(path, state);\n return;\n }\n } else {\n const item: Result = { resolved: false };\n seen.set(node, item);\n\n const val = _evaluate(path, state);\n if (state.confident) {\n item.resolved = true;\n item.value = val;\n }\n return val;\n }\n}\n\nfunction _evaluate(path: NodePath, state: State): any {\n if (!state.confident) return;\n\n if (path.isSequenceExpression()) {\n const exprs = path.get(\"expressions\");\n return evaluateCached(exprs[exprs.length - 1], state);\n }\n\n if (\n path.isStringLiteral() ||\n path.isNumericLiteral() ||\n path.isBooleanLiteral()\n ) {\n return path.node.value;\n }\n\n if (path.isNullLiteral()) {\n return null;\n }\n\n if (path.isTemplateLiteral()) {\n return evaluateQuasis(path, path.node.quasis, state);\n }\n\n if (\n path.isTaggedTemplateExpression() &&\n path.get(\"tag\").isMemberExpression()\n ) {\n const object = path.get(\"tag.object\") as NodePath;\n const {\n // @ts-expect-error todo(flow->ts): possible bug, object is can be any expression and so name might be undefined\n node: { name },\n } = object;\n const property = path.get(\"tag.property\") as NodePath;\n\n if (\n object.isIdentifier() &&\n name === \"String\" &&\n // todo(flow->ts): was changed from getBinding(name, true)\n // should this be hasBinding(name, true) as the binding is never used later?\n !path.scope.getBinding(name) &&\n property.isIdentifier() &&\n property.node.name === \"raw\"\n ) {\n return evaluateQuasis(path, path.node.quasi.quasis, state, true);\n }\n }\n\n if (path.isConditionalExpression()) {\n const testResult = evaluateCached(path.get(\"test\"), state);\n if (!state.confident) return;\n if (testResult) {\n return evaluateCached(path.get(\"consequent\"), state);\n } else {\n return evaluateCached(path.get(\"alternate\"), state);\n }\n }\n\n if (path.isExpressionWrapper()) {\n // TypeCastExpression, ExpressionStatement etc\n return evaluateCached(path.get(\"expression\"), state);\n }\n\n // \"foo\".length, \"foo\"[0]\n if (\n path.isMemberExpression() &&\n !path.parentPath.isCallExpression({ callee: path.node })\n ) {\n const property = path.get(\"property\");\n const object = path.get(\"object\");\n\n if (object.isLiteral()) {\n // @ts-expect-error todo(flow->ts): instead of typeof - would it be better to check type of ast node?\n const value = object.node.value;\n const type = typeof value;\n\n let key = null;\n if (path.node.computed) {\n key = evaluateCached(property, state);\n if (!state.confident) return;\n } else if (property.isIdentifier()) {\n key = property.node.name;\n }\n if (\n (type === \"number\" || type === \"string\") &&\n key != null &&\n (typeof key === \"number\" || typeof key === \"string\")\n ) {\n return value[key];\n }\n }\n }\n\n if (path.isReferencedIdentifier()) {\n const binding = path.scope.getBinding(path.node.name);\n\n if (binding) {\n if (\n binding.constantViolations.length > 0 ||\n path.node.start < binding.path.node.end\n ) {\n deopt(binding.path, state);\n return;\n }\n if (binding.hasValue) {\n return binding.value;\n }\n }\n\n const name = path.node.name;\n if (Globals.has(name)) {\n if (!binding) {\n return Globals.get(name);\n }\n deopt(binding.path, state);\n return;\n }\n\n const resolved = path.resolve();\n if (resolved === path) {\n deopt(path, state);\n return;\n } else {\n return evaluateCached(resolved, state);\n }\n }\n\n if (path.isUnaryExpression({ prefix: true })) {\n if (path.node.operator === \"void\") {\n // we don't need to evaluate the argument to know what this will return\n return undefined;\n }\n\n const argument = path.get(\"argument\");\n if (\n path.node.operator === \"typeof\" &&\n (argument.isFunction() || argument.isClass())\n ) {\n return \"function\";\n }\n\n const arg = evaluateCached(argument, state);\n if (!state.confident) return;\n switch (path.node.operator) {\n case \"!\":\n return !arg;\n case \"+\":\n return +arg;\n case \"-\":\n return -arg;\n case \"~\":\n return ~arg;\n case \"typeof\":\n return typeof arg;\n }\n }\n\n if (path.isArrayExpression()) {\n const arr = [];\n const elems: Array<NodePath> = path.get(\"elements\");\n for (const elem of elems) {\n const elemValue = elem.evaluate();\n\n if (elemValue.confident) {\n arr.push(elemValue.value);\n } else {\n deopt(elemValue.deopt, state);\n return;\n }\n }\n return arr;\n }\n\n if (path.isObjectExpression()) {\n const obj = {};\n const props = path.get(\"properties\");\n for (const prop of props) {\n if (prop.isObjectMethod() || prop.isSpreadElement()) {\n deopt(prop, state);\n return;\n }\n const keyPath = prop.get(\"key\");\n let key;\n if (prop.node.computed) {\n key = keyPath.evaluate();\n if (!key.confident) {\n deopt(key.deopt, state);\n return;\n }\n key = key.value;\n } else if (keyPath.isIdentifier()) {\n key = keyPath.node.name;\n } else {\n key = (\n keyPath.node as t.StringLiteral | t.NumericLiteral | t.BigIntLiteral\n ).value;\n }\n const valuePath = prop.get(\"value\");\n let value = valuePath.evaluate();\n if (!value.confident) {\n deopt(value.deopt, state);\n return;\n }\n value = value.value;\n // @ts-expect-error key is any type\n obj[key] = value;\n }\n return obj;\n }\n\n if (path.isLogicalExpression()) {\n // If we are confident that the left side of an && is false, or the left\n // side of an || is true, we can be confident about the entire expression\n const wasConfident = state.confident;\n const left = evaluateCached(path.get(\"left\"), state);\n const leftConfident = state.confident;\n state.confident = wasConfident;\n const right = evaluateCached(path.get(\"right\"), state);\n const rightConfident = state.confident;\n\n switch (path.node.operator) {\n case \"||\":\n // TODO consider having a \"truthy type\" that doesn't bail on\n // left uncertainty but can still evaluate to truthy.\n state.confident = leftConfident && (!!left || rightConfident);\n if (!state.confident) return;\n\n return left || right;\n case \"&&\":\n state.confident = leftConfident && (!left || rightConfident);\n if (!state.confident) return;\n\n return left && right;\n case \"??\":\n state.confident = leftConfident && (left != null || rightConfident);\n if (!state.confident) return;\n\n return left ?? right;\n }\n }\n\n if (path.isBinaryExpression()) {\n const left = evaluateCached(path.get(\"left\"), state);\n if (!state.confident) return;\n const right = evaluateCached(path.get(\"right\"), state);\n if (!state.confident) return;\n\n switch (path.node.operator) {\n case \"-\":\n return left - right;\n case \"+\":\n return left + right;\n case \"/\":\n return left / right;\n case \"*\":\n return left * right;\n case \"%\":\n return left % right;\n case \"**\":\n return left ** right;\n case \"<\":\n return left < right;\n case \">\":\n return left > right;\n case \"<=\":\n return left <= right;\n case \">=\":\n return left >= right;\n case \"==\":\n return left == right; // eslint-disable-line eqeqeq\n case \"!=\":\n return left != right; // eslint-disable-line eqeqeq\n case \"===\":\n return left === right;\n case \"!==\":\n return left !== right;\n case \"|\":\n return left | right;\n case \"&\":\n return left & right;\n case \"^\":\n return left ^ right;\n case \"<<\":\n return left << right;\n case \">>\":\n return left >> right;\n case \">>>\":\n return left >>> right;\n }\n }\n\n if (path.isCallExpression()) {\n const callee = path.get(\"callee\");\n let context;\n let func;\n\n // Number(1);\n if (\n callee.isIdentifier() &&\n !path.scope.getBinding(callee.node.name) &&\n (isValidObjectCallee(callee.node.name) ||\n isValidIdentifierCallee(callee.node.name))\n ) {\n func = global[callee.node.name];\n }\n\n if (callee.isMemberExpression()) {\n const object = callee.get(\"object\");\n const property = callee.get(\"property\");\n\n // Math.min(1, 2)\n if (\n object.isIdentifier() &&\n property.isIdentifier() &&\n isValidObjectCallee(object.node.name) &&\n !isInvalidMethod(property.node.name)\n ) {\n context = global[object.node.name];\n const key = property.node.name;\n if (Object.hasOwn(context, key)) {\n func = context[key as keyof typeof context];\n }\n }\n\n // \"abc\".charCodeAt(4)\n if (object.isLiteral() && property.isIdentifier()) {\n // @ts-expect-error todo(flow->ts): consider checking ast node type instead of value type (StringLiteral and NumberLiteral)\n const type = typeof object.node.value;\n if (type === \"string\" || type === \"number\") {\n // @ts-expect-error todo(flow->ts): consider checking ast node type instead of value type\n context = object.node.value;\n func = context[property.node.name];\n }\n }\n }\n\n if (func) {\n const args = path.get(\"arguments\").map(arg => evaluateCached(arg, state));\n if (!state.confident) return;\n\n return func.apply(context, args);\n }\n }\n\n deopt(path, state);\n}\n\nfunction evaluateQuasis(\n path: NodePath<t.TaggedTemplateExpression | t.TemplateLiteral>,\n quasis: Array<any>,\n state: State,\n raw = false,\n) {\n let str = \"\";\n\n let i = 0;\n const exprs: Array<NodePath<t.Node>> = path.isTemplateLiteral()\n ? path.get(\"expressions\")\n : path.get(\"quasi.expressions\");\n\n for (const elem of quasis) {\n // not confident, evaluated an expression we don't like\n if (!state.confident) break;\n\n // add on element\n str += raw ? elem.value.raw : elem.value.cooked;\n\n // add on interpolated expression if it's present\n const expr = exprs[i++];\n if (expr) str += String(evaluateCached(expr, state));\n }\n\n if (!state.confident) return;\n return str;\n}\n\n/**\n * Walk the input `node` and statically evaluate it.\n *\n * Returns an object in the form `{ confident, value, deopt }`. `confident`\n * indicates whether or not we had to drop out of evaluating the expression\n * because of hitting an unknown node that we couldn't confidently find the\n * value of, in which case `deopt` is the path of said node.\n *\n * Example:\n *\n * t.evaluate(parse(\"5 + 5\")) // { confident: true, value: 10 }\n * t.evaluate(parse(\"!true\")) // { confident: true, value: false }\n * t.evaluate(parse(\"foo + foo\")) // { confident: false, value: undefined, deopt: NodePath }\n *\n */\n\nexport function evaluate(this: NodePath): {\n confident: boolean;\n value: any;\n deopt?: NodePath;\n} {\n const state: State = {\n confident: true,\n deoptPath: null,\n seen: new Map(),\n };\n let value = evaluateCached(this, state);\n if (!state.confident) value = undefined;\n\n return {\n confident: state.confident,\n deopt: state.deoptPath,\n value: value,\n };\n}\n"],"mappings":";;;;;;;AAKA,MAAMA,oBAAoB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU;AAClE,MAAMC,wBAAwB,GAAG,CAC/B,UAAU,EACV,OAAO,EACP,YAAY,EACZ,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,WAAW,EACX,oBAAoB,EACoB,IAAI,EACJ,IAAI,CACpC;AAEV,MAAMC,eAAe,GAAG,CAAC,QAAQ,CAAU;AAE3C,SAASC,mBAAmBA,CAC1BC,GAAW,EACmC;EAC9C,OAAOJ,oBAAoB,CAACK,QAAQ,CAElCD,GACF,CAAC;AACH;AAEA,SAASE,uBAAuBA,CAC9BF,GAAW,EACuC;EAClD,OAAOH,wBAAwB,CAACI,QAAQ,CAEtCD,GACF,CAAC;AACH;AAEA,SAASG,eAAeA,CAACH,GAAW,EAA2C;EAC7E,OAAOF,eAAe,CAACG,QAAQ,CAE7BD,GACF,CAAC;AACH;AAoBO,SAASI,cAAcA,CAAA,EAA0B;EACtD,MAAMC,GAAG,GAAG,IAAI,CAACC,QAAQ,CAAC,CAAC;EAC3B,IAAID,GAAG,CAACE,SAAS,EAAE,OAAO,CAAC,CAACF,GAAG,CAACG,KAAK;AACvC;AAeA,SAASC,KAAKA,CAACC,IAAc,EAAEC,KAAY,EAAE;EAC3C,IAAI,CAAC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G5B,IAAI,CAAClE,KAAK,CAACiG,MAAM;IAG/C,MAAMC,IAAI,GAAG7E,KAAK,CAAC2E,CAAC,EAAE,CAAC;IACvB,IAAIE,IAAI,EAAEH,GAAG,IAAII,MAAM,CAACzF,cAAc,CAACwF,IAAI,EAAE/F,KAAK,CAAC,CAAC;EACtD;EAEA,IAAI,CAACA,KAAK,CAACJ,SAAS,EAAE;EACtB,OAAOgG,GAAG;AACZ;AAkBO,SAASjG,QAAQA,CAAA,EAItB;EACA,MAAMK,KAAY,GAAG;IACnBJ,SAAS,EAAE,IAAI;IACfK,SAAS,EAAE,IAAI;IACfQ,IAAI,EAAE,IAAIN,GAAG,CAAC;EAChB,CAAC;EACD,IAAIN,KAAK,GAAGU,cAAc,CAAC,IAAI,EAAEP,KAAK,CAAC;EACvC,IAAI,CAACA,KAAK,CAACJ,SAAS,EAAEC,KAAK,GAAGO,SAAS;EAEvC,OAAO;IACLR,SAAS,EAAEI,KAAK,CAACJ,SAAS;IAC1BE,KAAK,EAAEE,KAAK,CAACC,SAAS;IACtBJ,KAAK,EAAEA;EACT,CAAC;AACH","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_t","require","_t2","react","cloneNode","jsxExpressionContainer","variableDeclaration","variableDeclarator","referenceVisitor","ReferencedIdentifier","path","state","isJSXIdentifier","isCompatTag","node","name","parentPath","isJSXMemberExpression","scope","isFunction","isArrowFunctionExpression","parent","breakOnScopePaths","push","binding","getBinding","violation","constantViolations","mutableBinding","stop","bindings","PathHoister","constructor","scopes","attachAfter","isCompatibleScope","key","Object","keys","bindingIdentifierEquals","identifier","getCompatibleScopes","includes","getAttachmentPath","_getAttachmentPath","targetScope","isProgram","hasOwnBinding","kind","parentKey","bindingParentPath","getAttachmentParentForPath","violationPath","pop","hasOwnParamBindings","bodies","get","i","length","_blockHoist","getNextScopeAttachmentParent","Array","isArray","container","isStatement","constant","run","traverse","attachTo","getFunctionParent","uid","generateUidIdentifier","declarator","insertFn","attached","isVariableDeclarator","isJSXElement","children","replaceWith","exports","default"],"sources":["../../../src/path/lib/hoister.ts"],"sourcesContent":["// TODO: Remove this file in Babel 8\n\nimport { react } from \"@babel/types\";\nimport {\n cloneNode,\n jsxExpressionContainer,\n variableDeclaration,\n variableDeclarator,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type Scope from \"../../scope/index.ts\";\nimport type NodePath from \"../index.ts\";\nimport type Binding from \"../../scope/binding.ts\";\nimport type { Visitor } from \"../../types.ts\";\n\nconst referenceVisitor: Visitor<PathHoister> = {\n // This visitor looks for bindings to establish a topmost scope for hoisting.\n ReferencedIdentifier(path, state) {\n // Don't hoist regular JSX identifiers ('div', 'span', etc).\n // We do have to consider member expressions for hoisting (e.g. `this.component`)\n if (\n path.isJSXIdentifier() &&\n react.isCompatTag(path.node.name) &&\n !path.parentPath.isJSXMemberExpression()\n ) {\n return;\n }\n\n // If the identifier refers to `this`, we need to break on the closest non-arrow scope.\n if (path.node.name === \"this\") {\n let scope = path.scope;\n do {\n if (\n scope.path.isFunction() &&\n !scope.path.isArrowFunctionExpression()\n ) {\n break;\n }\n } while ((scope = scope.parent));\n if (scope) state.breakOnScopePaths.push(scope.path);\n }\n\n // direct references that we need to track to hoist this to the highest scope we can\n const binding = path.scope.getBinding(path.node.name);\n if (!binding) return;\n\n // we can handle reassignments only if they happen in the same scope as the declaration\n for (const violation of binding.constantViolations) {\n if (violation.scope !== binding.path.scope) {\n state.mutableBinding = true;\n path.stop();\n return;\n }\n }\n\n // this binding isn't accessible from the parent scope so we can safely ignore it\n // eg. it's in a closure etc\n if (binding !== state.scope.getBinding(path.node.name)) return;\n\n state.bindings[path.node.name] = binding;\n },\n};\n\nexport default class PathHoister<T extends t.Node = t.Node> {\n breakOnScopePaths: NodePath[];\n bindings: { [k: string]: Binding };\n mutableBinding: boolean;\n private scopes: Scope[];\n scope: Scope;\n private path: NodePath<T>;\n private attachAfter: boolean;\n\n constructor(path: NodePath<T>, scope: Scope) {\n // Storage for scopes we can't hoist above.\n this.breakOnScopePaths = [];\n // Storage for bindings that may affect what path we can hoist to.\n this.bindings = {};\n // \"true\" if the current path contains a reference to a binding whose\n // value can change and thus can't be safely hoisted.\n this.mutableBinding = false;\n // Storage for eligible scopes.\n this.scopes = [];\n // Our original scope and path.\n this.scope = scope;\n this.path = path;\n // By default, we attach as far up as we can; but if we're trying\n // to avoid referencing a binding, we may have to go after.\n this.attachAfter = false;\n }\n\n // A scope is compatible if all required bindings are reachable.\n isCompatibleScope(scope: Scope) {\n for (const key of Object.keys(this.bindings)) {\n const binding = this.bindings[key];\n if (!scope.bindingIdentifierEquals(key, binding.identifier)) {\n return false;\n }\n }\n\n return true;\n }\n\n // Look through all scopes and push compatible ones.\n getCompatibleScopes() {\n let scope = this.path.scope;\n do {\n if (this.isCompatibleScope(scope)) {\n this.scopes.push(scope);\n } else {\n break;\n }\n\n // deopt: These scopes are set in the visitor on const violations\n if (this.breakOnScopePaths.includes(scope.path)) {\n break;\n }\n } while ((scope = scope.parent));\n }\n\n getAttachmentPath() {\n let path = this._getAttachmentPath();\n if (!path) return;\n\n let targetScope = path.scope;\n\n // don't allow paths that have their own lexical environments to pollute\n if (targetScope.path === path) {\n targetScope = path.scope.parent;\n }\n\n // avoid hoisting to a scope that contains bindings that are executed after our attachment path\n if (targetScope.path.isProgram() || targetScope.path.isFunction()) {\n for (const name of Object.keys(this.bindings)) {\n // check binding is a direct child of this paths scope\n if (!targetScope.hasOwnBinding(name)) continue;\n\n const binding = this.bindings[name];\n\n // allow parameter references and expressions in params (like destructuring rest)\n if (binding.kind === \"param\" || binding.path.parentKey === \"params\") {\n continue;\n }\n\n // For each binding, get its attachment parent. This gives us an idea of where we might\n // introduce conflicts.\n const bindingParentPath = this.getAttachmentParentForPath(binding.path);\n\n // If the binding's attachment appears at or after our attachment point, then we move after it.\n if (bindingParentPath.key >= path.key) {\n this.attachAfter = true;\n path = binding.path;\n\n // We also move past any constant violations.\n for (const violationPath of binding.constantViolations) {\n if (this.getAttachmentParentForPath(violationPath).key > path.key) {\n path = violationPath;\n }\n }\n }\n }\n }\n\n return path;\n }\n\n _getAttachmentPath() {\n const scopes = this.scopes;\n\n const scope = scopes.pop();\n // deopt: no compatible scopes\n if (!scope) return;\n\n if (scope.path.isFunction()) {\n if (this.hasOwnParamBindings(scope)) {\n // deopt: should ignore this scope since it's ourselves\n if (this.scope === scope) return;\n\n // needs to be attached to the body\n const bodies = scope.path.get(\"body\").get(\"body\") as NodePath[];\n for (let i = 0; i < bodies.length; i++) {\n // Don't attach to something that's going to get hoisted,\n // like a default parameter\n // @ts-expect-error todo(flow->ts): avoid mutating the node, introducing new fields\n if (bodies[i].node._blockHoist) continue;\n return bodies[i];\n }\n // deopt: If here, no attachment path found\n } else {\n // doesn't need to be be attached to this scope\n return this.getNextScopeAttachmentParent();\n }\n } else if (scope.path.isProgram()) {\n return this.getNextScopeAttachmentParent();\n }\n }\n\n getNextScopeAttachmentParent() {\n const scope = this.scopes.pop();\n if (scope) return this.getAttachmentParentForPath(scope.path);\n }\n\n // Find an attachment for this path.\n getAttachmentParentForPath(path: NodePath) {\n do {\n if (\n // Beginning of the scope\n !path.parentPath ||\n // Has siblings and is a statement\n (Array.isArray(path.container) && path.isStatement())\n ) {\n return path;\n }\n } while ((path = path.parentPath));\n }\n\n // Returns true if a scope has param bindings.\n hasOwnParamBindings(scope: Scope) {\n for (const name of Object.keys(this.bindings)) {\n if (!scope.hasOwnBinding(name)) continue;\n\n const binding = this.bindings[name];\n // Ensure constant; without it we could place behind a reassignment\n if (binding.kind === \"param\" && binding.constant) return true;\n }\n return false;\n }\n\n run(): NodePath<t.Expression> | undefined {\n this.path.traverse(referenceVisitor, this);\n\n if (this.mutableBinding) return;\n\n this.getCompatibleScopes();\n\n const attachTo = this.getAttachmentPath();\n if (!attachTo) return;\n\n // don't bother hoisting to the same function as this will cause multiple branches to be\n // evaluated more than once leading to a bad optimisation\n if (attachTo.getFunctionParent() === this.path.getFunctionParent()) return;\n\n // generate declaration and insert it to our point\n let uid: t.Identifier | t.JSXExpressionContainer =\n attachTo.scope.generateUidIdentifier(\"ref\");\n\n // @ts-expect-error todo(flow->ts): more specific type for this.path\n const declarator = variableDeclarator(uid, this.path.node);\n\n const insertFn = this.attachAfter ? \"insertAfter\" : \"insertBefore\";\n const [attached] = attachTo[insertFn]([\n attachTo.isVariableDeclarator()\n ? declarator\n : variableDeclaration(\"var\", [declarator]),\n ]);\n\n const parent = this.path.parentPath;\n if (parent.isJSXElement() && this.path.container === parent.node.children) {\n // turning the `span` in `<div><span /></div>` to an expression so we need to wrap it with\n // an expression container\n uid = jsxExpressionContainer(uid);\n }\n\n this.path.replaceWith(cloneNode(uid));\n\n // @ts-expect-error TS cannot refine the type of `attached`\n // TODO: Should we use `attached.isVariableDeclaration()`?\n return attachTo.isVariableDeclarator()\n ? attached.get(\"init\")\n : attached.get(\"declarations.0.init\");\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,EAAA,GAAAC,OAAA;AAAqC,IAAAC,GAAA,GAAAF,EAAA;AAAA;EAA5BG;AAAK,IAAAH,EAAA;AAAA;EAEZI,SAAS;EACTC,sBAAsB;EACtBC,mBAAmB;EACnBC;AAAkB,IAAAL,GAAA;AAQpB,MAAMM,gBAAsC,GAAG;EAE7CC,oBAAoBA,CAACC,IAAI,EAAEC,KAAK,EAAE;IAGhC,IACED,IAAI,CAACE,eAAe,CAAC,CAAC,IACtBT,KAAK,CAACU,WAAW,CAACH,IAAI,CAACI,IAAI,CAACC,IAAI,CAAC,IACjC,CAACL,IAAI,CAACM,UAAU,CAACC,qBAAqB,CAAC,CAAC,EACxC;MACA;IACF;IAGA,IAAIP,IAAI,CAACI,IAAI,CAACC,IAAI,KAAK,MAAM,EAAE;MAC7B,IAAIG,KAAK,GAAGR,IAAI,CAACQ,KAAK;MACtB,GAAG;QACD,IACEA,KAAK,CAACR,IAAI,CAACS,UAAU,CAAC,CAAC,IACvB,CAACD,KAAK,CAACR,IAAI,CAACU,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qBAAqB,CAAC;EACzC;AACF;AAACuB,OAAA,CAAAC,OAAA,GAAAjD,WAAA","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_t","require","_t2","react","cloneNode","jsxExpressionContainer","variableDeclaration","variableDeclarator","referenceVisitor","ReferencedIdentifier","path","state","isJSXIdentifier","isCompatTag","node","name","parentPath","isJSXMemberExpression","scope","isFunction","isArrowFunctionExpression","parent","breakOnScopePaths","push","binding","getBinding","violation","constantViolations","mutableBinding","stop","bindings","PathHoister","constructor","scopes","attachAfter","isCompatibleScope","key","Object","keys","bindingIdentifierEquals","identifier","getCompatibleScopes","includes","getAttachmentPath","_getAttachmentPath","targetScope","isProgram","hasOwnBinding","kind","parentKey","bindingParentPath","getAttachmentParentForPath","violationPath","pop","hasOwnParamBindings","bodies","get","i","length","_blockHoist","getNextScopeAttachmentParent","Array","isArray","container","isStatement","constant","run","traverse","attachTo","getFunctionParent","uid","generateUidIdentifier","declarator","insertFn","attached","isVariableDeclarator","isJSXElement","children","replaceWith","exports","default"],"sources":["../../../src/path/lib/hoister.ts"],"sourcesContent":["// Remove this file in Babel 8\n\nimport { react } from \"@babel/types\";\nimport {\n cloneNode,\n jsxExpressionContainer,\n variableDeclaration,\n variableDeclarator,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type Scope from \"../../scope/index.ts\";\nimport type NodePath from \"../index.ts\";\nimport type Binding from \"../../scope/binding.ts\";\nimport type { Visitor } from \"../../types.ts\";\n\nconst referenceVisitor: Visitor<PathHoister> = {\n // This visitor looks for bindings to establish a topmost scope for hoisting.\n ReferencedIdentifier(path, state) {\n // Don't hoist regular JSX identifiers ('div', 'span', etc).\n // We do have to consider member expressions for hoisting (e.g. `this.component`)\n if (\n path.isJSXIdentifier() &&\n react.isCompatTag(path.node.name) &&\n !path.parentPath.isJSXMemberExpression()\n ) {\n return;\n }\n\n // If the identifier refers to `this`, we need to break on the closest non-arrow scope.\n if (path.node.name === \"this\") {\n let scope = path.scope;\n do {\n if (\n scope.path.isFunction() &&\n !scope.path.isArrowFunctionExpression()\n ) {\n break;\n }\n } while ((scope = scope.parent));\n if (scope) state.breakOnScopePaths.push(scope.path);\n }\n\n // direct references that we need to track to hoist this to the highest scope we can\n const binding = path.scope.getBinding(path.node.name);\n if (!binding) return;\n\n // we can handle reassignments only if they happen in the same scope as the declaration\n for (const violation of binding.constantViolations) {\n if (violation.scope !== binding.path.scope) {\n state.mutableBinding = true;\n path.stop();\n return;\n }\n }\n\n // this binding isn't accessible from the parent scope so we can safely ignore it\n // eg. it's in a closure etc\n if (binding !== state.scope.getBinding(path.node.name)) return;\n\n state.bindings[path.node.name] = binding;\n },\n};\n\nexport default class PathHoister<T extends t.Node = t.Node> {\n breakOnScopePaths: NodePath[];\n bindings: { [k: string]: Binding };\n mutableBinding: boolean;\n private scopes: Scope[];\n scope: Scope;\n private path: NodePath<T>;\n private attachAfter: boolean;\n\n constructor(path: NodePath<T>, scope: Scope) {\n // Storage for scopes we can't hoist above.\n this.breakOnScopePaths = [];\n // Storage for bindings that may affect what path we can hoist to.\n this.bindings = {};\n // \"true\" if the current path contains a reference to a binding whose\n // value can change and thus can't be safely hoisted.\n this.mutableBinding = false;\n // Storage for eligible scopes.\n this.scopes = [];\n // Our original scope and path.\n this.scope = scope;\n this.path = path;\n // By default, we attach as far up as we can; but if we're trying\n // to avoid referencing a binding, we may have to go after.\n this.attachAfter = false;\n }\n\n // A scope is compatible if all required bindings are reachable.\n isCompatibleScope(scope: Scope) {\n for (const key of Object.keys(this.bindings)) {\n const binding = this.bindings[key];\n if (!scope.bindingIdentifierEquals(key, binding.identifier)) {\n return false;\n }\n }\n\n return true;\n }\n\n // Look through all scopes and push compatible ones.\n getCompatibleScopes() {\n let scope = this.path.scope;\n do {\n if (this.isCompatibleScope(scope)) {\n this.scopes.push(scope);\n } else {\n break;\n }\n\n // deopt: These scopes are set in the visitor on const violations\n if (this.breakOnScopePaths.includes(scope.path)) {\n break;\n }\n } while ((scope = scope.parent));\n }\n\n getAttachmentPath() {\n let path = this._getAttachmentPath();\n if (!path) return;\n\n let targetScope = path.scope;\n\n // don't allow paths that have their own lexical environments to pollute\n if (targetScope.path === path) {\n targetScope = path.scope.parent;\n }\n\n // avoid hoisting to a scope that contains bindings that are executed after our attachment path\n if (targetScope.path.isProgram() || targetScope.path.isFunction()) {\n for (const name of Object.keys(this.bindings)) {\n // check binding is a direct child of this paths scope\n if (!targetScope.hasOwnBinding(name)) continue;\n\n const binding = this.bindings[name];\n\n // allow parameter references and expressions in params (like destructuring rest)\n if (binding.kind === \"param\" || binding.path.parentKey === \"params\") {\n continue;\n }\n\n // For each binding, get its attachment parent. This gives us an idea of where we might\n // introduce conflicts.\n const bindingParentPath = this.getAttachmentParentForPath(binding.path);\n\n // If the binding's attachment appears at or after our attachment point, then we move after it.\n if (bindingParentPath.key >= path.key) {\n this.attachAfter = true;\n path = binding.path;\n\n // We also move past any constant violations.\n for (const violationPath of binding.constantViolations) {\n if (this.getAttachmentParentForPath(violationPath).key > path.key) {\n path = violationPath;\n }\n }\n }\n }\n }\n\n return path;\n }\n\n _getAttachmentPath() {\n const scopes = this.scopes;\n\n const scope = scopes.pop();\n // deopt: no compatible scopes\n if (!scope) return;\n\n if (scope.path.isFunction()) {\n if (this.hasOwnParamBindings(scope)) {\n // deopt: should ignore this scope since it's ourselves\n if (this.scope === scope) return;\n\n // needs to be attached to the body\n const bodies = scope.path.get(\"body\").get(\"body\") as NodePath[];\n for (let i = 0; i < bodies.length; i++) {\n // Don't attach to something that's going to get hoisted,\n // like a default parameter\n // @ts-expect-error todo(flow->ts): avoid mutating the node, introducing new fields\n if (bodies[i].node._blockHoist) continue;\n return bodies[i];\n }\n // deopt: If here, no attachment path found\n } else {\n // doesn't need to be be attached to this scope\n return this.getNextScopeAttachmentParent();\n }\n } else if (scope.path.isProgram()) {\n return this.getNextScopeAttachmentParent();\n }\n }\n\n getNextScopeAttachmentParent() {\n const scope = this.scopes.pop();\n if (scope) return this.getAttachmentParentForPath(scope.path);\n }\n\n // Find an attachment for this path.\n getAttachmentParentForPath(path: NodePath) {\n do {\n if (\n // Beginning of the scope\n !path.parentPath ||\n // Has siblings and is a statement\n (Array.isArray(path.container) && path.isStatement())\n ) {\n return path;\n }\n } while ((path = path.parentPath));\n }\n\n // Returns true if a scope has param bindings.\n hasOwnParamBindings(scope: Scope) {\n for (const name of Object.keys(this.bindings)) {\n if (!scope.hasOwnBinding(name)) continue;\n\n const binding = this.bindings[name];\n // Ensure constant; without it we could place behind a reassignment\n if (binding.kind === \"param\" && binding.constant) return true;\n }\n return false;\n }\n\n run(): NodePath<t.Expression> | undefined {\n this.path.traverse(referenceVisitor, this);\n\n if (this.mutableBinding) return;\n\n this.getCompatibleScopes();\n\n const attachTo = this.getAttachmentPath();\n if (!attachTo) return;\n\n // don't bother hoisting to the same function as this will cause multiple branches to be\n // evaluated more than once leading to a bad optimisation\n if (attachTo.getFunctionParent() === this.path.getFunctionParent()) return;\n\n // generate declaration and insert it to our point\n let uid: t.Identifier | t.JSXExpressionContainer =\n attachTo.scope.generateUidIdentifier(\"ref\");\n\n // @ts-expect-error todo(flow->ts): more specific type for this.path\n const declarator = variableDeclarator(uid, this.path.node);\n\n const insertFn = this.attachAfter ? \"insertAfter\" : \"insertBefore\";\n const [attached] = attachTo[insertFn]([\n attachTo.isVariableDeclarator()\n ? declarator\n : variableDeclaration(\"var\", [declarator]),\n ]);\n\n const parent = this.path.parentPath;\n if (parent.isJSXElement() && this.path.container === parent.node.children) {\n // turning the `span` in `<div><span /></div>` to an expression so we need to wrap it with\n // an expression container\n uid = jsxExpressionContainer(uid);\n }\n\n this.path.replaceWith(cloneNode(uid));\n\n // @ts-expect-error TS cannot refine the type of `attached`\n // TODO: Should we use `attached.isVariableDeclaration()`?\n return attachTo.isVariableDeclarator()\n ? attached.get(\"init\")\n : attached.get(\"declarations.0.init\");\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,EAAA,GAAAC,OAAA;AAAqC,IAAAC,GAAA,GAAA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C,CAAC,CACpCL,QAAQ,CAACO,oBAAoB,CAAC,CAAC,GAC3BH,UAAU,GACVlE,mBAAmB,CAAC,KAAK,EAAE,CAACkE,UAAU,CAAC,CAAC,CAC7C,CAAC;IAEF,MAAMnD,MAAM,GAAG,IAAI,CAACX,IAAI,CAACM,UAAU;IACnC,IAAIK,MAAM,CAACuD,YAAY,CAAC,CAAC,IAAI,IAAI,CAAClE,IAAI,CAACqD,SAAS,KAAK1C,MAAM,CAACP,IAAI,CAAC+D,QAAQ,EAAE;MAGzEP,GAAG,GAAGjE,sBAAsB,CAACiE,GAAG,CAAC;IACnC;IAEA,IAAI,CAAC5D,IAAI,CAACoE,WAAW,CAAC1E,SAAS,CAACkE,GAAG,CAAC,CAAC;IAIrC,OAAOF,QAAQ,CAACO,oBAAoB,CAAC,CAAC,GAClCD,QAAQ,CAAClB,GAAG,CAAC,MAAM,CAAC,GACpBkB,QAAQ,CAAClB,GAAG,CAAC,qBAAqB,CAAC;EACzC;AACF;AAACuB,OAAA,CAAAC,OAAA,GAAAjD,WAAA","ignoreList":[]}
|
@@ -13,11 +13,11 @@ exports.pushContainer = pushContainer;
|
|
13
13
|
exports.unshiftContainer = unshiftContainer;
|
14
14
|
exports.updateSiblingKeys = updateSiblingKeys;
|
15
15
|
var _cache = require("../cache.js");
|
16
|
+
var _hoister = require("./lib/hoister.js");
|
16
17
|
var _index = require("./index.js");
|
17
18
|
var _context = require("./context.js");
|
18
19
|
var _removal = require("./removal.js");
|
19
20
|
var _t = require("@babel/types");
|
20
|
-
var _hoister = require("./lib/hoister.js");
|
21
21
|
const {
|
22
22
|
arrowFunctionExpression,
|
23
23
|
assertExpression,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_cache","require","_index","_context","_removal","_t","_hoister","arrowFunctionExpression","assertExpression","assignmentExpression","blockStatement","callExpression","cloneNode","expressionStatement","isAssignmentExpression","isCallExpression","isExportNamedDeclaration","isExpression","isIdentifier","isSequenceExpression","isSuper","thisExpression","insertBefore","nodes_","_assertUnremoved","call","nodes","_verifyNodeList","parentPath","parent","isExpressionStatement","isLabeledStatement","isExportDefaultDeclaration","isDeclaration","isNodeType","isJSXElement","isForStatement","key","node","push","replaceExpressionWithStatements","Array","isArray","container","_containerInsertBefore","isStatementOrBlock","shouldInsertCurrentNode","expression","replaceWith","unshiftContainer","Error","_containerInsert","from","updateSiblingKeys","length","paths","splice","i","_this$context","to","path","getSibling","context","queue","pushContext","contexts","_getQueueContexts","setScope","debug","maybeQueue","_containerInsertAfter","last","arr","isHiddenInSequenceExpression","expressions","isAlmostConstantAssignment","scope","left","blockScope","getBlockParent","hasOwnBinding","name","getOwnBinding","constantViolations","insertAfter","get","map","self","isPattern","unshift","callee","isPure","isMethod","computed","temp","generateDeclaredUidIdentifier","pushContainer","fromIndex","incrementBy","getCachedPaths","hub","msg","type","NodePath","listKey","setContext","verifiedNodes","replaceWithMultiple","exports","hoist","hoister","PathHoister","run"],"sources":["../../src/path/modification.ts"],"sourcesContent":["// This file contains methods that modify the path/node in some ways.\n\nimport { getCachedPaths } from \"../cache.ts\";\nimport NodePath from \"./index.ts\";\nimport { _getQueueContexts, pushContext, setScope } from \"./context.ts\";\nimport { _assertUnremoved } from \"./removal.ts\";\nimport {\n arrowFunctionExpression,\n assertExpression,\n assignmentExpression,\n blockStatement,\n callExpression,\n cloneNode,\n expressionStatement,\n isAssignmentExpression,\n isCallExpression,\n isExportNamedDeclaration,\n isExpression,\n isIdentifier,\n isSequenceExpression,\n isSuper,\n thisExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type Scope from \"../scope/index.ts\";\n\n/**\n * Insert the provided nodes before the current one.\n */\n\nexport function insertBefore(\n this: NodePath,\n nodes_: t.Node | t.Node[],\n): NodePath[] {\n _assertUnremoved.call(this);\n\n const nodes = _verifyNodeList.call(this, nodes_);\n\n const { parentPath, parent } = this;\n\n if (\n parentPath.isExpressionStatement() ||\n parentPath.isLabeledStatement() ||\n // https://github.com/babel/babel/issues/15293\n // When Babel transforms `export class String { field }`, the class properties plugin will inject the defineProperty\n // helper, which depends on the builtins e.g. String, Number, Symbol, etc. To prevent them from being shadowed by local\n // exports, the helper injector replaces the named export into `class _String { field }; export { _String as String }`,\n // with `parentPath` here changed to the moved ClassDeclaration, causing rare inconsistency between `parent` and `parentPath`.\n // Here we retrieve the parent type from the `parent` property. This is a temporary fix and we should revisit when\n // helpers should get injected.\n isExportNamedDeclaration(parent) ||\n (parentPath.isExportDefaultDeclaration() && this.isDeclaration())\n ) {\n return parentPath.insertBefore(nodes);\n } else if (\n (this.isNodeType(\"Expression\") && !this.isJSXElement()) ||\n (parentPath.isForStatement() && this.key === \"init\")\n ) {\n if (this.node) nodes.push(this.node);\n // @ts-expect-error todo(flow->ts): check that nodes is an array of statements\n return this.replaceExpressionWithStatements(nodes);\n } else if (Array.isArray(this.container)) {\n return _containerInsertBefore.call(this, nodes);\n } else if (this.isStatementOrBlock()) {\n const node = this.node as t.Statement;\n const shouldInsertCurrentNode =\n node &&\n (!this.isExpressionStatement() ||\n (node as t.ExpressionStatement).expression != null);\n\n this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : []));\n return (this as NodePath<t.BlockStatement>).unshiftContainer(\n \"body\",\n // @ts-expect-error Fixme: refine nodes to t.BlockStatement[\"body\"] when this is a BlockStatement path\n nodes,\n );\n } else {\n throw new Error(\n \"We don't know what to do with this node type. \" +\n \"We were previously a Statement but we can't fit in here?\",\n );\n }\n}\n\nexport function _containerInsert<N extends t.Node>(\n this: NodePath,\n from: number,\n nodes: N[],\n): NodePath<N>[] {\n updateSiblingKeys.call(this, from, nodes.length);\n\n const paths: NodePath<N>[] = [];\n\n // @ts-expect-error todo(flow->ts): this.container could be a NodePath\n this.container.splice(from, 0, ...nodes);\n for (let i = 0; i < nodes.length; i++) {\n const to = from + i;\n const path = this.getSibling(to) as NodePath<N>;\n paths.push(path);\n\n if (this.context?.queue) {\n pushContext.call(path, this.context);\n }\n }\n\n const contexts = _getQueueContexts.call(this);\n\n for (const path of paths) {\n setScope.call(path);\n path.debug(\"Inserted.\");\n\n for (const context of contexts) {\n context.maybeQueue(path, true);\n }\n }\n\n return paths;\n}\n\nexport function _containerInsertBefore<N extends t.Node>(\n this: NodePath,\n nodes: N[],\n) {\n return _containerInsert.call(this, this.key as number, nodes);\n}\n\nexport function _containerInsertAfter<N extends t.Node>(\n this: NodePath,\n nodes: N[],\n) {\n return _containerInsert.call(this, (this.key as number) + 1, nodes);\n}\n\nconst last = <T>(arr: T[]) => arr[arr.length - 1];\n\nfunction isHiddenInSequenceExpression(path: NodePath): boolean {\n return (\n isSequenceExpression(path.parent) &&\n (last(path.parent.expressions) !== path.node ||\n isHiddenInSequenceExpression(path.parentPath))\n );\n}\n\nfunction isAlmostConstantAssignment(\n node: t.Node,\n scope: Scope,\n): node is t.AssignmentExpression & { left: t.Identifier } {\n if (!isAssignmentExpression(node) || !isIdentifier(node.left)) {\n return false;\n }\n\n // Not every scope can contain variables. For example, we might be in\n // a ClassScope either in the ClassHeritage or in a computed key.\n const blockScope = scope.getBlockParent();\n\n // If the variable is defined in the current scope and only assigned here,\n // we can be sure that its value won't change.\n return (\n blockScope.hasOwnBinding(node.left.name) &&\n blockScope.getOwnBinding(node.left.name).constantViolations.length <= 1\n );\n}\n\n/**\n * Insert the provided nodes after the current one. When inserting nodes after an\n * expression, ensure that the completion record is correct by pushing the current node.\n */\n\nexport function insertAfter(\n this: NodePath,\n nodes_: t.Node | t.Node[],\n): NodePath[] {\n _assertUnremoved.call(this);\n\n if (this.isSequenceExpression()) {\n return last(this.get(\"expressions\")).insertAfter(nodes_);\n }\n\n const nodes = _verifyNodeList.call(this, nodes_);\n\n const { parentPath, parent } = this;\n if (\n parentPath.isExpressionStatement() ||\n parentPath.isLabeledStatement() ||\n // see insertBefore\n isExportNamedDeclaration(parent) ||\n (parentPath.isExportDefaultDeclaration() && this.isDeclaration())\n ) {\n return parentPath.insertAfter(\n nodes.map(node => {\n // Usually after an expression we can safely insert another expression:\n // A.insertAfter(B)\n // foo = A; -> foo = (A, B);\n // If A is an expression statement, it isn't safe anymore so we need to\n // convert B to an expression statement\n // A; -> A; B // No semicolon! It could break if followed by [!\n return isExpression(node) ? expressionStatement(node) : node;\n }),\n );\n } else if (\n (this.isNodeType(\"Expression\") &&\n !this.isJSXElement() &&\n !parentPath.isJSXElement()) ||\n (parentPath.isForStatement() && this.key === \"init\")\n ) {\n const self = this as NodePath<t.Expression | t.VariableDeclaration>;\n if (self.node) {\n const node = self.node;\n let { scope } = this;\n\n if (scope.path.isPattern()) {\n assertExpression(node);\n\n self.replaceWith(callExpression(arrowFunctionExpression([], node), []));\n (self.get(\"callee.body\") as NodePath<t.Expression>).insertAfter(nodes);\n return [self];\n }\n\n if (isHiddenInSequenceExpression(self)) {\n nodes.unshift(node);\n }\n // We need to preserve the value of this expression.\n else if (isCallExpression(node) && isSuper(node.callee)) {\n nodes.unshift(node);\n // `super(...)` always evaluates to `this`.\n nodes.push(thisExpression());\n } else if (isAlmostConstantAssignment(node, scope)) {\n nodes.unshift(node);\n nodes.push(cloneNode(node.left));\n } else if (scope.isPure(node, true)) {\n // Insert the nodes before rather than after; it's not observable.\n nodes.push(node);\n } else {\n // Inserting after the computed key of a method should insert the\n // temporary binding in the method's parent's scope.\n if (parentPath.isMethod({ computed: true, key: node })) {\n scope = scope.parent;\n }\n const temp = scope.generateDeclaredUidIdentifier();\n nodes.unshift(\n expressionStatement(\n // @ts-expect-error todo(flow->ts): This can be a variable\n // declaration in the \"init\" of a for statement, but that's\n // invalid here.\n assignmentExpression(\"=\", cloneNode(temp), node),\n ),\n );\n nodes.push(expressionStatement(cloneNode(temp)));\n }\n }\n // @ts-expect-error todo(flow->ts): check that nodes is an array of statements\n return this.replaceExpressionWithStatements(nodes);\n } else if (Array.isArray(this.container)) {\n return _containerInsertAfter.call(this, nodes);\n } else if (this.isStatementOrBlock()) {\n const node = this.node as t.Statement;\n const shouldInsertCurrentNode =\n node &&\n (!this.isExpressionStatement() ||\n (node as t.ExpressionStatement).expression != null);\n\n this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : []));\n // @ts-expect-error Fixme: refine nodes to t.BlockStatement[\"body\"] when this is a BlockStatement path\n return this.pushContainer(\"body\", nodes);\n } else {\n throw new Error(\n \"We don't know what to do with this node type. \" +\n \"We were previously a Statement but we can't fit in here?\",\n );\n }\n}\n\n/**\n * Update all sibling node paths after `fromIndex` by `incrementBy`.\n */\n\nexport function updateSiblingKeys(\n this: NodePath,\n fromIndex: number,\n incrementBy: number,\n) {\n if (!this.parent) return;\n\n const paths = getCachedPaths(this.hub, this.parent) || ([] as never[]);\n\n for (const [, path] of paths) {\n if (\n typeof path.key === \"number\" &&\n path.container === this.container &&\n path.key >= fromIndex\n ) {\n path.key += incrementBy;\n }\n }\n}\n\nexport function _verifyNodeList<N extends t.Node>(\n this: NodePath,\n nodes: N | N[],\n): N[] {\n if (!nodes) {\n return [];\n }\n\n if (!Array.isArray(nodes)) {\n nodes = [nodes];\n }\n\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n let msg;\n\n if (!node) {\n msg = \"has falsy node\";\n } else if (typeof node !== \"object\") {\n msg = \"contains a non-object node\";\n } else if (!node.type) {\n msg = \"without a type\";\n } else if (node instanceof NodePath) {\n msg = \"has a NodePath when it expected a raw object\";\n }\n\n if (msg) {\n const type = Array.isArray(node) ? \"array\" : typeof node;\n throw new Error(\n `Node list ${msg} with the index of ${i} and type of ${type}`,\n );\n }\n }\n\n return nodes;\n}\n\nexport function unshiftContainer<N extends t.Node, K extends keyof N & string>(\n this: NodePath<N>,\n listKey: K,\n nodes: N[K] extends (infer E)[]\n ? E | E[]\n : // todo: refine to t.Node[]\n // ? E extends t.Node\n // ? E | E[]\n // : never\n never,\n) {\n // todo: NodePaths<Nodes>\n _assertUnremoved.call(this);\n\n // @ts-expect-error fixme\n nodes = _verifyNodeList.call(this, nodes);\n\n // get the first path and insert our nodes before it, if it doesn't exist then it\n // doesn't matter, our nodes will be inserted anyway\n const path = NodePath.get({\n parentPath: this,\n parent: this.node,\n container: (this.node as N)[listKey] as unknown as t.Node | t.Node[],\n listKey,\n key: 0,\n }).setContext(this.context);\n\n return _containerInsertBefore.call(\n path,\n // @ts-expect-error typings needed to narrow down nodes as t.Node[]\n nodes,\n );\n}\n\nexport function pushContainer<\n P extends NodePath,\n K extends string & keyof P[\"node\"],\n>(\n this: P,\n listKey: K,\n nodes: P[\"node\"][K] extends (infer E)[]\n ? E | E[]\n : // todo: refine to t.Node[]\n // ? E extends t.Node\n // ? E | E[]\n // : never\n never,\n) {\n _assertUnremoved.call(this);\n\n const verifiedNodes = _verifyNodeList.call(\n this,\n // @ts-expect-error refine typings\n nodes,\n );\n\n // get an invisible path that represents the last node + 1 and replace it with our\n // nodes, effectively inlining it\n\n const container = (this.node as P[\"node\"])[listKey] as t.Node[];\n const path = NodePath.get({\n parentPath: this,\n parent: this.node,\n container: container as unknown as t.Node | t.Node[],\n listKey,\n key: container.length,\n }).setContext(this.context);\n\n return path.replaceWithMultiple(verifiedNodes);\n}\n\nimport PathHoister from \"./lib/hoister.ts\" with { if: \"!process.env.BABEL_8_BREAKING && !USE_ESM\" };\nif (!process.env.BABEL_8_BREAKING && !USE_ESM) {\n /**\n * Hoist the current node to the highest scope possible and return a UID\n * referencing it.\n */\n // eslint-disable-next-line no-restricted-globals\n exports.hoist = function hoist<T extends t.Node>(\n this: NodePath<T>,\n scope: Scope = this.scope,\n ) {\n const hoister = new PathHoister<T>(this, scope);\n return hoister.run();\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,EAAA,GAAAJ,OAAA;AA8YA,IAAAK,QAAA,GAAAL,OAAA;AAAoG;EA7YlGM,uBAAuB;EACvBC,gBAAgB;EAChBC,oBAAoB;EACpBC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AK,CAAC;EAIzC,MAAMkC,IAAI,GAAG2C,cAAQ,CAAClB,GAAG,CAAC;IACxBzD,UAAU,EAAE,IAAI;IAChBC,MAAM,EAAE,IAAI,CAACS,IAAI;IACjBK,SAAS,EAAG,IAAI,CAACL,IAAI,CAAOkE,OAAO,CAAiC;IACpEA,OAAO;IACPnE,GAAG,EAAE;EACP,CAAC,CAAC,CAACoE,UAAU,CAAC,IAAI,CAAC3C,OAAO,CAAC;EAE3B,OAAOlB,sBAAsB,CAACnB,IAAI,CAChCmC,IAAI,EAEJlC,KACF,CAAC;AACH;AAEO,SAASsE,aAAaA,CAK3BQ,OAAU,EACV9E,KAMS,EACT;EACAF,yBAAgB,CAACC,IAAI,CAAC,IAAI,CAAC;EAE3B,MAAMiF,aAAa,GAAG/E,eAAe,CAACF,IAAI,CACxC,IAAI,EAEJC,KACF,CAAC;EAKD,MAAMiB,SAAS,GAAI,IAAI,CAACL,IAAI,CAAekE,OAAO,CAAa;EAC/D,MAAM5C,IAAI,GAAG2C,cAAQ,CAAClB,GAAG,CAAC;IACxBzD,UAAU,EAAE,IAAI;IAChBC,MAAM,EAAE,IAAI,CAACS,IAAI;IACjBK,SAAS,EAAEA,SAAyC;IACpD6D,OAAO;IACPnE,GAAG,EAAEM,SAAS,CAACW;EACjB,CAAC,CAAC,CAACmD,UAAU,CAAC,IAAI,CAAC3C,OAAO,CAAC;EAE3B,OAAOF,IAAI,CAAC+C,mBAAmB,CAACD,aAAa,CAAC;AAChD;AAG+C;EAM7CE,OAAO,CAACC,KAAK,GAAG,SAASA,KAAKA,CAE5BjC,KAAY,GAAG,IAAI,CAACA,KAAK,EACzB;IACA,MAAMkC,OAAO,GAAG,IAAIC,gBAAW,CAAI,IAAI,EAAEnC,KAAK,CAAC;IAC/C,OAAOkC,OAAO,CAACE,GAAG,CAAC,CAAC;EACtB,CAAC;AACH","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_cache","require","_hoister","_index","_context","_removal","_t","arrowFunctionExpression","assertExpression","assignmentExpression","blockStatement","callExpression","cloneNode","expressionStatement","isAssignmentExpression","isCallExpression","isExportNamedDeclaration","isExpression","isIdentifier","isSequenceExpression","isSuper","thisExpression","insertBefore","nodes_","_assertUnremoved","call","nodes","_verifyNodeList","parentPath","parent","isExpressionStatement","isLabeledStatement","isExportDefaultDeclaration","isDeclaration","isNodeType","isJSXElement","isForStatement","key","node","push","replaceExpressionWithStatements","Array","isArray","container","_containerInsertBefore","isStatementOrBlock","shouldInsertCurrentNode","expression","replaceWith","unshiftContainer","Error","_containerInsert","from","updateSiblingKeys","length","paths","splice","i","_this$context","to","path","getSibling","context","queue","pushContext","contexts","_getQueueContexts","setScope","debug","maybeQueue","_containerInsertAfter","last","arr","isHiddenInSequenceExpression","expressions","isAlmostConstantAssignment","scope","left","blockScope","getBlockParent","hasOwnBinding","name","getOwnBinding","constantViolations","insertAfter","get","map","self","isPattern","unshift","callee","isPure","isMethod","computed","temp","generateDeclaredUidIdentifier","pushContainer","fromIndex","incrementBy","getCachedPaths","hub","msg","type","NodePath","listKey","setContext","verifiedNodes","replaceWithMultiple","exports","hoist","hoister","PathHoister","run"],"sources":["../../src/path/modification.ts"],"sourcesContent":["// This file contains methods that modify the path/node in some ways.\n\nimport { getCachedPaths } from \"../cache.ts\";\nimport PathHoister from \"./lib/hoister.ts\";\nimport NodePath from \"./index.ts\";\nimport { _getQueueContexts, pushContext, setScope } from \"./context.ts\";\nimport { _assertUnremoved } from \"./removal.ts\";\nimport {\n arrowFunctionExpression,\n assertExpression,\n assignmentExpression,\n blockStatement,\n callExpression,\n cloneNode,\n expressionStatement,\n isAssignmentExpression,\n isCallExpression,\n isExportNamedDeclaration,\n isExpression,\n isIdentifier,\n isSequenceExpression,\n isSuper,\n thisExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type Scope from \"../scope/index.ts\";\n\n/**\n * Insert the provided nodes before the current one.\n */\n\nexport function insertBefore(\n this: NodePath,\n nodes_: t.Node | t.Node[],\n): NodePath[] {\n _assertUnremoved.call(this);\n\n const nodes = _verifyNodeList.call(this, nodes_);\n\n const { parentPath, parent } = this;\n\n if (\n parentPath.isExpressionStatement() ||\n parentPath.isLabeledStatement() ||\n // https://github.com/babel/babel/issues/15293\n // When Babel transforms `export class String { field }`, the class properties plugin will inject the defineProperty\n // helper, which depends on the builtins e.g. String, Number, Symbol, etc. To prevent them from being shadowed by local\n // exports, the helper injector replaces the named export into `class _String { field }; export { _String as String }`,\n // with `parentPath` here changed to the moved ClassDeclaration, causing rare inconsistency between `parent` and `parentPath`.\n // Here we retrieve the parent type from the `parent` property. This is a temporary fix and we should revisit when\n // helpers should get injected.\n isExportNamedDeclaration(parent) ||\n (parentPath.isExportDefaultDeclaration() && this.isDeclaration())\n ) {\n return parentPath.insertBefore(nodes);\n } else if (\n (this.isNodeType(\"Expression\") && !this.isJSXElement()) ||\n (parentPath.isForStatement() && this.key === \"init\")\n ) {\n if (this.node) nodes.push(this.node);\n // @ts-expect-error todo(flow->ts): check that nodes is an array of statements\n return this.replaceExpressionWithStatements(nodes);\n } else if (Array.isArray(this.container)) {\n return _containerInsertBefore.call(this, nodes);\n } else if (this.isStatementOrBlock()) {\n const node = this.node as t.Statement;\n const shouldInsertCurrentNode =\n node &&\n (!this.isExpressionStatement() ||\n (node as t.ExpressionStatement).expression != null);\n\n this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : []));\n return (this as NodePath<t.BlockStatement>).unshiftContainer(\n \"body\",\n // @ts-expect-error Fixme: refine nodes to t.BlockStatement[\"body\"] when this is a BlockStatement path\n nodes,\n );\n } else {\n throw new Error(\n \"We don't know what to do with this node type. \" +\n \"We were previously a Statement but we can't fit in here?\",\n );\n }\n}\n\nexport function _containerInsert<N extends t.Node>(\n this: NodePath,\n from: number,\n nodes: N[],\n): NodePath<N>[] {\n updateSiblingKeys.call(this, from, nodes.length);\n\n const paths: NodePath<N>[] = [];\n\n // @ts-expect-error todo(flow->ts): this.container could be a NodePath\n this.container.splice(from, 0, ...nodes);\n for (let i = 0; i < nodes.length; i++) {\n const to = from + i;\n const path = this.getSibling(to) as NodePath<N>;\n paths.push(path);\n\n if (this.context?.queue) {\n pushContext.call(path, this.context);\n }\n }\n\n const contexts = _getQueueContexts.call(this);\n\n for (const path of paths) {\n setScope.call(path);\n path.debug(\"Inserted.\");\n\n for (const context of contexts) {\n context.maybeQueue(path, true);\n }\n }\n\n return paths;\n}\n\nexport function _containerInsertBefore<N extends t.Node>(\n this: NodePath,\n nodes: N[],\n) {\n return _containerInsert.call(this, this.key as number, nodes);\n}\n\nexport function _containerInsertAfter<N extends t.Node>(\n this: NodePath,\n nodes: N[],\n) {\n return _containerInsert.call(this, (this.key as number) + 1, nodes);\n}\n\nconst last = <T>(arr: T[]) => arr[arr.length - 1];\n\nfunction isHiddenInSequenceExpression(path: NodePath): boolean {\n return (\n isSequenceExpression(path.parent) &&\n (last(path.parent.expressions) !== path.node ||\n isHiddenInSequenceExpression(path.parentPath))\n );\n}\n\nfunction isAlmostConstantAssignment(\n node: t.Node,\n scope: Scope,\n): node is t.AssignmentExpression & { left: t.Identifier } {\n if (!isAssignmentExpression(node) || !isIdentifier(node.left)) {\n return false;\n }\n\n // Not every scope can contain variables. For example, we might be in\n // a ClassScope either in the ClassHeritage or in a computed key.\n const blockScope = scope.getBlockParent();\n\n // If the variable is defined in the current scope and only assigned here,\n // we can be sure that its value won't change.\n return (\n blockScope.hasOwnBinding(node.left.name) &&\n blockScope.getOwnBinding(node.left.name).constantViolations.length <= 1\n );\n}\n\n/**\n * Insert the provided nodes after the current one. When inserting nodes after an\n * expression, ensure that the completion record is correct by pushing the current node.\n */\n\nexport function insertAfter(\n this: NodePath,\n nodes_: t.Node | t.Node[],\n): NodePath[] {\n _assertUnremoved.call(this);\n\n if (this.isSequenceExpression()) {\n return last(this.get(\"expressions\")).insertAfter(nodes_);\n }\n\n const nodes = _verifyNodeList.call(this, nodes_);\n\n const { parentPath, parent } = this;\n if (\n parentPath.isExpressionStatement() ||\n parentPath.isLabeledStatement() ||\n // see insertBefore\n isExportNamedDeclaration(parent) ||\n (parentPath.isExportDefaultDeclaration() && this.isDeclaration())\n ) {\n return parentPath.insertAfter(\n nodes.map(node => {\n // Usually after an expression we can safely insert another expression:\n // A.insertAfter(B)\n // foo = A; -> foo = (A, B);\n // If A is an expression statement, it isn't safe anymore so we need to\n // convert B to an expression statement\n // A; -> A; B // No semicolon! It could break if followed by [!\n return isExpression(node) ? expressionStatement(node) : node;\n }),\n );\n } else if (\n (this.isNodeType(\"Expression\") &&\n !this.isJSXElement() &&\n !parentPath.isJSXElement()) ||\n (parentPath.isForStatement() && this.key === \"init\")\n ) {\n const self = this as NodePath<t.Expression | t.VariableDeclaration>;\n if (self.node) {\n const node = self.node;\n let { scope } = this;\n\n if (scope.path.isPattern()) {\n assertExpression(node);\n\n self.replaceWith(callExpression(arrowFunctionExpression([], node), []));\n (self.get(\"callee.body\") as NodePath<t.Expression>).insertAfter(nodes);\n return [self];\n }\n\n if (isHiddenInSequenceExpression(self)) {\n nodes.unshift(node);\n }\n // We need to preserve the value of this expression.\n else if (isCallExpression(node) && isSuper(node.callee)) {\n nodes.unshift(node);\n // `super(...)` always evaluates to `this`.\n nodes.push(thisExpression());\n } else if (isAlmostConstantAssignment(node, scope)) {\n nodes.unshift(node);\n nodes.push(cloneNode(node.left));\n } else if (scope.isPure(node, true)) {\n // Insert the nodes before rather than after; it's not observable.\n nodes.push(node);\n } else {\n // Inserting after the computed key of a method should insert the\n // temporary binding in the method's parent's scope.\n if (parentPath.isMethod({ computed: true, key: node })) {\n scope = scope.parent;\n }\n const temp = scope.generateDeclaredUidIdentifier();\n nodes.unshift(\n expressionStatement(\n // @ts-expect-error todo(flow->ts): This can be a variable\n // declaration in the \"init\" of a for statement, but that's\n // invalid here.\n assignmentExpression(\"=\", cloneNode(temp), node),\n ),\n );\n nodes.push(expressionStatement(cloneNode(temp)));\n }\n }\n // @ts-expect-error todo(flow->ts): check that nodes is an array of statements\n return this.replaceExpressionWithStatements(nodes);\n } else if (Array.isArray(this.container)) {\n return _containerInsertAfter.call(this, nodes);\n } else if (this.isStatementOrBlock()) {\n const node = this.node as t.Statement;\n const shouldInsertCurrentNode =\n node &&\n (!this.isExpressionStatement() ||\n (node as t.ExpressionStatement).expression != null);\n\n this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : []));\n // @ts-expect-error Fixme: refine nodes to t.BlockStatement[\"body\"] when this is a BlockStatement path\n return this.pushContainer(\"body\", nodes);\n } else {\n throw new Error(\n \"We don't know what to do with this node type. \" +\n \"We were previously a Statement but we can't fit in here?\",\n );\n }\n}\n\n/**\n * Update all sibling node paths after `fromIndex` by `incrementBy`.\n */\n\nexport function updateSiblingKeys(\n this: NodePath,\n fromIndex: number,\n incrementBy: number,\n) {\n if (!this.parent) return;\n\n const paths = getCachedPaths(this.hub, this.parent) || ([] as never[]);\n\n for (const [, path] of paths) {\n if (\n typeof path.key === \"number\" &&\n path.container === this.container &&\n path.key >= fromIndex\n ) {\n path.key += incrementBy;\n }\n }\n}\n\nexport function _verifyNodeList<N extends t.Node>(\n this: NodePath,\n nodes: N | N[],\n): N[] {\n if (!nodes) {\n return [];\n }\n\n if (!Array.isArray(nodes)) {\n nodes = [nodes];\n }\n\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n let msg;\n\n if (!node) {\n msg = \"has falsy node\";\n } else if (typeof node !== \"object\") {\n msg = \"contains a non-object node\";\n } else if (!node.type) {\n msg = \"without a type\";\n } else if (node instanceof NodePath) {\n msg = \"has a NodePath when it expected a raw object\";\n }\n\n if (msg) {\n const type = Array.isArray(node) ? \"array\" : typeof node;\n throw new Error(\n `Node list ${msg} with the index of ${i} and type of ${type}`,\n );\n }\n }\n\n return nodes;\n}\n\nexport function unshiftContainer<N extends t.Node, K extends keyof N & string>(\n this: NodePath<N>,\n listKey: K,\n nodes: N[K] extends (infer E)[]\n ? E | E[]\n : // todo: refine to t.Node[]\n // ? E extends t.Node\n // ? E | E[]\n // : never\n never,\n) {\n // todo: NodePaths<Nodes>\n _assertUnremoved.call(this);\n\n // @ts-expect-error fixme\n nodes = _verifyNodeList.call(this, nodes);\n\n // get the first path and insert our nodes before it, if it doesn't exist then it\n // doesn't matter, our nodes will be inserted anyway\n const path = NodePath.get({\n parentPath: this,\n parent: this.node,\n container: (this.node as N)[listKey] as unknown as t.Node | t.Node[],\n listKey,\n key: 0,\n }).setContext(this.context);\n\n return _containerInsertBefore.call(\n path,\n // @ts-expect-error typings needed to narrow down nodes as t.Node[]\n nodes,\n );\n}\n\nexport function pushContainer<\n P extends NodePath,\n K extends string & keyof P[\"node\"],\n>(\n this: P,\n listKey: K,\n nodes: P[\"node\"][K] extends (infer E)[]\n ? E | E[]\n : // todo: refine to t.Node[]\n // ? E extends t.Node\n // ? E | E[]\n // : never\n never,\n) {\n _assertUnremoved.call(this);\n\n const verifiedNodes = _verifyNodeList.call(\n this,\n // @ts-expect-error refine typings\n nodes,\n );\n\n // get an invisible path that represents the last node + 1 and replace it with our\n // nodes, effectively inlining it\n\n const container = (this.node as P[\"node\"])[listKey] as t.Node[];\n const path = NodePath.get({\n parentPath: this,\n parent: this.node,\n container: container as unknown as t.Node | t.Node[],\n listKey,\n key: container.length,\n }).setContext(this.context);\n\n return path.replaceWithMultiple(verifiedNodes);\n}\n\nif (!process.env.BABEL_8_BREAKING && !USE_ESM) {\n /**\n * Hoist the current node to the highest scope possible and return a UID\n * referencing it.\n */\n // eslint-disable-next-line no-restricted-globals\n exports.hoist = function hoist<T extends t.Node>(\n this: NodePath<T>,\n scope: Scope = this.scope,\n ) {\n const hoister = new PathHoister<T>(this, scope);\n return hoister.run();\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,EAAA,G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List":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_codeFrame","require","_index","_index2","_cache","_modification","_parser","_t","_context","FUNCTION_TYPES","arrowFunctionExpression","assignmentExpression","awaitExpression","blockStatement","buildUndefinedNode","callExpression","cloneNode","conditionalExpression","expressionStatement","getBindingIdentifiers","identifier","inheritLeadingComments","inheritTrailingComments","inheritsComments","isBlockStatement","isEmptyStatement","isExpression","isExpressionStatement","isIfStatement","isProgram","isStatement","isVariableDeclaration","removeComments","returnStatement","sequenceExpression","validate","yieldExpression","replaceWithMultiple","nodes","_getCachedPaths","resync","call","_verifyNodeList","node","length","getCachedPaths","hub","parent","delete","container","key","paths","insertAfter","requeue","remove","replaceWithSourceString","replacement","ast","parse","err","loc","message","codeFrameColumns","start","line","column","code","expressionAST","program","body","expression","traverse","removeProperties","replaceWith","replacementPath","removed","Error","NodePath","Array","isArray","nodePath","isNodeType","canHaveVariableDeclarationOrExpression","canSwapBetweenExpressionAndStatement","parentPath","isExportDefaultDeclaration","replaceExpressionWithStatements","oldNode","_replaceWith","type","setScope","get","_getCachedPaths2","ReferenceError","inList","debug","set","declars","nodesAsSingleExpression","gatherSequenceExpressions","id","scope","push","functionParent","getFunctionParent","isParentAsync","async","isParentGenerator","generator","callee","hoistVariables","completionRecords","getCompletionRecords","path","loop","findParent","isLoop","uid","getData","generateDeclaredUidIdentifier","pushContainer","setData","name","arrowFunctionToExpression","newCallee","needToAwaitFunction","hasType","needToYieldFunction","exprs","ensureLastUndefined","kind","declar","declarations","bindings","Object","keys","init","consequent","alternate","test","indexOf","replaceInline","_containerInsertAfter"],"sources":["../../src/path/replacement.ts"],"sourcesContent":["// This file contains methods responsible for replacing a node with another.\n\nimport { codeFrameColumns } from \"@babel/code-frame\";\nimport traverse from \"../index.ts\";\nimport NodePath from \"./index.ts\";\nimport { getCachedPaths } from \"../cache.ts\";\nimport { _verifyNodeList, _containerInsertAfter } from \"./modification.ts\";\nimport { parse } from \"@babel/parser\";\nimport {\n FUNCTION_TYPES,\n arrowFunctionExpression,\n assignmentExpression,\n awaitExpression,\n blockStatement,\n buildUndefinedNode,\n callExpression,\n cloneNode,\n conditionalExpression,\n expressionStatement,\n getBindingIdentifiers,\n identifier,\n inheritLeadingComments,\n inheritTrailingComments,\n inheritsComments,\n isBlockStatement,\n isEmptyStatement,\n isExpression,\n isExpressionStatement,\n isIfStatement,\n isProgram,\n isStatement,\n isVariableDeclaration,\n removeComments,\n returnStatement,\n sequenceExpression,\n validate,\n yieldExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport { resync, setScope } from \"./context.ts\";\n\n/**\n * Replace a node with an array of multiple. This method performs the following steps:\n *\n * - Inherit the comments of first provided node with that of the current node.\n * - Insert the provided nodes after the current node.\n * - Remove the current node.\n */\n\nexport function replaceWithMultiple(\n this: NodePath,\n nodes: t.Node | t.Node[],\n): NodePath[] {\n resync.call(this);\n\n nodes = _verifyNodeList.call(this, nodes);\n inheritLeadingComments(nodes[0], this.node);\n inheritTrailingComments(nodes[nodes.length - 1], this.node);\n getCachedPaths(this.hub, this.parent)?.delete(this.node);\n this.node =\n // @ts-expect-error this.key must present in this.container\n this.container[this.key] = null;\n const paths = this.insertAfter(nodes);\n\n if (this.node) {\n this.requeue();\n } else {\n this.remove();\n }\n return paths;\n}\n\n/**\n * Parse a string as an expression and replace the current node with the result.\n *\n * NOTE: This is typically not a good idea to use. Building source strings when\n * transforming ASTs is an antipattern and SHOULD NOT be encouraged. Even if it's\n * easier to use, your transforms will be extremely brittle.\n */\n\nexport function replaceWithSourceString(this: NodePath, replacement: string) {\n resync.call(this);\n let ast: t.File;\n\n try {\n replacement = `(${replacement})`;\n ast = parse(replacement);\n } catch (err) {\n const loc = err.loc;\n if (loc) {\n err.message +=\n \" - make sure this is an expression.\\n\" +\n codeFrameColumns(replacement, {\n start: {\n line: loc.line,\n column: loc.column + 1,\n },\n });\n err.code = \"BABEL_REPLACE_SOURCE_ERROR\";\n }\n throw err;\n }\n\n const expressionAST = (ast.program.body[0] as t.ExpressionStatement)\n .expression;\n traverse.removeProperties(expressionAST);\n return this.replaceWith(expressionAST);\n}\n\n/**\n * Replace the current node with another.\n */\nexport function replaceWith<R extends t.Node>(\n this: NodePath,\n replacementPath: R,\n): [NodePath<R>];\nexport function replaceWith<R extends NodePath>(\n this: NodePath,\n replacementPath: R,\n): [R];\nexport function replaceWith(\n this: NodePath,\n replacementPath: t.Node | NodePath,\n): [NodePath] {\n resync.call(this);\n\n if (this.removed) {\n throw new Error(\"You can't replace this node, we've already removed it\");\n }\n\n let replacement: t.Node =\n replacementPath instanceof NodePath\n ? replacementPath.node\n : replacementPath;\n\n if (!replacement) {\n throw new Error(\n \"You passed `path.replaceWith()` a falsy node, use `path.remove()` instead\",\n );\n }\n\n if (this.node === replacement) {\n return [this];\n }\n\n if (this.isProgram() && !isProgram(replacement)) {\n throw new Error(\n \"You can only replace a Program root node with another Program node\",\n );\n }\n\n if (Array.isArray(replacement)) {\n throw new Error(\n \"Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`\",\n );\n }\n\n if (typeof replacement === \"string\") {\n throw new Error(\n \"Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`\",\n );\n }\n\n let nodePath = \"\";\n\n if (this.isNodeType(\"Statement\") && isExpression(replacement)) {\n if (\n !this.canHaveVariableDeclarationOrExpression() &&\n !this.canSwapBetweenExpressionAndStatement(replacement) &&\n !this.parentPath.isExportDefaultDeclaration()\n ) {\n // replacing a statement with an expression so wrap it in an expression statement\n replacement = expressionStatement(replacement);\n nodePath = \"expression\";\n }\n }\n\n if (this.isNodeType(\"Expression\") && isStatement(replacement)) {\n if (\n !this.canHaveVariableDeclarationOrExpression() &&\n !this.canSwapBetweenExpressionAndStatement(replacement)\n ) {\n // replacing an expression with a statement so let's explode it\n return this.replaceExpressionWithStatements([replacement]) as [NodePath];\n }\n }\n\n const oldNode = this.node;\n if (oldNode) {\n inheritsComments(replacement, oldNode);\n removeComments(oldNode);\n }\n\n // replace the node\n _replaceWith.call(this, replacement);\n this.type = replacement.type;\n\n // potentially create new scope\n setScope.call(this);\n\n // requeue for visiting\n this.requeue();\n\n return [nodePath ? this.get(nodePath) : this];\n}\n\nexport function _replaceWith(this: NodePath, node: t.Node) {\n if (!this.container) {\n throw new ReferenceError(\"Container is falsy\");\n }\n\n if (this.inList) {\n // @ts-expect-error todo(flow->ts): check if validate accepts a numeric key\n validate(this.parent, this.key, [node]);\n } else {\n validate(this.parent, this.key as string, node);\n }\n\n this.debug(`Replace with ${node?.type}`);\n getCachedPaths(this.hub, this.parent)?.set(node, this).delete(this.node);\n\n this.node =\n // @ts-expect-error this.key must present in this.container\n this.container[this.key] = node;\n}\n\n/**\n * This method takes an array of statements nodes and then explodes it\n * into expressions. This method retains completion records which is\n * extremely important to retain original semantics.\n */\n\nexport function replaceExpressionWithStatements(\n this: NodePath,\n nodes: Array<t.Statement>,\n) {\n resync.call(this);\n\n const declars: t.Identifier[] = [];\n const nodesAsSingleExpression = gatherSequenceExpressions(nodes, declars);\n if (nodesAsSingleExpression) {\n for (const id of declars) this.scope.push({ id });\n return this.replaceWith(nodesAsSingleExpression)[0].get(\"expressions\");\n }\n\n const functionParent = this.getFunctionParent();\n const isParentAsync = functionParent?.node.async;\n const isParentGenerator = functionParent?.node.generator;\n\n const container = arrowFunctionExpression([], blockStatement(nodes));\n\n this.replaceWith(callExpression(container, []));\n // replaceWith changes the type of \"this\", but it isn't trackable by TS\n type ThisType = NodePath<\n t.CallExpression & {\n callee: t.ArrowFunctionExpression & { body: t.BlockStatement };\n }\n >;\n\n // hoist variable declaration in do block\n // `(do { var x = 1; x;})` -> `var x; (() => { x = 1; return x; })()`\n const callee = (this as ThisType).get(\"callee\");\n callee.get(\"body\").scope.hoistVariables(id => this.scope.push({ id }));\n\n // add implicit returns to all ending expression statements\n const completionRecords: Array<NodePath> = callee.getCompletionRecords();\n for (const path of completionRecords) {\n if (!path.isExpressionStatement()) continue;\n\n const loop = path.findParent(path => path.isLoop());\n if (loop) {\n let uid = loop.getData(\"expressionReplacementReturnUid\");\n\n if (!uid) {\n uid = callee.scope.generateDeclaredUidIdentifier(\"ret\");\n callee\n .get(\"body\")\n .pushContainer(\"body\", returnStatement(cloneNode(uid)));\n loop.setData(\"expressionReplacementReturnUid\", uid);\n } else {\n uid = identifier(uid.name);\n }\n\n path\n .get(\"expression\")\n .replaceWith(\n assignmentExpression(\"=\", cloneNode(uid), path.node.expression),\n );\n } else {\n path.replaceWith(returnStatement(path.node.expression));\n }\n }\n\n // This is an IIFE, so we don't need to worry about the noNewArrows assumption\n callee.arrowFunctionToExpression();\n // Fixme: we can not `assert this is NodePath<t.FunctionExpression>` in `arrowFunctionToExpression`\n // because it is not a class method known at compile time.\n const newCallee = callee as unknown as NodePath<t.FunctionExpression>;\n\n // (() => await xxx)() -> await (async () => await xxx)();\n const needToAwaitFunction =\n isParentAsync &&\n traverse.hasType(\n (this.get(\"callee.body\") as NodePath<t.BlockStatement>).node,\n \"AwaitExpression\",\n FUNCTION_TYPES,\n );\n const needToYieldFunction =\n isParentGenerator &&\n traverse.hasType(\n (this.get(\"callee.body\") as NodePath<t.BlockStatement>).node,\n \"YieldExpression\",\n FUNCTION_TYPES,\n );\n if (needToAwaitFunction) {\n newCallee.set(\"async\", true);\n // yield* will await the generator return result\n if (!needToYieldFunction) {\n this.replaceWith(awaitExpression((this as ThisType).node));\n }\n }\n if (needToYieldFunction) {\n newCallee.set(\"generator\", true);\n this.replaceWith(yieldExpression((this as ThisType).node, true));\n }\n\n return newCallee.get(\"body.body\");\n}\n\nfunction gatherSequenceExpressions(\n nodes: ReadonlyArray<t.Node>,\n declars: Array<t.Identifier>,\n) {\n const exprs: t.Expression[] = [];\n let ensureLastUndefined = true;\n\n for (const node of nodes) {\n // if we encounter emptyStatement before a non-emptyStatement\n // we want to disregard that\n if (!isEmptyStatement(node)) {\n ensureLastUndefined = false;\n }\n\n if (isExpression(node)) {\n exprs.push(node);\n } else if (isExpressionStatement(node)) {\n exprs.push(node.expression);\n } else if (isVariableDeclaration(node)) {\n if (node.kind !== \"var\") return; // bailed\n\n for (const declar of node.declarations) {\n const bindings = getBindingIdentifiers(declar);\n for (const key of Object.keys(bindings)) {\n declars.push(cloneNode(bindings[key]));\n }\n\n if (declar.init) {\n exprs.push(assignmentExpression(\"=\", declar.id, declar.init));\n }\n }\n\n ensureLastUndefined = true;\n } else if (isIfStatement(node)) {\n const consequent = node.consequent\n ? gatherSequenceExpressions([node.consequent], declars)\n : buildUndefinedNode();\n const alternate = node.alternate\n ? gatherSequenceExpressions([node.alternate], declars)\n : buildUndefinedNode();\n if (!consequent || !alternate) return; // bailed\n\n exprs.push(conditionalExpression(node.test, consequent, alternate));\n } else if (isBlockStatement(node)) {\n const body = gatherSequenceExpressions(node.body, declars);\n if (!body) return; // bailed\n\n exprs.push(body);\n } else if (isEmptyStatement(node)) {\n // empty statement so ensure the last item is undefined if we're last\n // checks if emptyStatement is first\n if (nodes.indexOf(node) === 0) {\n ensureLastUndefined = true;\n }\n } else {\n // bailed, we can't turn this statement into an expression\n return;\n }\n }\n\n if (ensureLastUndefined) exprs.push(buildUndefinedNode());\n\n if (exprs.length === 1) {\n return exprs[0];\n } else {\n return sequenceExpression(exprs);\n }\n}\n\nexport function replaceInline(this: NodePath, nodes: t.Node | Array<t.Node>) {\n resync.call(this);\n\n if (Array.isArray(nodes)) {\n if (Array.isArray(this.container)) {\n nodes = _verifyNodeList.call(this, nodes);\n const paths = _containerInsertAfter.call(this, nodes);\n this.remove();\n return paths;\n } else {\n return this.replaceWithMultiple(nodes);\n }\n } else {\n return this.replaceWith(nodes);\n }\n}\n"],"mappings":";;;;;;;;;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA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;EACjB,CAAC,MAAM;IACL,OAAO9F,kBAAkB,CAAC8F,KAAK,CAAC;EAClC;AACF;AAEO,SAASa,aAAaA,CAAiBvG,KAA6B,EAAE;EAC3EE,eAAM,CAACC,IAAI,CAAC,IAAI,CAAC;EAEjB,IAAIqC,KAAK,CAACC,OAAO,CAACzC,KAAK,CAAC,EAAE;IACxB,IAAIwC,KAAK,CAACC,OAAO,CAAC,IAAI,CAAC9B,SAAS,CAAC,EAAE;MACjCX,KAAK,GAAGI,6BAAe,CAACD,IAAI,CAAC,IAAI,EAAEH,KAAK,CAAC;MACzC,MAAMa,KAAK,GAAG2F,mCAAqB,CAACrG,IAAI,CAAC,IAAI,EAAEH,KAAK,CAAC;MACrD,IAAI,CAACgB,MAAM,CAAC,CAAC;MACb,OAAOH,KAAK;IACd,CAAC,MAAM;MACL,OAAO,IAAI,CAACd,mBAAmB,CAACC,KAAK,CAAC;IACxC;EACF,CAAC,MAAM;IACL,OAAO,IAAI,CAACmC,WAAW,CAACnC,KAAK,CAAC;EAChC;AACF","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_codeFrame","require","_index","_index2","_cache","_modification","_parser","_t","_context","FUNCTION_TYPES","arrowFunctionExpression","assignmentExpression","awaitExpression","blockStatement","buildUndefinedNode","callExpression","cloneNode","conditionalExpression","expressionStatement","getBindingIdentifiers","identifier","inheritLeadingComments","inheritTrailingComments","inheritsComments","isBlockStatement","isEmptyStatement","isExpression","isExpressionStatement","isIfStatement","isProgram","isStatement","isVariableDeclaration","removeComments","returnStatement","sequenceExpression","validate","yieldExpression","replaceWithMultiple","nodes","_getCachedPaths","resync","call","_verifyNodeList","node","length","getCachedPaths","hub","parent","delete","container","key","paths","insertAfter","requeue","remove","replaceWithSourceString","replacement","ast","parse","err","loc","message","codeFrameColumns","start","line","column","code","expressionAST","program","body","expression","traverse","removeProperties","replaceWith","replacementPath","removed","Error","NodePath","Array","isArray","nodePath","isNodeType","canHaveVariableDeclarationOrExpression","canSwapBetweenExpressionAndStatement","parentPath","isExportDefaultDeclaration","replaceExpressionWithStatements","oldNode","_replaceWith","type","setScope","get","_getCachedPaths2","ReferenceError","inList","debug","set","declars","nodesAsSingleExpression","gatherSequenceExpressions","id","scope","push","functionParent","getFunctionParent","isParentAsync","async","isParentGenerator","generator","callee","hoistVariables","completionRecords","getCompletionRecords","path","loop","findParent","isLoop","uid","getData","generateDeclaredUidIdentifier","pushContainer","setData","name","arrowFunctionToExpression","newCallee","needToAwaitFunction","hasType","needToYieldFunction","exprs","ensureLastUndefined","kind","declar","declarations","bindings","Object","keys","init","consequent","alternate","test","indexOf","replaceInline","_containerInsertAfter"],"sources":["../../src/path/replacement.ts"],"sourcesContent":["// This file contains methods responsible for replacing a node with another.\n\nimport { codeFrameColumns } from \"@babel/code-frame\";\nimport traverse from \"../index.ts\";\nimport NodePath from \"./index.ts\";\nimport { getCachedPaths } from \"../cache.ts\";\nimport { _verifyNodeList, _containerInsertAfter } from \"./modification.ts\";\nimport { parse } from \"@babel/parser\";\nimport {\n FUNCTION_TYPES,\n arrowFunctionExpression,\n assignmentExpression,\n awaitExpression,\n blockStatement,\n buildUndefinedNode,\n callExpression,\n cloneNode,\n conditionalExpression,\n expressionStatement,\n getBindingIdentifiers,\n identifier,\n inheritLeadingComments,\n inheritTrailingComments,\n inheritsComments,\n isBlockStatement,\n isEmptyStatement,\n isExpression,\n isExpressionStatement,\n isIfStatement,\n isProgram,\n isStatement,\n isVariableDeclaration,\n removeComments,\n returnStatement,\n sequenceExpression,\n validate,\n yieldExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport { resync, setScope } from \"./context.ts\";\n\n/**\n * Replace a node with an array of multiple. This method performs the following steps:\n *\n * - Inherit the comments of first provided node with that of the current node.\n * - Insert the provided nodes after the current node.\n * - Remove the current node.\n */\n\nexport function replaceWithMultiple(\n this: NodePath,\n nodes: t.Node | t.Node[],\n): NodePath[] {\n resync.call(this);\n\n nodes = _verifyNodeList.call(this, nodes);\n inheritLeadingComments(nodes[0], this.node);\n inheritTrailingComments(nodes[nodes.length - 1], this.node);\n getCachedPaths(this.hub, this.parent)?.delete(this.node);\n this.node =\n // @ts-expect-error this.key must present in this.container\n this.container[this.key] = null;\n const paths = this.insertAfter(nodes);\n\n if (this.node) {\n this.requeue();\n } else {\n this.remove();\n }\n return paths;\n}\n\n/**\n * Parse a string as an expression and replace the current node with the result.\n *\n * NOTE: This is typically not a good idea to use. Building source strings when\n * transforming ASTs is an antipattern and SHOULD NOT be encouraged. Even if it's\n * easier to use, your transforms will be extremely brittle.\n */\n\nexport function replaceWithSourceString(this: NodePath, replacement: string) {\n resync.call(this);\n let ast: t.File;\n\n try {\n replacement = `(${replacement})`;\n // @ts-expect-error todo: use babel-types ast typings in Babel parser\n ast = parse(replacement);\n } catch (err) {\n const loc = err.loc;\n if (loc) {\n err.message +=\n \" - make sure this is an expression.\\n\" +\n codeFrameColumns(replacement, {\n start: {\n line: loc.line,\n column: loc.column + 1,\n },\n });\n err.code = \"BABEL_REPLACE_SOURCE_ERROR\";\n }\n throw err;\n }\n\n const expressionAST = (ast.program.body[0] as t.ExpressionStatement)\n .expression;\n traverse.removeProperties(expressionAST);\n return this.replaceWith(expressionAST);\n}\n\n/**\n * Replace the current node with another.\n */\nexport function replaceWith<R extends t.Node>(\n this: NodePath,\n replacementPath: R,\n): [NodePath<R>];\nexport function replaceWith<R extends NodePath>(\n this: NodePath,\n replacementPath: R,\n): [R];\nexport function replaceWith(\n this: NodePath,\n replacementPath: t.Node | NodePath,\n): [NodePath] {\n resync.call(this);\n\n if (this.removed) {\n throw new Error(\"You can't replace this node, we've already removed it\");\n }\n\n let replacement: t.Node =\n replacementPath instanceof NodePath\n ? replacementPath.node\n : replacementPath;\n\n if (!replacement) {\n throw new Error(\n \"You passed `path.replaceWith()` a falsy node, use `path.remove()` instead\",\n );\n }\n\n if (this.node === replacement) {\n return [this];\n }\n\n if (this.isProgram() && !isProgram(replacement)) {\n throw new Error(\n \"You can only replace a Program root node with another Program node\",\n );\n }\n\n if (Array.isArray(replacement)) {\n throw new Error(\n \"Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`\",\n );\n }\n\n if (typeof replacement === \"string\") {\n throw new Error(\n \"Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`\",\n );\n }\n\n let nodePath = \"\";\n\n if (this.isNodeType(\"Statement\") && isExpression(replacement)) {\n if (\n !this.canHaveVariableDeclarationOrExpression() &&\n !this.canSwapBetweenExpressionAndStatement(replacement) &&\n !this.parentPath.isExportDefaultDeclaration()\n ) {\n // replacing a statement with an expression so wrap it in an expression statement\n replacement = expressionStatement(replacement);\n nodePath = \"expression\";\n }\n }\n\n if (this.isNodeType(\"Expression\") && isStatement(replacement)) {\n if (\n !this.canHaveVariableDeclarationOrExpression() &&\n !this.canSwapBetweenExpressionAndStatement(replacement)\n ) {\n // replacing an expression with a statement so let's explode it\n return this.replaceExpressionWithStatements([replacement]) as [NodePath];\n }\n }\n\n const oldNode = this.node;\n if (oldNode) {\n inheritsComments(replacement, oldNode);\n removeComments(oldNode);\n }\n\n // replace the node\n _replaceWith.call(this, replacement);\n this.type = replacement.type;\n\n // potentially create new scope\n setScope.call(this);\n\n // requeue for visiting\n this.requeue();\n\n return [nodePath ? this.get(nodePath) : this];\n}\n\nexport function _replaceWith(this: NodePath, node: t.Node) {\n if (!this.container) {\n throw new ReferenceError(\"Container is falsy\");\n }\n\n if (this.inList) {\n // @ts-expect-error todo(flow->ts): check if validate accepts a numeric key\n validate(this.parent, this.key, [node]);\n } else {\n validate(this.parent, this.key as string, node);\n }\n\n this.debug(`Replace with ${node?.type}`);\n getCachedPaths(this.hub, this.parent)?.set(node, this).delete(this.node);\n\n this.node =\n // @ts-expect-error this.key must present in this.container\n this.container[this.key] = node;\n}\n\n/**\n * This method takes an array of statements nodes and then explodes it\n * into expressions. This method retains completion records which is\n * extremely important to retain original semantics.\n */\n\nexport function replaceExpressionWithStatements(\n this: NodePath,\n nodes: Array<t.Statement>,\n) {\n resync.call(this);\n\n const declars: t.Identifier[] = [];\n const nodesAsSingleExpression = gatherSequenceExpressions(nodes, declars);\n if (nodesAsSingleExpression) {\n for (const id of declars) this.scope.push({ id });\n return this.replaceWith(nodesAsSingleExpression)[0].get(\"expressions\");\n }\n\n const functionParent = this.getFunctionParent();\n const isParentAsync = functionParent?.node.async;\n const isParentGenerator = functionParent?.node.generator;\n\n const container = arrowFunctionExpression([], blockStatement(nodes));\n\n this.replaceWith(callExpression(container, []));\n // replaceWith changes the type of \"this\", but it isn't trackable by TS\n type ThisType = NodePath<\n t.CallExpression & {\n callee: t.ArrowFunctionExpression & { body: t.BlockStatement };\n }\n >;\n\n // hoist variable declaration in do block\n // `(do { var x = 1; x;})` -> `var x; (() => { x = 1; return x; })()`\n const callee = (this as ThisType).get(\"callee\");\n callee.get(\"body\").scope.hoistVariables(id => this.scope.push({ id }));\n\n // add implicit returns to all ending expression statements\n const completionRecords: Array<NodePath> = callee.getCompletionRecords();\n for (const path of completionRecords) {\n if (!path.isExpressionStatement()) continue;\n\n const loop = path.findParent(path => path.isLoop());\n if (loop) {\n let uid = loop.getData(\"expressionReplacementReturnUid\");\n\n if (!uid) {\n uid = callee.scope.generateDeclaredUidIdentifier(\"ret\");\n callee\n .get(\"body\")\n .pushContainer(\"body\", returnStatement(cloneNode(uid)));\n loop.setData(\"expressionReplacementReturnUid\", uid);\n } else {\n uid = identifier(uid.name);\n }\n\n path\n .get(\"expression\")\n .replaceWith(\n assignmentExpression(\"=\", cloneNode(uid), path.node.expression),\n );\n } else {\n path.replaceWith(returnStatement(path.node.expression));\n }\n }\n\n // This is an IIFE, so we don't need to worry about the noNewArrows assumption\n callee.arrowFunctionToExpression();\n // Fixme: we can not `assert this is NodePath<t.FunctionExpression>` in `arrowFunctionToExpression`\n // because it is not a class method known at compile time.\n const newCallee = callee as unknown as NodePath<t.FunctionExpression>;\n\n // (() => await xxx)() -> await (async () => await xxx)();\n const needToAwaitFunction =\n isParentAsync &&\n traverse.hasType(\n (this.get(\"callee.body\") as NodePath<t.BlockStatement>).node,\n \"AwaitExpression\",\n FUNCTION_TYPES,\n );\n const needToYieldFunction =\n isParentGenerator &&\n traverse.hasType(\n (this.get(\"callee.body\") as NodePath<t.BlockStatement>).node,\n \"YieldExpression\",\n FUNCTION_TYPES,\n );\n if (needToAwaitFunction) {\n newCallee.set(\"async\", true);\n // yield* will await the generator return result\n if (!needToYieldFunction) {\n this.replaceWith(awaitExpression((this as ThisType).node));\n }\n }\n if (needToYieldFunction) {\n newCallee.set(\"generator\", true);\n this.replaceWith(yieldExpression((this as ThisType).node, true));\n }\n\n return newCallee.get(\"body.body\");\n}\n\nfunction gatherSequenceExpressions(\n nodes: ReadonlyArray<t.Node>,\n declars: Array<t.Identifier>,\n) {\n const exprs: t.Expression[] = [];\n let ensureLastUndefined = true;\n\n for (const node of nodes) {\n // if we encounter emptyStatement before a non-emptyStatement\n // we want to disregard that\n if (!isEmptyStatement(node)) {\n ensureLastUndefined = false;\n }\n\n if (isExpression(node)) {\n exprs.push(node);\n } else if (isExpressionStatement(node)) {\n exprs.push(node.expression);\n } else if (isVariableDeclaration(node)) {\n if (node.kind !== \"var\") return; // bailed\n\n for (const declar of node.declarations) {\n const bindings = getBindingIdentifiers(declar);\n for (const key of Object.keys(bindings)) {\n declars.push(cloneNode(bindings[key]));\n }\n\n if (declar.init) {\n exprs.push(assignmentExpression(\"=\", declar.id, declar.init));\n }\n }\n\n ensureLastUndefined = true;\n } else if (isIfStatement(node)) {\n const consequent = node.consequent\n ? gatherSequenceExpressions([node.consequent], declars)\n : buildUndefinedNode();\n const alternate = node.alternate\n ? gatherSequenceExpressions([node.alternate], declars)\n : buildUndefinedNode();\n if (!consequent || !alternate) return; // bailed\n\n exprs.push(conditionalExpression(node.test, consequent, alternate));\n } else if (isBlockStatement(node)) {\n const body = gatherSequenceExpressions(node.body, declars);\n if (!body) return; // bailed\n\n exprs.push(body);\n } else if (isEmptyStatement(node)) {\n // empty statement so ensure the last item is undefined if we're last\n // checks if emptyStatement is first\n if (nodes.indexOf(node) === 0) {\n ensureLastUndefined = true;\n }\n } else {\n // bailed, we can't turn this statement into an expression\n return;\n }\n }\n\n if (ensureLastUndefined) exprs.push(buildUndefinedNode());\n\n if (exprs.length === 1) {\n return exprs[0];\n } else {\n return sequenceExpression(exprs);\n }\n}\n\nexport function replaceInline(this: NodePath, nodes: t.Node | Array<t.Node>) {\n resync.call(this);\n\n if (Array.isArray(nodes)) {\n if (Array.isArray(this.container)) {\n nodes = _verifyNodeList.call(this, nodes);\n const paths = _containerInsertAfter.call(this, nodes);\n this.remove();\n return paths;\n } else {\n return this.replaceWithMultiple(nodes);\n }\n } else {\n return this.replaceWith(nodes);\n }\n}\n"],"mappings":";;;;;;;;;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,EAAA,GAAAN,OAAA;AA+BA,IAAAO,QAAA,GAAAP,OAAA;AAAgD;EA9B9CQ,cAAc;EACdC,uBAAuB;EACvBC,oBAAoB;EACpBC,eAAe;EACfC,cAAc;EACdC,kBAAkB;EAClBC,cAAc;EACdC,SAAS;EACTC,qBAAqB;EACrBC,mBAAmB;EACnBC,qBAAqB;EACrBC,UAAU;EACVC,sBAAsB;EACtBC,uBAAuB;EACvBC,gBAAgB;EAChBC,gBAAgB;EAChBC,gBAAgB;EAChBC,YAAY;EACZC,qBAAqB;EACrBC,aAAa;EACbC,SAAS;EACTC,WAAW;EACXC,qBAAqB;EACrBC,cAAc;EACdC,eAAe;EACfC,kBAAkB;EAClBC,QAAQ;EACRC;AAAe,IAAA7B,EAAA;AAaV,SAAS8B,mBAAmBA,CAEjCC,KAAwB,EACZ;EAAA,IAAAC,eAAA;EACZC,eAAM,CAACC,IAAI,C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C;EACF,CAAC,MAAM;IACL,OAAO,IAAI,CAACmC,WAAW,CAACnC,KAAK,CAAC;EAChC;AACF","ignoreList":[]}
|
@@ -200,15 +200,7 @@ const collectorVisitor = {
|
|
200
200
|
const parent = path.scope.getBlockParent();
|
201
201
|
parent.registerDeclaration(path);
|
202
202
|
},
|
203
|
-
TSImportEqualsDeclaration(path) {
|
204
|
-
const parent = path.scope.getBlockParent();
|
205
|
-
parent.registerDeclaration(path);
|
206
|
-
},
|
207
203
|
ReferencedIdentifier(path, state) {
|
208
|
-
if (t.isTSQualifiedName(path.parent) && path.parent.right === path.node) {
|
209
|
-
return;
|
210
|
-
}
|
211
|
-
if (path.parentPath.isTSImportEqualsDeclaration()) return;
|
212
204
|
state.references.push(path);
|
213
205
|
},
|
214
206
|
ForXStatement(path, state) {
|
@@ -876,7 +868,8 @@ class Scope {
|
|
876
868
|
let firstId;
|
877
869
|
const init = [];
|
878
870
|
for (const decl of parent.declarations) {
|
879
|
-
|
871
|
+
var _firstId;
|
872
|
+
(_firstId = firstId) != null ? _firstId : firstId = decl.id;
|
880
873
|
if (decl.init) {
|
881
874
|
init.push(assignmentExpression("=", decl.id, decl.init));
|
882
875
|
}
|