diff --git a/packages/eui/.babelrc-optimize.js b/packages/eui/.babelrc-optimize.js deleted file mode 100644 index 8ebe7be7baf..00000000000 --- a/packages/eui/.babelrc-optimize.js +++ /dev/null @@ -1,15 +0,0 @@ -// See `wiki/consuming-eui/README.md` for rationale and consumer requirements. - -const baseConfig = require('./.babelrc.js'); -// Skip `propType` generation. -baseConfig.plugins.splice( - baseConfig.plugins.indexOf( - `${__dirname}/scripts/babel/proptypes-from-ts-props` - ), - 1 -); -// Transform runtimes using babel plugin. -// Requires consuming applications to use `@babel/runtime`. -baseConfig.plugins.push('@babel/plugin-transform-runtime'); -baseConfig.env = {}; -module.exports = baseConfig; diff --git a/packages/eui/.babelrc-test-env.js b/packages/eui/.babelrc-test-env.js deleted file mode 100644 index cadbc0ae21c..00000000000 --- a/packages/eui/.babelrc-test-env.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - extends: './.babelrc.js', - plugins: [ - '@babel/plugin-transform-runtime', - '@babel/plugin-transform-async-to-generator', - ], -}; diff --git a/packages/eui/.babelrc.js b/packages/eui/.babelrc.js index a9f5b16ff00..aab3106dfd2 100644 --- a/packages/eui/.babelrc.js +++ b/packages/eui/.babelrc.js @@ -1,57 +1,19 @@ module.exports = { - // We need to preserve comments as they are used by webpack for - // naming chunks during code-splitting. The compression step during - // bundling will remove them later. - "comments": true, - - "presets": [ - ["@babel/env", { - // `targets` property set via `.browserslistrc` - "useBuiltIns": process.env.NO_COREJS_POLYFILL ? false : "usage", - "corejs": !process.env.NO_COREJS_POLYFILL ? '3.6' : undefined, - "modules": process.env.BABEL_MODULES ? process.env.BABEL_MODULES === 'false' ? false : process.env.BABEL_MODULES : "commonjs" // babel's default is commonjs - }], - ["@babel/react", { runtime: 'classic' }], - ["@babel/typescript", { isTSX: true, allExtensions: true, allowDeclareFields: true }], + presets: [ + ['@babel/react', { runtime: 'classic' }], [ - "@emotion/babel-preset-css-prop", - { - "autoLabel": "always", - "labelFormat": "[local]", - "sourceMap": false, - }, + '@babel/typescript', + { isTSX: true, allExtensions: true, allowDeclareFields: true }, ], + '@emotion/babel-preset-css-prop', ], - "plugins": [ - `${__dirname}/scripts/babel/proptypes-from-ts-props`, - "add-module-exports", - // stage 3 - "@babel/proposal-object-rest-spread", - // stage 2 - "@babel/proposal-class-properties", - [ - "inline-react-svg", - { - "ignorePattern": "images/*", - "svgo": { - "plugins": [ - { "cleanupIDs": false }, - { "removeViewBox": false } - ] - } - } - ], + plugins: [ + '@babel/proposal-object-rest-spread', + '@babel/proposal-class-properties', ], - // Used for Cypress code coverage - note that the env has to be Cypress-specific, otherwise Jest --coverage throws errors - "env": { - "cypress_test": { - "plugins": ["istanbul"] - } + env: { + cypress_test: { + plugins: ['istanbul'], + }, }, - "overrides": [ - { - "include": `${__dirname}/src/components/search_bar/query/default_syntax.ts`, - "plugins": ["pegjs-inline-precompile"], - } - ] }; diff --git a/packages/eui/.browserslistrc b/packages/eui/.browserslistrc index 9154f755301..59d909205f5 100644 --- a/packages/eui/.browserslistrc +++ b/packages/eui/.browserslistrc @@ -1,8 +1,3 @@ last 2 versions not dead not IE 11 -Safari 7 -# adding as part of Storybook upgrade to v8 https://github.com/babel/babel/issues/16171#issuecomment-2015227043 -not op_mob >= 1 - -# Safari 7 for PhantomJS support \ No newline at end of file diff --git a/packages/eui/.gitignore b/packages/eui/.gitignore index 8ca732bb173..484b5c6f17c 100644 --- a/packages/eui/.gitignore +++ b/packages/eui/.gitignore @@ -25,6 +25,7 @@ node_modules **/*.out .eslintcache .yo-rc.json +.swc # TypeScript output /types diff --git a/packages/eui/.swcrc b/packages/eui/.swcrc new file mode 100644 index 00000000000..85c2d984a54 --- /dev/null +++ b/packages/eui/.swcrc @@ -0,0 +1,39 @@ +{ + "$schema": "https://swc.rs/schema.json", + "env": { + "targets": [ + "last 2 versions", + "not dead", + "not IE 11" + ] + }, + "jsc": { + "parser": { + "syntax": "typescript", + "tsx": true + }, + "transform": { + "react": { + "runtime": "automatic", + "importSource": "@emotion/react" + } + }, + "externalHelpers": false, + "preserveAllComments": true, + "experimental": { + "plugins": [ + [ + "@swc/plugin-emotion", + { + "autoLabel": "always", + "labelFormat": "[local]", + "sourceMap": false + } + ] + ] + } + }, + "module": { + "type": "commonjs" + } +} diff --git a/packages/eui/cypress/webpack.config.js b/packages/eui/cypress/webpack.config.js index 6a4cbd8a57a..4424b0b471e 100644 --- a/packages/eui/cypress/webpack.config.js +++ b/packages/eui/cypress/webpack.config.js @@ -40,11 +40,43 @@ module.exports = { rules: [ { test: /\.(js|tsx?)$/, - loader: 'babel-loader', + loader: 'swc-loader', exclude: /node_modules/, sideEffects: true, // tells webpack not to tree shake `import './'` lines options: { - plugins: ['istanbul'], + jsc: { + parser: { + syntax: 'typescript', + tsx: true, + }, + transform: { + react: { + runtime: 'classic', + importSource: '@emotion/react', + }, + }, + externalHelpers: false, + preserveAllComments: true, + experimental: { + plugins: [ + [ + '@swc/plugin-emotion', + { + autoLabel: 'always', + labelFormat: '[local]', + sourceMap: false, + }, + ], + ['swc-plugin-coverage-instrument', {}], + ], + }, + }, + env: { + targets: ['last 2 versions', 'not dead', 'not IE 11'], + }, + module: { + type: 'es6', + }, }, }, ], diff --git a/packages/eui/package.json b/packages/eui/package.json index bb37f37a730..9f990577805 100644 --- a/packages/eui/package.json +++ b/packages/eui/package.json @@ -19,7 +19,8 @@ "build:workspaces": "yarn workspaces foreach -Rti --from @elastic/eui-theme-common run build && yarn workspaces foreach -Rti --from @elastic/eui --exclude @elastic/eui --exclude @elastic/eui-theme-common run build", "build:clean": "rimraf dist lib es optimize test-env eui.d.ts", "build:i18ntokens": "node ./scripts/build_i18ntokens.mjs", - "build": "yarn build:clean && yarn build:i18ntokens && node ./scripts/compile-eui.js", + "build:query-parser": "pegjs -o src/components/search_bar/query/query_parser.js src/components/search_bar/query/query.pegjs", + "build": "yarn build:clean && yarn build:i18ntokens && yarn build:query-parser && node ./scripts/compile-eui.js", "build-pack": "yarn build && yarn pack", "compile-icons": "node ./scripts/compile-icons.js && prettier --write --loglevel=warn \"./src/components/icon/assets/**/*.tsx\"", "lint": "yarn tsc --noEmit && yarn lint-es && yarn lint-css-in-js && yarn lint-sass", @@ -55,6 +56,7 @@ "@elastic/eui-theme-common": "workspace:*", "@elastic/prismjs-esql": "^1.1.2", "@hello-pangea/dnd": "^16.6.0", + "@swc/helpers": "^0.5.17", "@types/lodash": "^4.14.202", "@types/numeral": "^2.0.5", "@types/react-window": "^1.8.8", @@ -93,8 +95,6 @@ "@babel/core": "^7.21.8", "@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-proposal-object-rest-spread": "^7.20.7", - "@babel/plugin-transform-async-to-generator": "^7.20.7", - "@babel/plugin-transform-runtime": "^7.21.4", "@babel/preset-env": "^7.21.5", "@babel/preset-react": "^7.18.6", "@babel/preset-typescript": "^7.21.5", @@ -131,6 +131,10 @@ "@svgr/core": "8.0.0", "@svgr/plugin-jsx": "^8.0.1", "@svgr/plugin-svgo": "^8.0.1", + "@swc/cli": "^0.7.9", + "@swc/core": "^1.15.2", + "@swc/jest": "^0.2.39", + "@swc/plugin-emotion": "^13.0.0", "@testing-library/jest-dom": "^5.16.3", "@testing-library/react": "^14.0.0", "@testing-library/react-17": "npm:@testing-library/react@^12.1.5", @@ -160,9 +164,6 @@ "babel-jest": "^29.7.0", "babel-loader": "^9.1.2", "babel-plugin-add-module-exports": "^1.0.4", - "babel-plugin-inline-react-svg": "^2.0.2", - "babel-plugin-istanbul": "^6.1.1", - "babel-plugin-pegjs-inline-precompile": "^0.1.1", "buffer": "^6.0.3", "buildkite-test-collector": "^1.7.2", "cache-loader": "^4.1.0", @@ -244,6 +245,8 @@ "stylelint-config-prettier-scss": "^1.0.0", "stylelint-config-standard": "^33.0.0", "stylelint-config-standard-scss": "^9.0.0", + "swc-loader": "^0.2.6", + "swc-plugin-coverage-instrument": "^0.0.32", "terser-webpack-plugin": "^5.3.5", "typescript": "^5.8.3", "uglifyjs-webpack-plugin": "^2.2.0", diff --git a/packages/eui/scripts/babel/proptypes-from-ts-props/index.js b/packages/eui/scripts/babel/proptypes-from-ts-props/index.js deleted file mode 100644 index 442670e3cd2..00000000000 --- a/packages/eui/scripts/babel/proptypes-from-ts-props/index.js +++ /dev/null @@ -1,1618 +0,0 @@ -const fs = require('fs'); -const path = require('path'); -const babelTemplate = require('@babel/template').default; -const babelCore = require('@babel/core'); - -const importedDefinitionsCache = new Map(); - -// react-docgen does not understand typescript annotations -function stripTypeScript(filename, ast) { - return babelCore.transform(babelCore.transformFromAst(ast).code, { - filename: filename, - babelrc: false, - presets: [['@babel/typescript', { allowDeclareFields: true }]], - }).code; -} - -// determine is a node is a TS*, or if it is a proptype that came from one -function isTSType(node) { - if (node == null) return false; - - if (node.isAlreadyResolved) { - return node.isTSType; - } - - return node.type.startsWith('TS'); -} - -/** - * Converts an Array type to PropTypes.arrayOf(X) - * @param node - * @param state - * @returns AST node representing matching proptypes - */ -function resolveArrayToPropTypes(node, state) { - const types = state.get('types'); - - const { typeParameters } = node; - - if (typeParameters == null) { - // Array without any type information - // PropTypes.array - return buildPropTypePrimitiveExpression(types, 'array'); - } else { - // Array with typed elements - // PropTypes.arrayOf() - // Array type only has one type argument - const { - params: [arrayType], - } = typeParameters; - return types.callExpression( - types.memberExpression( - types.identifier('PropTypes'), - types.identifier('arrayOf') - ), - [getPropTypesForNode(arrayType, false, state)] - ); - } -} - -function stripDoubleQuotes(value) { - return value.replace(/^"?(.*?)"?$/, '$1'); -} - -/** - * Converts an Omit type to resolveIdentifierToPropTypes(X) with Y removed - * @param node - * @param state - * @returns AST node representing matching proptypes - */ -function resolveOmitToPropTypes(node, state) { - const types = state.get('types'); - - const { typeParameters } = node; - - if (typeParameters == null) return null; - - const { - params: [sourceType, toRemove], - } = typeParameters; - - const sourcePropTypes = getPropTypesForNode(sourceType, true, state); - // validate that this resulted in a shape, otherwise we don't know how to extract/merge the values - if ( - !types.isCallExpression(sourcePropTypes) || - !types.isMemberExpression(sourcePropTypes.callee) || - sourcePropTypes.callee.object.name !== 'PropTypes' || - sourcePropTypes.callee.property.name !== 'shape' - ) { - return null; - } - - const toRemovePropTypes = getPropTypesForNode(toRemove, true, state); - // validate that this resulted in a oneOf, otherwise we don't know how to use the values - if ( - !types.isCallExpression(toRemovePropTypes) || - !types.isMemberExpression(toRemovePropTypes.callee) || - toRemovePropTypes.callee.object.name !== 'PropTypes' || - toRemovePropTypes.callee.property.name !== 'oneOf' - ) { - return null; - } - - // extract the string values of keys to remove - const keysToRemove = new Set( - toRemovePropTypes.arguments[0].elements - .map((keyToRemove) => - types.isStringLiteral(keyToRemove) ? keyToRemove.value : null - ) - .filter((x) => x !== null) - ); - - // filter out omitted properties - sourcePropTypes.arguments[0].properties = - sourcePropTypes.arguments[0].properties.filter( - ({ key: { name } }) => keysToRemove.has(stripDoubleQuotes(name)) === false - ); - - return sourcePropTypes; -} - -/** - * Converts an X[] type to PropTypes.arrayOf(X) - * @param node - * @param state - * @returns AST node representing matching proptypes - */ -function resolveArrayTypeToPropTypes(node, state) { - const types = state.get('types'); - - const { elementType } = node; - - if (elementType == null) { - // Array without any type information - // PropTypes.array - return buildPropTypePrimitiveExpression(types, 'array'); - } else { - // Array with typed elements - // PropTypes.arrayOf() - // Array type only has one type argument - return types.callExpression( - types.memberExpression( - types.identifier('PropTypes'), - types.identifier('arrayOf') - ), - [getPropTypesForNode(elementType, false, state)] - ); - } -} - -/** - * Resolves the node's identifier to its proptypes. - * Responsible for resolving - * - React.* (SFC, ReactNode, etc) - * - Arrays - * - MouseEventHandler is interpretted as functions - * - ExclusiveUnion custom type - * - OneOf custom type - * - defined types/interfaces (found during initial program body parsing) - * Returns `null` for unresolvable types - * @param node - * @param state - * @returns AST | null - */ -function resolveIdentifierToPropTypes(node, state) { - const typeDefinitions = state.get('typeDefinitions'); - const types = state.get('types'); - const inflightResolves = state.get('inflightResolves') || new Set(); - - // Used to inject `href` and `onClick` props for `PropsForAnchor` and `PropsForButton` utility types - const hrefPropertySignature = types.tsPropertySignature( - types.Identifier('href'), - types.TSTypeAnnotation(types.tsStringKeyword()) - ); - const onClickPropertySignature = types.tsPropertySignature( - types.Identifier('onClick'), - types.tsTypeAnnotation( - types.tsTypeReference( - types.Identifier('MouseEventHandler'), - types.tsTypeParameterInstantiation([ - types.tsTypeReference(types.Identifier('HTMLAnchorElement')), - ]) - ) - ) - ); - hrefPropertySignature.optional = onClickPropertySignature.optional = true; - - let identifier; - switch (node.type) { - case 'TSTypeReference': - identifier = node.typeName; - break; - - case 'Identifier': - identifier = node; - break; - } - - // resolve React.* identifiers - if ( - identifier.type === 'TSQualifiedName' && - identifier.left.name === 'React' - ) { - return resolveIdentifierToPropTypes(identifier.right, state); - } - - // React Component - switch (identifier.name) { - // PropTypes.element - case 'Component': - case 'ReactElement': - case 'ComponentClass': - case 'SFC': - case 'StatelessComponent': - return types.memberExpression( - types.identifier('PropTypes'), - types.identifier('element') - ); - - // PropTypes.node - case 'ReactChild': - case 'ReactNode': - return types.memberExpression( - types.identifier('PropTypes'), - types.identifier('node') - ); - - case 'ComponentType': - return types.memberExpression( - types.identifier('PropTypes'), - types.identifier('elementType') - ); - - case 'JSXElementConstructor': - return types.memberExpression( - types.identifier('PropTypes'), - types.identifier('func') // this is more accurately `elementType` but our peerDependency version of prop-types doesn't have it - ); - } - - if (identifier.name === 'Array') return resolveArrayToPropTypes(node, state); - if (identifier.name === 'Omit') return resolveOmitToPropTypes(node, state); - if (identifier.name === 'MouseEventHandler') - return buildPropTypePrimitiveExpression(types, 'func'); - if (identifier.name === 'Function') - return buildPropTypePrimitiveExpression(types, 'func'); - if (identifier.name === 'PropsForAnchor' && node.typeParameters != null) { - return getPropTypesForNode( - { - type: 'TSIntersectionType', - types: [ - types.tsTypeLiteral([ - hrefPropertySignature, - onClickPropertySignature, - ]), - ...node.typeParameters.params, - ], - }, - true, - state - ); - } - if (identifier.name === 'PropsForButton' && node.typeParameters != null) { - return getPropTypesForNode( - { - type: 'TSIntersectionType', - types: [ - types.tsTypeLiteral([onClickPropertySignature]), - ...node.typeParameters.params, - ], - }, - true, - state - ); - } - if (identifier.name === 'ExclusiveUnion') { - // We use ExclusiveUnion at the top level to exclusively discriminate between types - // propTypes itself must be an object so merge the union sets together as an intersection - - // Any types that are optional or non-existant on one side must be optional after the union - const aPropType = getPropTypesForNode( - node.typeParameters.params[0], - true, - state - ); - const bPropType = getPropTypesForNode( - node.typeParameters.params[1], - true, - state - ); - - const propsOnA = types.isCallExpression(aPropType) - ? aPropType.arguments[0].properties - : []; - const propsOnB = types.isCallExpression(bPropType) - ? bPropType.arguments[0].properties - : []; - - // optional props is any prop that is optional or non-existant on one side - const optionalProps = new Set(); - for (let i = 0; i < propsOnA.length; i++) { - const property = propsOnA[i]; - const propertyName = property.key.name; - const isOptional = !isPropTypeRequired(types, property.value); - const existsOnB = - propsOnB.find((property) => property.key.name === propertyName) != null; - if (isOptional || !existsOnB) { - optionalProps.add(propertyName); - } - } - for (let i = 0; i < propsOnB.length; i++) { - const property = propsOnB[i]; - const propertyName = property.key.name; - const isOptional = !isPropTypeRequired(types, property.value); - const existsOnA = - propsOnA.find((property) => property.key.name === propertyName) != null; - if (isOptional || !existsOnA) { - optionalProps.add(propertyName); - } - } - - const propTypes = getPropTypesForNode( - { - type: 'TSIntersectionType', - types: node.typeParameters.params, - }, - true, - state - ); - - if (types.isCallExpression(propTypes)) { - // apply the optionals - const properties = propTypes.arguments[0].properties; - for (let i = 0; i < properties.length; i++) { - const property = properties[i]; - if (optionalProps.has(property.key.name)) { - property.value = makePropTypeOptional(types, property.value); - } - } - } - - return propTypes; - } - - if (identifier.name === 'OneOf') { - // the second type parameter is ignorable as it is a subset of the first, - // and the OneOf operation cannot be well-described by proptypes - const [sourceTypes] = node.typeParameters.params; - return getPropTypesForNode(sourceTypes, true, state); - } - - // Lookup this identifier from types/interfaces defined in code - const identifierDefinition = typeDefinitions[identifier.name]; - - if (identifierDefinition) { - if (inflightResolves.has(identifier.name)) { - return types.memberExpression( - types.identifier('PropTypes'), - types.identifier('any') - ); - } - inflightResolves.add(identifier.name); - state.set('inflightResolves', inflightResolves); - - const propType = getPropTypesForNode(identifierDefinition, true, state); - - inflightResolves.delete(identifier.name); - state.set('inflightResolves', inflightResolves); - - return propType; - } else { - return null; - } -} - -/** - * Small DRY abstraction to return the AST of PropTypes.${typeName} - * @param types - * @param typeName - * @returns AST - */ -function buildPropTypePrimitiveExpression(types, typeName) { - return types.memberExpression( - types.identifier('PropTypes'), - types.identifier(typeName) - ); -} - -function isPropTypeRequired(types, propType) { - return ( - types.isMemberExpression(propType) && - types.isIdentifier(propType.property) && - propType.property.name === 'isRequired' - ); -} - -function makePropTypeRequired(types, propType) { - // can't make literals required no matter how hard we try - if (types.isLiteral(propType) === true) return propType; - - return types.memberExpression(propType, types.identifier('isRequired')); -} - -function makePropTypeOptional(types, propType) { - if (isPropTypeRequired(types, propType)) { - // strip the .isRequired member expression - return propType.object; - } - return propType; -} - -function areExpressionsIdentical(a, b) { - const aCode = babelCore.transformFromAst( - babelCore.types.program([ - babelCore.types.expressionStatement( - babelCore.types.removeComments(babelCore.types.cloneDeep(a)) - ), - ]) - ).code; - const bCode = babelCore.transformFromAst( - babelCore.types.program([ - babelCore.types.expressionStatement( - babelCore.types.removeComments(babelCore.types.cloneDeep(b)) - ), - ]) - ).code; - return aCode === bCode; -} - -/** - * Converts any literal node (StringLiteral, etc) into a PropTypes.oneOF([ literalNode ]) - * so it can be used in any proptype expression - */ -function convertLiteralToOneOf(types, literalNode) { - return types.callExpression( - types.memberExpression( - types.identifier('PropTypes'), - types.identifier('oneOf') - ), - [types.arrayExpression([literalNode])] - ); -} - -/** - * Heavy lifter to generate the proptype AST for a node. Initially called by `processComponentDeclaration`, - * its return value is set as the component's `propTypes` value. This function calls itself recursively to translate - * the whole type/interface AST into prop types. - * @param node - * @param optional - * @param state - * @returns AST | null - */ -function getPropTypesForNode(node, optional, state) { - const types = state.get('types'); - - if (node.isAlreadyResolved === true) return node; - - let propType; - switch (node.type) { - // a type value by identifier - case 'TSTypeReference': - propType = resolveIdentifierToPropTypes(node, state); - break; - - // a type annotation on a node - // Array - // ^^^ Foo - case 'TSTypeAnnotation': - propType = getPropTypesForNode(node.typeAnnotation, true, state); - - if ( - types.isLiteral(propType) || - (types.isIdentifier(propType) && propType.name === 'undefined') - ) { - // can't use a literal straight, wrap it with PropTypes.oneOf([ the_literal ]) - propType = convertLiteralToOneOf(types, propType); - } - break; - - // Foo['bar'] - case 'TSIndexedAccessType': - // verify the type of index access - if (types.isTSLiteralType(node.indexType) === false) break; - - const indexedName = node.indexType.literal.value; - const objectPropType = getPropTypesForNode(node.objectType, true, state); - - // verify this came out as a PropTypes.shape(), which we can pick the indexed property off of - if ( - types.isCallExpression(objectPropType) && - types.isMemberExpression(objectPropType.callee) && - types.isIdentifier(objectPropType.callee.object) && - objectPropType.callee.object.name === 'PropTypes' && - types.isIdentifier(objectPropType.callee.property) && - objectPropType.callee.property.name === 'shape' - ) { - const shapeProps = objectPropType.arguments[0].properties; - for (let i = 0; i < shapeProps.length; i++) { - const prop = shapeProps[i]; - if (prop.key.name === indexedName) { - propType = makePropTypeOptional(types, prop.value); - break; - } - } - } - - break; - - // translates intersections (Foo & Bar & Baz) to a shape with the types' members (Foo, Bar, Baz) merged together - case 'TSIntersectionType': - const usableNodes = [...node.types].filter((node) => { - const nodePropTypes = getPropTypesForNode(node, true, state); - - if ( - types.isMemberExpression(nodePropTypes) && - nodePropTypes.object.name === 'PropTypes' && - nodePropTypes.property.name === 'any' - ) { - return false; - } - - // validate that this resulted in a shape or oneOfType, otherwise we don't know how to extract/merge the values - if ( - !types.isCallExpression(nodePropTypes) || - !types.isMemberExpression(nodePropTypes.callee) || - nodePropTypes.callee.object.name !== 'PropTypes' || - (nodePropTypes.callee.property.name !== 'shape' && - nodePropTypes.callee.property.name !== 'oneOfType') - ) { - return false; - } - - return true; - }); - - // merge the resolved proptypes for each intersection member into one object, mergedProperties - const mergedProperties = usableNodes.reduce((mergedProperties, node) => { - let nodePropTypes = getPropTypesForNode(node, true, state); - - // if this is a `oneOfType` extract those properties into a `shape` - if ( - types.isCallExpression(nodePropTypes) && - types.isMemberExpression(nodePropTypes.callee) && - nodePropTypes.callee.object.name === 'PropTypes' && - nodePropTypes.callee.property.name === 'oneOfType' - ) { - const properties = nodePropTypes.arguments[0].elements - .map((propType) => { - // This exists on a oneOfType which must be expressed as an optional proptype - propType = makePropTypeOptional(types, propType); - - // validate we're working with a shape, otherwise we can't merge properties - if ( - !types.isCallExpression(propType) || - !types.isMemberExpression(propType.callee) || - propType.callee.object.name !== 'PropTypes' || - propType.callee.property.name !== 'shape' - ) { - return null; - } - - // extract all of the properties from this group and make them optional - return propType.arguments[0].properties.map((property) => { - property.value = makePropTypeOptional(types, property.value); - return property; - }); - }) - .filter((x) => x !== null) - .reduce((allProperties, properties) => { - return [...allProperties, ...properties]; - }, []); - - nodePropTypes = types.callExpression( - types.memberExpression( - types.identifier('PropTypes'), - types.identifier('shape') - ), - [types.objectExpression(properties)] - ); - } - - // iterate over this type's members, adding them (and their comments) to `mergedProperties` - const typeProperties = nodePropTypes.arguments[0].properties; // properties on the ObjectExpression passed to PropTypes.shape() - for (let i = 0; i < typeProperties.length; i++) { - const typeProperty = typeProperties[i]; - // this member may be duplicated between two shapes, e.g. Foo = { buzz: string } & Bar = { buzz: string } - // either or both may have leading comments and we want to forward all comments to the generated prop type - const leadingComments = [ - ...(typeProperty.leadingComments || []), - ...((mergedProperties[typeProperty.key.name] - ? mergedProperties[typeProperty.key.name].leadingComments - : null) || []), - ]; - - let propTypeValue = typeProperty.value; - if ( - types.isLiteral(propTypeValue) || - (types.isIdentifier(propTypeValue) && - propTypeValue.name === 'undefined') - ) { - // can't use a literal straight, wrap it with PropTypes.oneOf([ the_literal ]) - propTypeValue = convertLiteralToOneOf(types, propTypeValue); - } - - // if this property has already been found, the only action is to potentially change it to optional - if (mergedProperties.hasOwnProperty(typeProperty.key.name)) { - const existing = mergedProperties[typeProperty.key.name]; - if (!areExpressionsIdentical(existing, typeProperty.value)) { - mergedProperties[typeProperty.key.name] = types.callExpression( - types.memberExpression( - types.identifier('PropTypes'), - types.identifier('oneOfType') - ), - [types.arrayExpression([existing, propTypeValue])] - ); - - if ( - isPropTypeRequired(types, existing) && - isPropTypeRequired(types, typeProperty.value) - ) { - mergedProperties[typeProperty.key.name] = makePropTypeRequired( - types, - mergedProperties[typeProperty.key.name] - ); - } - } - } else { - // property hasn't been seen yet, add it - mergedProperties[typeProperty.key.name] = propTypeValue; - } - - mergedProperties[typeProperty.key.name].leadingComments = - leadingComments; - } - - return mergedProperties; - }, {}); - - const propertyKeys = Object.keys(mergedProperties); - // if there is one or more members on `mergedProperties` then use PropTypes.shape, - // otherwise none of the types were resolvable and fallback to PropTypes.any - if (propertyKeys.length > 0) { - // At least one type/interface was resolved to proptypes - propType = types.callExpression( - types.memberExpression( - types.identifier('PropTypes'), - types.identifier('shape') - ), - [ - types.objectExpression( - propertyKeys.map((propKey) => { - const objectProperty = types.objectProperty( - types.identifier(propKey), - mergedProperties[propKey] - ); - - objectProperty.leadingComments = - mergedProperties[propKey].leadingComments; - mergedProperties[propKey].leadingComments = null; - - return objectProperty; - }) - ), - ] - ); - } else { - // None of the types were resolveable, return with PropTypes.any - propType = types.memberExpression( - types.identifier('PropTypes'), - types.identifier('any') - ); - } - break; - - // translate an interface definition into a PropTypes.shape - case 'TSInterfaceBody': - propType = types.callExpression( - types.memberExpression( - types.identifier('PropTypes'), - types.identifier('shape') - ), - [ - types.objectExpression( - node.body - // This helps filter out index signatures from interfaces, - // which don't translate to prop types. - .filter( - (property) => - property.key != null && - !types.isTSNeverKeyword( - property.typeAnnotation.typeAnnotation - ) - ) - .map((property) => { - let propertyPropType = - property.type === 'TSMethodSignature' - ? getPropTypesForNode( - { type: 'TSFunctionType' }, - property.optional, - state - ) - : getPropTypesForNode( - property.typeAnnotation, - property.optional, - state - ); - - if ( - types.isLiteral(propertyPropType) || - (types.isIdentifier(propertyPropType) && - propertyPropType.name === 'undefined') - ) { - propertyPropType = convertLiteralToOneOf( - types, - propertyPropType - ); - if (!property.optional) { - propertyPropType = makePropTypeRequired( - types, - propertyPropType - ); - } - } - - const objectProperty = types.objectProperty( - types.identifier( - property.key.name || `"${property.key.value}"` - ), - propertyPropType - ); - if (property.leadingComments != null) { - objectProperty.leadingComments = property.leadingComments.map( - ({ type, value }) => ({ type, value }) - ); - } - return objectProperty; - }) - ), - ] - ); - break; - - // resolve a type operator (keyword) that operates on a value - // currently only supporting `keyof typeof [object variable]` - case 'TSTypeOperator': - if ( - node.operator === 'keyof' && - node.typeAnnotation.type === 'TSTypeQuery' - ) { - const typeDefinitions = state.get('typeDefinitions'); - const typeDefinition = - typeDefinitions[node.typeAnnotation.exprName.name]; - if (typeDefinition != null) { - propType = getPropTypesForNode(typeDefinition, true, state); - } - } - break; - - // invoked only by `keyof typeof` TSTypeOperator, safe to form PropTypes.oneOf(Object.keys(variable)) - case 'ObjectExpression': - propType = types.callExpression( - types.memberExpression( - types.identifier('PropTypes'), - types.identifier('oneOf') - ), - [ - types.arrayExpression( - node.properties.map((property) => - types.stringLiteral( - property.key - ? property.key.name || property.key.value - : property.argument.name - ) - ) - ), - ] - ); - break; - - // translate a type definition into a PropTypes.shape - case 'TSTypeLiteral': - propType = types.callExpression( - types.memberExpression( - types.identifier('PropTypes'), - types.identifier('shape') - ), - [ - types.objectExpression( - node.members - .map((property) => { - // skip never keyword - if ( - types.isTSNeverKeyword(property.typeAnnotation.typeAnnotation) - ) - return null; - // skip TS index signatures - if (types.isTSIndexSignature(property)) return null; - - const propertyPropType = - property.type === 'TSMethodSignature' - ? getPropTypesForNode( - { type: 'TSFunctionType' }, - property.optional, - state - ) - : getPropTypesForNode( - property.typeAnnotation, - property.optional, - state - ); - - const objectProperty = types.objectProperty( - types.identifier( - property.key.name || `"${property.key.value}"` - ), - propertyPropType - ); - if (property.leadingComments != null) { - objectProperty.leadingComments = property.leadingComments.map( - ({ type, value }) => ({ type, value }) - ); - } - return objectProperty; - }) - .filter((x) => x != null) - ), - ] - ); - break; - - // translate a union (Foo | Bar | Baz) into PropTypes.oneOf or PropTypes.oneOfType, depending on - // the kind of members in the union (no literal values, all literals, or mixed) - // literal values are extracted into a `oneOf`, if all members are literals this oneOf is used - // otherwise `oneOfType` is used - if there are any literal values it contains the literals' `oneOf` - case 'TSUnionType': - const tsUnionTypes = node.types.map((node) => - getPropTypesForNode(node, false, state) - ); - - // `tsUnionTypes` could be: - // 1. all non-literal values (string | number) - // 2. all literal values ("foo" | "bar") - // 3. a mix of value types ("foo" | number) - // this reduce finds any literal values and groups them into a oneOf node - - const reducedUnionTypes = tsUnionTypes.reduce( - (foundTypes, tsUnionType) => { - if ( - types.isLiteral(tsUnionType) || - (types.isIdentifier(tsUnionType) && - tsUnionType.name === 'undefined') - ) { - if (foundTypes.oneOfPropType == null) { - foundTypes.oneOfPropType = types.arrayExpression([]); - foundTypes.unionTypes.push( - types.callExpression( - types.memberExpression( - types.identifier('PropTypes'), - types.identifier('oneOf') - ), - [foundTypes.oneOfPropType] - ) - ); - } - - // this is a literal value, move to the oneOfPropType argument - foundTypes.oneOfPropType.elements.push(tsUnionType); - } else { - // this is a non-literal type - foundTypes.unionTypes.push(tsUnionType); - } - - return foundTypes; - }, - { - unionTypes: [], - oneOfPropType: null, - } - ); - - // if there is only one member on the reduced union types, _and_a oneOf proptype was created, - // then that oneOf proptype is the one member on union types, and can be be extracted out - // e.g. - // PropTypes.oneOf([PropTypes.oneOf(['red', 'blue'])]) - // -> - // PropTypes.oneOf(['red', 'blue']) - if ( - reducedUnionTypes.unionTypes.length === 1 && - reducedUnionTypes.oneOfPropType != null - ) { - // the only proptype is a `oneOf`, use only that - propType = reducedUnionTypes.unionTypes[0]; - } else { - propType = types.callExpression( - types.memberExpression( - types.identifier('PropTypes'), - types.identifier('oneOfType') - ), - [types.arrayExpression(reducedUnionTypes.unionTypes)] - ); - } - break; - - // translate enum to PropTypes.oneOf - case 'TSEnumDeclaration': - const memberTypes = node.members.map((member) => - getPropTypesForNode(member, true, state) - ); - propType = types.callExpression( - types.memberExpression( - types.identifier('PropTypes'), - types.identifier('oneOf') - ), - [types.arrayExpression(memberTypes)] - ); - break; - - // translate an interface to PropTypes - case 'TSInterfaceDeclaration': - const { body, extends: extensions } = node; - - // if the interface doesn't extend anything use just the interface body - if (extensions == null) { - propType = getPropTypesForNode(body, true, state); - } else { - // fake a TSIntersectionType to merge everything together - propType = getPropTypesForNode( - { - type: 'TSIntersectionType', - types: [body, ...extensions], - }, - true, - state - ); - } - break; - - // simple pass-through wrapper - case 'TSExpressionWithTypeArguments': - propType = resolveIdentifierToPropTypes(node.expression, state); - break; - - // an enum member is a simple wrapper around a type definition - case 'TSEnumMember': - propType = getPropTypesForNode(node.initializer, optional, state); - break; - - // translate `string` to `PropTypes.string` - case 'TSStringKeyword': - propType = buildPropTypePrimitiveExpression(types, 'string'); - break; - - // translate `number` to `PropTypes.number` - case 'TSNumberKeyword': - propType = buildPropTypePrimitiveExpression(types, 'number'); - break; - - // translate `boolean` to `PropTypes.bool` - case 'TSBooleanKeyword': - propType = buildPropTypePrimitiveExpression(types, 'bool'); - break; - - // translate any function type to `PropTypes.func` - case 'TSFunctionType': - propType = buildPropTypePrimitiveExpression(types, 'func'); - break; - - // translate an array type, e.g. Foo[] - case 'TSArrayType': - propType = resolveArrayTypeToPropTypes(node, state); - break; - - // parenthesized type is a small wrapper around another type definition - // e.g. (() => void)[] - // ^^^^^^^^^^^^ wrapping the TSFunctionType `() => void` - case 'TSParenthesizedType': - propType = getPropTypesForNode(node.typeAnnotation, optional, state); - optional = true; // handling `optional` has been delegated to the above call - break; - - // literal type wraps a literal value - case 'TSLiteralType': - propType = getPropTypesForNode(node.literal, true, state); - optional = true; // cannot call `.isRequired` on a literal - break; - - case 'StringLiteral': - propType = types.stringLiteral(node.value); - optional = true; // cannot call `.isRequired` on a string literal - break; - - case 'NumericLiteral': - propType = types.numericLiteral(node.value); - optional = true; // cannot call `.isRequired` on a number literal - break; - - case 'BooleanLiteral': - propType = types.booleanLiteral(node.value); - optional = true; // cannot call `.isRequired` on a boolean literal - break; - - case 'TSNullKeyword': - propType = types.nullLiteral(); - optional = true; // cannot call `.isRequired` on a null literal - break; - - case 'TSUndefinedKeyword': - propType = types.identifier('undefined'); - optional = true; // cannot call `.isRequired` on an undefined literal - break; - - // very helpful debugging code - // default: - // debugger; - // throw new Error(`Could not generate prop types for node type ${node.type}`); - } - - // if the node was unable to be translated to a prop type, fallback to PropTypes.any - if (propType == null) { - propType = types.memberExpression( - types.identifier('PropTypes'), - types.identifier('any') - ); - } - - if (!optional) { - propType = makePropTypeRequired(types, propType); - } - - if (isTSType(node)) { - propType.isTSType = true; - } - - return propType; -} - -const typescriptExtensions = new Set(['', '.ts', '.tsx']); - -// typeDefinitionExtractors is a mapping of [ast_node_type: func] which is used to find type definitions -// these definitions come from four sources: -// - import statements -// - interface declaration -// - type declaration -// - enum declaration -const typeDefinitionExtractors = { - /** - * Looks at the named imports from _relative files_ (nothing from node_modues) - * The imported source is then loaded & parsed, in the same way recursively resolving that files' typescript definitions - * After parsing, the imported definitions are extracted, pre-resolved, and marked with `isAlreadyResolved = true` - * @param node - * @param extractionOptions - * @returns Array - */ - ImportDeclaration: (node, extractionOptions) => { - const { fs, sourceFilename, parse, state } = extractionOptions; - const importPath = node.source.value; - const isPathRelative = /^\.{1,2}\//.test(importPath); - const pathExtension = path.extname(importPath); - const isImportTypecript = typescriptExtensions.has(pathExtension); - - // only process relative imports for typescript definitions (avoid node_modules) - if (isPathRelative && isImportTypecript) { - // find the variable names being imported - const importedTypeNames = node.specifiers.map((specifier) => { - switch (specifier.type) { - case 'ImportSpecifier': - return specifier.imported.name; - case 'ExportSpecifier': - return specifier.local.name; - - // default: - // throw new Error(`Unable to process import specifier type ${specifier.type}`); - } - }); - - // find the file pointed to by `importPath` - let resolvedPath = path.resolve(path.dirname(sourceFilename), importPath); - if (fs.existsSync(resolvedPath)) { - // imported path exists, it might be a directory or a file - const isDirectory = fs.statSync(resolvedPath).isDirectory(); - if (isDirectory) { - // imported path is a directory, try resolving to the /index.ts - resolvedPath = `${resolvedPath}${path.sep}index.ts`; - if (!fs.existsSync(resolvedPath)) { - // no index file to resolve to, return with no found type definitions - return []; - } - } - } else if (fs.existsSync(`${resolvedPath}.ts`)) { - resolvedPath += '.ts'; - } else if (fs.existsSync(`${resolvedPath}.tsx`)) { - resolvedPath += '.tsx'; - } else if (!fs.existsSync(resolvedPath)) { - // could not resolve this file, skip out - return []; - } - - const cacheKey = `${sourceFilename}_${resolvedPath}`; - if (importedDefinitionsCache.has(cacheKey)) { - return importedDefinitionsCache.get(cacheKey); - } - - // to support circular dependencies, create & pre-cache the array of imported dependencies - // this array is directly mutated after parsing the subsequent files, supporting - // the circular nature as values settle into the correct locations - const importedDefinitions = []; - importedDefinitionsCache.set(cacheKey, importedDefinitions); - - // load & parse the imported file - const ast = parse(fs.readFileSync(resolvedPath).toString()); - - // extract any type definitions in the imported file - const definitions = []; - const subExtractionOptions = { - ...extractionOptions, - sourceFilename: resolvedPath, - }; - for (let i = 0; i < ast.program.body.length; i++) { - const bodyNode = ast.program.body[i]; - Array.prototype.push.apply( - definitions, - extractTypeDefinition(bodyNode, subExtractionOptions) || [] - ); - } - - // temporarily override typeDefinitions so variable scope doesn't bleed between files - const _typeDefinitions = state.get('typeDefinitions'); - state.set( - 'typeDefinitions', - definitions.reduce((typeDefinitions, definition) => { - if (definition) { - typeDefinitions[definition.name] = definition.definition; - } - - return typeDefinitions; - }, {}) - ); - - // for each importedTypeName, fully resolve the type information - definitions.forEach(({ name, definition }) => { - if (importedTypeNames.includes(name)) { - // this type declaration is imported by the parent script - const propTypes = getPropTypesForNode(definition, true, state); - propTypes.isAlreadyResolved = true; // when getPropTypesForNode is called on this node later, tell it to skip processing - importedDefinitions.push({ name, definition: propTypes }); - } - }); - - // reset typeDefinitions and continue processing the original file - state.set('typeDefinitions', _typeDefinitions); - - return importedDefinitions; - } - - return []; - }, - - /** - * Associates this interfaces's identifier name with its definition - * @param node - * @returns Array - */ - TSInterfaceDeclaration: (node) => { - const { id } = node; - - if (id.type !== 'Identifier') { - throw new Error( - `TSInterfaceDeclaration typeDefinitionExtract could not understand id type ${id.type}` - ); - } - - return [{ name: id.name, definition: node }]; - }, - - /** - * Associates this type's identifier name with its definition - * @param node - * @returns Array - */ - TSTypeAliasDeclaration: (node) => { - const { id, typeAnnotation } = node; - - if (id.type !== 'Identifier') { - throw new Error( - `TSTypeAliasDeclaraction typeDefinitionExtract could not understand id type ${id.type}` - ); - } - return [{ name: id.name, definition: typeAnnotation }]; - }, - - /** - * Associates this enum's identifier name with its definition - * @param node - * @returns Array - */ - TSEnumDeclaration: (node) => { - const { id } = node; - - if (id.type !== 'Identifier') { - throw new Error( - `TSEnumDeclaration typeDefinitionExtract could not understand id type ${id.type}` - ); - } - - return [{ name: id.name, definition: node }]; - }, - - /** - * Tracks variable declarations as object definitions are used by `keyof typeof [object variable] - * @param node - * @returns Array - */ - VariableDeclaration: (node) => { - return node.declarations.reduce((declarations, declaration) => { - if ( - declaration.init != null && - declaration.init.type === 'ObjectExpression' - ) { - declarations.push({ - name: declaration.id.name, - definition: declaration.init, - }); - } - return declarations; - }, []); - }, - - ExportNamedDeclaration: (node, extractionOptions) => { - const types = extractionOptions.state.get('types'); - if (types.isStringLiteral(node.source)) { - // export { variable } from './location' - // for our needs, this node type overlaps an ImportDeclaration - return typeDefinitionExtractors.ImportDeclaration( - node, - extractionOptions - ); - } - return extractTypeDefinition(node.declaration); - }, -}; -function extractTypeDefinition(node, opts) { - if (node == null) { - return null; - } - return typeDefinitionExtractors.hasOwnProperty(node.type) - ? typeDefinitionExtractors[node.type](node, opts) - : null; -} - -/** - * given the node path, walks up the path's scope looking for the variable binding `variableName` - * @param path - * @param variableName - * @returns nodePath | null - */ -function getVariableBinding(path, variableName) { - while (path) { - if (path.scope.bindings[variableName]) - return path.scope.bindings[variableName]; - path = path.parentPath; - } - return null; -} - -/** - * Takes an AST of PropTypes.* and walks down until an ObjectExpression is found. - * Required as a component's `propTypes` definition itself is an object (ObjectExpression) - * and the AST node passed here is an actual PropType call itself; without this method the result would be - * FooComponent.propTypes = PropTypes.shape({ ... }); - * which getPropTypesNodeFromAST converts to - * FooComponent.propTypes = { ... }; - * @param node - * @param types - * @returns {*} - */ -function getPropTypesNodeFromAST(node, types) { - switch (node.type) { - case 'MemberExpression': - return getPropTypesNodeFromAST(node.object, types); - - case 'CallExpression': - return getPropTypesNodeFromAST(node.arguments[0], types); - } - return node; -} - -// Used to generate AST for assigning component's propTypes -const buildPropTypes = babelTemplate('COMPONENT_NAME.propTypes = PROP_TYPES'); - -/** - * Called with a type definition and a React component node path, `processComponentDeclaration` translates that definition - * to an AST of PropType.* calls and attaches those prop types to the component. - * @param typeDefinition - * @param path - * @param state - */ -function processComponentDeclaration(typeDefinition, path, state) { - const types = state.get('types'); - - const propTypesAST = getPropTypesForNode(typeDefinition, false, state); - - // if the resulting proptype is PropTypes.any don't bother setting the proptypes - if ( - types.isMemberExpression(propTypesAST.object) && - propTypesAST.object.property.name === 'any' - ) - return; - - const propTypes = getPropTypesNodeFromAST( - // `getPropTypesForNode` returns a PropTypes.shape representing the top-level object, we need to - // reach into the shape call expression and use the object literal directly - propTypesAST, - types - ); - - const ancestry = path.getAncestry(); - - // find the ancestor who lives in the nearest block - let blockChildAncestor = ancestry[0]; - for (let i = 1; i < ancestry.length; i++) { - const ancestor = ancestry[i]; - if (ancestor.isBlockParent()) { - // stop here, we want to insert the propTypes assignment into this block, - // immediately after the already found `blockChildAncestor` - break; - } - blockChildAncestor = ancestor; - } - - blockChildAncestor.insertAfter([ - buildPropTypes({ - COMPONENT_NAME: types.identifier(path.node.id.name), - PROP_TYPES: propTypes, - }), - ]); - - // import PropTypes library if it isn't already - const proptypesBinding = getVariableBinding(path, 'PropTypes'); - if (proptypesBinding == null && state.get('hasInjectedPropTypes') !== true) { - let targetNode; - // find the first statement in the program and import PropTypes there - targetNode = path; - while (targetNode.parentPath.parentPath != null) { - targetNode = targetNode.parentPath; - } - while (targetNode.getPrevSibling().node != null) { - targetNode = targetNode.getPrevSibling(); - } - - targetNode.insertAfter( - types.importDeclaration( - [types.importDefaultSpecifier(types.identifier('PropTypes'))], - types.stringLiteral('prop-types') - ) - ); - state.set('hasInjectedPropTypes', true); - } -} - -module.exports = function propTypesFromTypeScript({ types }) { - return { - visitor: { - /** - * Visit the program path to setup the processing initial state. - * @param programPath - * @param state - */ - Program: { - enter: function visitProgram(programPath, state) { - // only process typescript files - if ( - path.extname(state.file.opts.filename) !== '.ts' && - path.extname(state.file.opts.filename) !== '.tsx' - ) - return; - - // Extract any of the imported variables from 'react' (SFC, ReactNode, etc) - // we do this here instead of resolving when the imported values are used - // as the babel typescript preset strips type-only imports before babel visits their usages - const importsFromReact = new Set(); - programPath.traverse( - { - ImportDeclaration: ({ node }) => { - if (node.source.value === 'react') { - node.specifiers.forEach((specifier) => { - if (specifier.type === 'ImportSpecifier') { - importsFromReact.add(specifier.local.name); - } - }); - } - }, - }, - state - ); - state.set('importsFromReact', importsFromReact); - - const { opts = {} } = state; - const typeDefinitions = {}; - state.set('typeDefinitions', typeDefinitions); - state.set('types', types); - - // extraction options are used to further resolve types imported from other files - const extractionOptions = { - state, - sourceFilename: path.resolve( - process.cwd(), - this.file.opts.filename - ), - fs: opts.fs || fs, - parse: (code) => babelCore.parse(code, state.file.opts), - }; - - // collect named TS type definitions for later reference - for (let i = 0; i < programPath.node.body.length; i++) { - const bodyNode = programPath.node.body[i]; - const extractedDefinitions = - extractTypeDefinition(bodyNode, extractionOptions) || []; - for (let i = 0; i < extractedDefinitions.length; i++) { - const typeDefinition = extractedDefinitions[i]; - if (typeDefinition) { - typeDefinitions[typeDefinition.name] = - typeDefinition.definition; - } - } - } - }, - }, - - /** - * Visit class declarations and check to see if it extends React.Component - * If so process the definition and add generate the component's propTypes. - * @param nodePath - * @param state - */ - ClassDeclaration: function visitClassDeclaration(nodePath, state) { - // only process typescript files - if ( - path.extname(state.file.opts.filename) !== '.ts' && - path.extname(state.file.opts.filename) !== '.tsx' - ) - return; - - const types = state.get('types'); - - if (nodePath.node.superClass != null) { - let isReactComponent = false; - - if (types.isMemberExpression(nodePath.node.superClass)) { - const objectName = nodePath.node.superClass.object.name; - const propertyName = nodePath.node.superClass.property.name; - if ( - objectName === 'React' && - (propertyName === 'Component' || propertyName === 'PureComponent') - ) { - isReactComponent = true; - } - } else if (types.isIdentifier(nodePath.node.superClass)) { - const identifierName = nodePath.node.superClass.name; - if ( - identifierName === 'Component' || - identifierName === 'PureComponent' - ) { - if (state.get('importsFromReact').has(identifierName)) { - isReactComponent = true; - } - } - } - - if (isReactComponent && nodePath.node.superTypeParameters != null) { - processComponentDeclaration( - nodePath.node.superTypeParameters.params[0], - nodePath, - state - ); - - // babel-plugin-react-docgen passes `this.file.code` to react-docgen - // instead of using the modified AST; to expose our changes to react-docgen - // they need to be rendered to a string - this.file.code = stripTypeScript( - this.file.opts.filename, - this.file.ast - ); - } - } - }, - - /** - * Visit class declarations and check to see if it they are annotated as an SFC - * If so process the definition and add generate the component's propTypes. - * @param nodePath - * @param state - */ - VariableDeclarator: function visitVariableDeclarator(nodePath, state) { - // only process typescript files - if ( - path.extname(state.file.opts.filename) !== '.ts' && - path.extname(state.file.opts.filename) !== '.tsx' - ) - return; - - const resolveVariableDeclarator = (variableDeclarator) => { - const { id } = variableDeclarator; - const idTypeAnnotation = id.typeAnnotation; - let fileCodeNeedsUpdating = false; - - if ( - // this is a function call - types.isCallExpression(variableDeclarator.init) && - // is this forwardRef() - ((types.isIdentifier(variableDeclarator.init.callee) && - variableDeclarator.init.callee.name === 'forwardRef' && - variableDeclarator.init.typeParameters && - variableDeclarator.init.typeParameters.params.length === 2) || - // or is this React.forwardRef() - (types.isMemberExpression(variableDeclarator.init.callee) && - types.isIdentifier(variableDeclarator.init.callee.object) && - variableDeclarator.init.callee.object.name === 'React' && - types.isIdentifier(variableDeclarator.init.callee.property) && - variableDeclarator.init.callee.property.name === 'forwardRef')) - ) { - // props for the component come from the second argument to the type params - const typeDefinition = - variableDeclarator.init.typeParameters.params[1]; - fileCodeNeedsUpdating = true; - processComponentDeclaration(typeDefinition, nodePath, state); - } else if (idTypeAnnotation) { - if (idTypeAnnotation.typeAnnotation.type === 'TSTypeReference') { - if ( - idTypeAnnotation.typeAnnotation.typeName.type === - 'TSQualifiedName' - ) { - const { left, right } = - idTypeAnnotation.typeAnnotation.typeName; - - if (left.name === 'React') { - const rightName = right.name; - if ( - rightName === 'SFC' || - rightName === 'FunctionComponent' - ) { - processComponentDeclaration( - idTypeAnnotation.typeAnnotation.typeParameters.params[0], - nodePath, - state - ); - fileCodeNeedsUpdating = true; - } else { - // throw new Error(`Cannot process annotation id React.${right.name}`); - } - } - } else if ( - idTypeAnnotation.typeAnnotation.typeName.type === 'Identifier' - ) { - const typeName = idTypeAnnotation.typeAnnotation.typeName.name; - if (typeName === 'SFC' || typeName === 'FunctionComponent') { - if (state.get('importsFromReact').has(typeName)) { - // Declarations like `const Foo: FunctionComponent` - // don't have type parameters. It's a valid declaration - // because the generic argument has a default of empty - // props. - if (idTypeAnnotation.typeAnnotation.typeParameters) { - processComponentDeclaration( - idTypeAnnotation.typeAnnotation.typeParameters - .params[0], - nodePath, - state - ); - fileCodeNeedsUpdating = true; - } - } - } else { - // reprocess this variable declaration but use the identifier lookup - const nextTypeDefinition = - state.get('typeDefinitions')[typeName]; - const types = state.get('types'); - if ( - nextTypeDefinition && - types.isTSType(nextTypeDefinition) - ) { - const newId = types.cloneDeep(id); - newId.typeAnnotation = - types.TSTypeAnnotation(nextTypeDefinition); - const newNode = types.VariableDeclarator( - newId, - variableDeclarator.init - ); - resolveVariableDeclarator(newNode); - } - } - } else { - throw new Error( - 'Cannot process annotation type of', - idTypeAnnotation.typeAnnotation.id.type - ); - } - } - } - - if (fileCodeNeedsUpdating) { - // babel-plugin-react-docgen passes `this.file.code` to react-docgen - // instead of using the modified AST; to expose our changes to react-docgen - // they need to be rendered to a string - this.file.code = stripTypeScript( - this.file.opts.filename, - this.file.ast - ); - } - }; - - // kick off the recursive search for a React component in this node - resolveVariableDeclarator(nodePath.node); - }, - }, - }; -}; - -module.exports.clearImportCache = function clearImportCache() { - importedDefinitionsCache.clear(); -}; diff --git a/packages/eui/scripts/babel/proptypes-from-ts-props/index.test.ts b/packages/eui/scripts/babel/proptypes-from-ts-props/index.test.ts deleted file mode 100644 index 0fad81ae002..00000000000 --- a/packages/eui/scripts/babel/proptypes-from-ts-props/index.test.ts +++ /dev/null @@ -1,2548 +0,0 @@ -/* eslint-disable @typescript-eslint/no-var-requires */ - -const path = require('path'); -const core = require('@babel/core'); -const babelOptions = { - babelrc: false, - presets: ['@babel/typescript'], - plugins: ['./scripts/babel/proptypes-from-ts-props'], - filename: 'somefile.tsx', -}; -const babelPlugin = require('./index'); - -const transform = (input: string, options: object) => { - const result = core.transform(input, options); - result.code = result.code.replace(/[\r\n]+/g, '\n') - return result; -} - -beforeEach(() => babelPlugin.clearImportCache()); - -describe('proptypes-from-ts-props', () => { - describe('proptype generation', () => { - describe('basic generation', () => { - it('imports PropTypes and creates an empty propTypes object on the component', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = {};`); - }); - - it('creates the propTypes assignment at the nearest block', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {} -(function() { - if (true) { - const FooComponent: React.SFC = () => { - return (
Hello World
); - } - } -})();`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -(function () { - if (true) { - const FooComponent = () => { - return
Hello World
; - }; - FooComponent.propTypes = {}; - } -})();`); - }); - }); - - describe('primitive propTypes', () => { - it('understands string props', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: string} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.string.isRequired -};`); - }); - - it('understands number props', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: number} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.number.isRequired -};`); - }); - - it('understands boolean props', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: boolean} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.bool.isRequired -};`); - }); - - it('understands undefined & null props', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps { - foo: undefined; - bar: null; - bazz: undefined | null; -} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.oneOf([undefined]).isRequired, - bar: PropTypes.oneOf([null]).isRequired, - bazz: PropTypes.oneOf([undefined, null]).isRequired -};`); - }); - - it('understands function props', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps { - bar: () => void -} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.func.isRequired -};`); - }); - - it('understands optional props', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar?: number} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.number -};`); - }); - - it('understands mixed props', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps { - bar1: string, - bar2?: number, - bar3: (x: number, y: number) => string, - bar4?: () => void, - bar5: boolean -} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar1: PropTypes.string.isRequired, - bar2: PropTypes.number, - bar3: PropTypes.func.isRequired, - bar4: PropTypes.func, - bar5: PropTypes.bool.isRequired -};`); - }); - - it('understands literal values as a type', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps { - foo: 'bar'; - bazz?: 5; -} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.oneOf(["bar"]).isRequired, - bazz: PropTypes.oneOf([5]) -};`); - }); - - it('should ignore never keyword', () => { - const result = transform( - ` -import React from 'react'; -interface Props{ - foo: never; -} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = {};`); - }); - }); - - describe('function propTypes', () => { - it('understands function props on interfaces', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps { - foo(): ReactElement; - bar?(arg: number): string; - fizz: Function; - buzz?: (arg: boolean) => string; -} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.func.isRequired, - bar: PropTypes.func, - fizz: PropTypes.func.isRequired, - buzz: PropTypes.func -};`); - }); - - it('understands function props on types', () => { - const result = transform( - ` -import React from 'react'; -type FooProps = { - foo(): ReactElement; - bar?(arg: number): string; - fizz: Function; - buzz?: (arg: boolean) => string; -} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.func.isRequired, - bar: PropTypes.func, - fizz: PropTypes.func.isRequired, - buzz: PropTypes.func -};`); - }); - }); - - describe('enum / oneOf propTypes', () => { - describe('union type', () => { - it('understands a union of strings', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {flower: 'daisy' | 'daffodil' | 'dandelion'} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - flower: PropTypes.oneOf(["daisy", "daffodil", "dandelion"]).isRequired -};`); - }); - - it('understands a union of numbers', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {prime: 2 | 3 | 5 | 7 | 11 | 13} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - prime: PropTypes.oneOf([2, 3, 5, 7, 11, 13]).isRequired -};`); - }); - - it('understands a union of booleans', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {visible: true | false} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - visible: PropTypes.oneOf([true, false]).isRequired -};`); - }); - - it('understands a mix of primitives', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bool: true | false | 'FileNotFound'} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bool: PropTypes.oneOf([true, false, "FileNotFound"]).isRequired -};`); - }); - - it('understands optional unions', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar?: 'hello' | 'world'} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.oneOf(["hello", "world"]) -};`); - }); - }); - - describe('enum', () => { - it('understands enum of strings', () => { - const result = transform( - ` -import React from 'react'; -enum Foo { - bar = 'BAR', - baz = 'BAZ', -}; -interface IFooProps {foo: Foo} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -var Foo = /*#__PURE__*/function (Foo) { - Foo["bar"] = "BAR"; - Foo["baz"] = "BAZ"; - return Foo; -}(Foo || {}); -; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.oneOf(["BAR", "BAZ"]).isRequired -};`); - }); - - it('understands enum of numbers', () => { - const result = transform( - ` -import React from 'react'; -enum Foo { - bar = 3, - baz = 54, -}; -interface IFooProps {foo: Foo} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -var Foo = /*#__PURE__*/function (Foo) { - Foo[Foo["bar"] = 3] = "bar"; - Foo[Foo["baz"] = 54] = "baz"; - return Foo; -}(Foo || {}); -; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.oneOf([3, 54]).isRequired -};`); - }); - - it('understands a mix of primitives', () => { - const result = transform( - ` -import React from 'react'; -enum Foo { - bar = 'BAR', - baz = 5, - buzz = false, -}; -interface IFooProps {foo: Foo} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -var Foo = /*#__PURE__*/function (Foo) { - Foo["bar"] = "BAR"; - Foo[Foo["baz"] = 5] = "baz"; - Foo[Foo["buzz"] = false] = "buzz"; - return Foo; -}(Foo || {}); -; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.oneOf(["BAR", 5, false]).isRequired -};`); - }); - - it('understands optional enums', () => { - const result = transform( - ` -import React from 'react'; -enum Foo { - bar = 'BAR', - baz = 'BAZ', -}; -interface IFooProps {foo?: Foo} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -var Foo = /*#__PURE__*/function (Foo) { - Foo["bar"] = "BAR"; - Foo["baz"] = "BAZ"; - return Foo; -}(Foo || {}); -; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.oneOf(["BAR", "BAZ"]) -};`); - }); - }); - - describe('keyof typeof', () => { - it('understands keyof typeof', () => { - const result = transform( - ` -import React from 'react'; -const FooMap = { - foo: 'bar', - fizz: 'buzz', -}; -interface IFooProps {foo: keyof typeof FooMap} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooMap = { - foo: 'bar', - fizz: 'buzz' -}; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.oneOf(["foo", "fizz"]).isRequired -};`); - }); - }); - }); - - describe('object / shape propTypes', () => { - it('understands an object of primitive values', () => { - const result = transform( - ` -import React from 'react'; -interface iFoo {name: string, age: number} -interface IFooProps {person: iFoo} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - person: PropTypes.shape({ - name: PropTypes.string.isRequired, - age: PropTypes.number.isRequired - }).isRequired -};`); - }); - - it('understands an object of object values', () => { - const result = transform( - ` -import React from 'react'; -interface iBar {name: string} -interface iFoo {name: string, age: number} -interface iFizz {bar: iBar, foo?: iFoo} -interface IFooProps {fizz: iFizz} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - fizz: PropTypes.shape({ - bar: PropTypes.shape({ - name: PropTypes.string.isRequired - }).isRequired, - foo: PropTypes.shape({ - name: PropTypes.string.isRequired, - age: PropTypes.number.isRequired - }) - }).isRequired -};`); - }); - }); - - describe('React component & element propTypes', () => { - describe('element propType', () => { - it('understands React.Component', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {foo: React.Component} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.element.isRequired -};`); - }); - - it('understands Component', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {foo: Component} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.element.isRequired -};`); - }); - - it('understands React.ReactElement

', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {foo: React.ReactElement} -const FooComponent: React.SFC = () => { - return (

Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.element.isRequired -};`); - }); - - it('understands ReactElement

', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {foo: ReactElement} -const FooComponent: React.SFC = () => { - return (

Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.element.isRequired -};`); - }); - - it('understands React.ComponentClass', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {foo: React.ComponentClass} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.element.isRequired -};`); - }); - - it('understands ComponentClass', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {foo: ComponentClass} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.element.isRequired -};`); - }); - - it('understands React.SFC', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {foo: React.SFC} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.element.isRequired -};`); - }); - - it('understands SFC', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {foo: SFC} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.element.isRequired -};`); - }); - - it('understands JSXElementConstructor', () => { - const result = transform( - ` -import React from 'react'; -const FooComponent: React.SFC<{foo: JSXElementConstructor}> = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.func.isRequired -};`); - }); - }); - - describe('node propType', () => { - it('understands React.ReactNode', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {foo: React.ReactNode} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.node.isRequired -};`); - }); - - it('understands ReactNode', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {foo: ReactNode} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.node.isRequired -};`); - }); - }); - - describe('elementType propType', () => { - it('understands React.ComponentType', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {foo: React.ComponentType, bar: React.ComponentType<{ prop: any }>} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.elementType.isRequired, - bar: PropTypes.elementType.isRequired -};`); - }); - - it('understands ComponentType', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {foo: ComponentType, bar: ComponentType<{ prop: any }>} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.elementType.isRequired, - bar: PropTypes.elementType.isRequired -};`); - }); - }); - }); - - describe('intersection types', () => { - it('intersects multiple types together', () => { - const result = transform( - ` -import React from 'react'; -interface iBar {name: string} -interface iFoo {age: number} -interface IFooProps {fizz: iBar & iFoo} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - fizz: PropTypes.shape({ - name: PropTypes.string.isRequired, - age: PropTypes.number.isRequired - }).isRequired -};`); - }); - - it('intersects overlapping types together', () => { - const result = transform( - ` -import React from 'react'; -interface iBar {name: string} -interface iFoo {name: string, age: number} -interface IFooProps {fizz: iBar & iFoo} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - fizz: PropTypes.shape({ - name: PropTypes.string.isRequired, - age: PropTypes.number.isRequired - }).isRequired -};`); - }); - - it('intersects extended interfaces', () => { - const result = transform( - ` -import React from 'react'; -interface iFoo {foo: string} -interface iBar {bar?: number} -interface iBuzz extends iFoo, iBar {buzz: boolean} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - buzz: PropTypes.bool.isRequired, - foo: PropTypes.string.isRequired, - bar: PropTypes.number -};`); - }); - }); - - describe('union types', () => { - it('unions primitive types and values', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: string | 5 | 6} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.oneOf([5, 6])]).isRequired -};`); - }); - - it('unions custom types', () => { - const result = transform( - ` -import React from 'react'; -interface iFoo {foo: string, bar?: number} -type Bar = {name: string, isActive: true | false} -interface IFooProps {buzz: iFoo | Bar} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - buzz: PropTypes.oneOfType([PropTypes.shape({ - foo: PropTypes.string.isRequired, - bar: PropTypes.number - }).isRequired, PropTypes.shape({ - name: PropTypes.string.isRequired, - isActive: PropTypes.oneOf([true, false]).isRequired - }).isRequired]).isRequired -};`); - }); - - it('intersects ExclusiveUnion arguments', () => { - const result = transform( - ` -import React from 'react'; -export type ExclusiveUnion = any; -interface BaseProps { asdf: boolean } -interface IFooProps extends BaseProps {d: number, foo?: string} -interface IBarProps extends BaseProps {d: string, foo: string, bar: string} -const FooComponent: React.SFC> = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - d: PropTypes.oneOfType([PropTypes.number.isRequired, PropTypes.string.isRequired]).isRequired, - foo: PropTypes.oneOfType([PropTypes.string, PropTypes.string.isRequired]), - asdf: PropTypes.bool.isRequired, - bar: PropTypes.string -};`); - }); - - it('parses PropsForAnchor and PropsForButton arguments', () => { - const result = transform( - ` -import React from 'react'; -interface PropsA { a: boolean } -interface PropsB { b?: number } -interface PropsC { c: string } -interface PropsD { d?: null } -type Props = PropsForAnchor & PropsForButton -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - href: PropTypes.string, - onClick: PropTypes.func, - a: PropTypes.bool.isRequired, - b: PropTypes.number, - c: PropTypes.string.isRequired, - d: PropTypes.oneOf([null]) -};`); - }); - - it('intersects overlapping string enums in ExclusiveUnion', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {type: 'foo', value: string} -interface IBarProps {type: 'bar', value: number} -const FooComponent: React.SFC> = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - type: PropTypes.oneOfType([PropTypes.oneOf(["foo"]).isRequired, PropTypes.oneOf(["bar"]).isRequired]).isRequired, - value: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.number.isRequired]).isRequired -};`); - }); - - it('treats null and undefined as literals', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: 'five' | null | undefined} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.oneOf(["five", null, undefined]).isRequired -};`); - }); - }); - - describe('array / arrayOf propTypes', () => { - describe('Array', () => { - it('understands an Array of strings', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: Array} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.arrayOf(PropTypes.string.isRequired).isRequired -};`); - }); - - it('understands an Array of numbers', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: Array} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.arrayOf(PropTypes.number.isRequired).isRequired -};`); - }); - - it('understands an Array of booleans', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: Array} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.arrayOf(PropTypes.bool.isRequired).isRequired -};`); - }); - - it('understands an Array of functions', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: Array<() => void>} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.arrayOf(PropTypes.func.isRequired).isRequired -};`); - }); - - it('understands an Array of literal values', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: Array<'foo' | 'bar'>} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.arrayOf(PropTypes.oneOf(["foo", "bar"]).isRequired).isRequired -};`); - }); - - it('understands an Array of mixed literal and non-literal types', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: Array} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.oneOf([5, 6])]).isRequired).isRequired -};`); - }); - - it('understands an optional Array of strings and numbers', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar?: Array} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.number.isRequired]).isRequired) -};`); - }); - - it('understands an Array of a custom type', () => { - const result = transform( - ` -import React from 'react'; -interface FooBar {foo: string, bar?: boolean} -interface IFooProps {bar: Array} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.arrayOf(PropTypes.shape({ - foo: PropTypes.string.isRequired, - bar: PropTypes.bool - }).isRequired).isRequired -};`); - }); - }); - - describe('T[]', () => { - it('understands an Array of strings', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: string[]} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.arrayOf(PropTypes.string.isRequired).isRequired -};`); - }); - - it('understands an Array of numbers', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: number[]} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.arrayOf(PropTypes.number.isRequired).isRequired -};`); - }); - - it('understands an Array of booleans', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: boolean[]} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.arrayOf(PropTypes.bool.isRequired).isRequired -};`); - }); - - it('understands an Array of functions', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: (() => void)[]} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.arrayOf(PropTypes.func.isRequired).isRequired -};`); - }); - - it('understands an Array of literal values', () => { - const result = transform( - ` -import React from 'react'; -type BarType = 'foo' | 'bar' -interface IFooProps {bar: BarType[]} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.arrayOf(PropTypes.oneOf(["foo", "bar"]).isRequired).isRequired -};`); - }); - - it('understands an Array of mixed literal and non-literal types', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: (string | 5 | 6)[]} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.oneOf([5, 6])]).isRequired).isRequired -};`); - }); - - it('understands discriminated unions', () => { - const result = transform( - ` -import React from 'react' -interface OptA { type: 'a'; value: string; } -interface OptB { type: 'b'; valid: boolean; } -type Option = OptA | OptB; -interface Props { option: Option } -const Foo: React.SFC = ({ option }: Props) => { - return (
{option.type == 'a' ? option.value : option.valid}
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const Foo = ({ - option -}) => { - return
{option.type == 'a' ? option.value : option.valid}
; -}; -Foo.propTypes = { - option: PropTypes.oneOfType([PropTypes.shape({ - type: PropTypes.oneOf(["a"]).isRequired, - value: PropTypes.string.isRequired - }).isRequired, PropTypes.shape({ - type: PropTypes.oneOf(["b"]).isRequired, - valid: PropTypes.bool.isRequired - }).isRequired]).isRequired -};`); - }); - - it('understands an optional Array of strings and numbers', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar?: (string | number)[]} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.number.isRequired]).isRequired) -};`); - }); - - it('understands an Array of a custom type', () => { - const result = transform( - ` -import React from 'react'; -interface FooBar {foo: string, bar?: boolean} -interface IFooProps {bar: FooBar[]} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.arrayOf(PropTypes.shape({ - foo: PropTypes.string.isRequired, - bar: PropTypes.bool - }).isRequired).isRequired -};`); - }); - }); - }); - - describe('type and interface resolving', () => { - it('understands inline definitions', () => { - const result = transform( - ` -import React from 'react'; -const FooComponent: React.SFC<{bar: string}> = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.string.isRequired -};`); - }); - - it('understands one level of indirection', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: string} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.string.isRequired -};`); - }); - - it('understands two levels of indirection', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {bar: string} -type FooProps = IFooProps -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.string.isRequired -};`); - }); - - describe('external references', () => { - describe('non-resolvable', () => { - it("doesn't set propTypes if the whole type is un-resolvable", () => { - const result = transform( - ` -import React from 'react'; -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -const FooComponent = () => { - return
Hello World
; -};`); - }); - - it('marks un-resolvable types as PropTypes.any', () => { - const result = transform( - ` -import React from 'react'; -const FooComponent: React.SFC<{foo: Foo, bar?: Bar}> = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.any.isRequired, - bar: PropTypes.any -};`); - }); - - it('ignores types from node modules', () => { - const result = transform( - ` -import React, { HTMLAttributes } from 'react'; -const FooComponent: React.SFC> = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -const FooComponent = () => { - return
Hello World
; -};`); - }); - - it('intersection with all unknown types resolves to PropTypes.any', () => { - const result = transform( - ` -import React from 'react'; -interface IFooProps {fizz: iBar & iFoo} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - fizz: PropTypes.any.isRequired -};`); - }); - - it('intersection with some unknown types resolves to known types', () => { - const result = transform( - ` -import React from 'react'; -interface iBar { name: string, age?: number } -interface IFooProps {fizz: iBar & iFoo} -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - fizz: PropTypes.shape({ - name: PropTypes.string.isRequired, - age: PropTypes.number - }).isRequired -};`); - }); - }); - - describe('local references', () => { - it('resolves types from relative imports', () => { - const result = transform( - ` -import React from 'react'; -import { CommonProps } from '../common'; -const FooComponent: React.SFC<{foo: Foo, bar?: Bar} & CommonProps> = () => { - return (
Hello World
); -}`, - { - ...babelOptions, - plugins: [ - [ - './scripts/babel/proptypes-from-ts-props', - { - fs: { - existsSync: () => true, - statSync: () => ({ isDirectory: () => false }), - readFileSync: () => - Buffer.from(` - export interface CommonProps { - className?: string; - 'aria-label'?: string; - 'data-test-subj'?: string; - } - `), - }, - }, - ], - ], - } - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.any.isRequired, - bar: PropTypes.any, - className: PropTypes.string, - "aria-label": PropTypes.string, - "data-test-subj": PropTypes.string -};`); - }); - - it('resolves to directory index files', () => { - const result = transform( - ` -import React from 'react'; -import { CommonProps } from './common'; -const FooComponent: React.SFC<{foo: Foo, bar?: Bar} & CommonProps> = () => { - return (
Hello World
); -}`, - { - ...babelOptions, - filename: 'foo.tsx', - plugins: [ - [ - './scripts/babel/proptypes-from-ts-props', - { - fs: { - existsSync: () => true, - statSync: () => ({ isDirectory: () => true }), - readFileSync: filepath => { - if ( - filepath !== - path.resolve( - process.cwd(), - `common${path.sep}index.ts` - ) - ) { - throw new Error( - 'Test case should only try to read file unknown/common/index.ts' - ); - } - - return Buffer.from(` - export interface CommonProps { - className?: string; - 'aria-label'?: string; - 'data-test-subj'?: string; - } - `); - }, - }, - }, - ], - ], - } - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.any.isRequired, - bar: PropTypes.any, - className: PropTypes.string, - "aria-label": PropTypes.string, - "data-test-subj": PropTypes.string -};`); - }); - - it('loads only exported types', () => { - const result = transform( - ` -import React from 'react'; -import { CommonProps } from '../common'; -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - { - ...babelOptions, - plugins: [ - [ - './scripts/babel/proptypes-from-ts-props', - { - fs: { - existsSync: () => true, - statSync: () => ({ isDirectory: () => false }), - readFileSync: () => - Buffer.from(` - interface FooProps { - foo: string - } - export interface CommonProps { - className?: string; - 'aria-label'?: string; - 'data-test-subj'?: string; - } - `), - }, - }, - ], - ], - } - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - className: PropTypes.string, - "aria-label": PropTypes.string, - "data-test-subj": PropTypes.string -};`); - }); - - it('imported types can also import types', () => { - const result = transform( - ` -import React from 'react'; -import { CommonProps } from './common.ts'; -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - { - ...babelOptions, - plugins: [ - [ - './scripts/babel/proptypes-from-ts-props', - { - fs: { - existsSync: () => true, - statSync: () => ({ isDirectory: () => false }), - readFileSync: filepath => { - if ( - filepath === - path.resolve(process.cwd(), 'common.ts') - ) { - return Buffer.from(` - import { FooType } from './types.ts'; - export interface CommonProps { - className?: string; - 'aria-label'?: string; - 'data-test-subj'?: string; - foo: FooType; - } - `); - } else if ( - filepath === path.resolve(process.cwd(), 'types.ts') - ) { - return Buffer.from(` - export type FooType = "Foo" | "Bar" | "Fizz"; - `); - } - }, - }, - }, - ], - ], - } - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - className: PropTypes.string, - "aria-label": PropTypes.string, - "data-test-subj": PropTypes.string, - foo: PropTypes.oneOf(["Foo", "Bar", "Fizz"]).isRequired -};`); - }); - - it('imported types can import types from other locations', () => { - const result = transform( - ` -import React from 'react'; -import { Foo } from './types/foo.ts'; -const FooComponent: React.SFC = () => { - return (
Hello World
); -}`, - { - ...babelOptions, - plugins: [ - [ - './scripts/babel/proptypes-from-ts-props', - { - fs: { - existsSync: () => true, - statSync: () => ({ isDirectory: () => false }), - readFileSync: filepath => { - if ( - filepath === - path.resolve(process.cwd(), 'types', 'foo.ts') - ) { - return Buffer.from(` - import { IFoo } from '../interfaces/foo.ts'; - export type Foo = IFoo; - `); - } else if ( - filepath === - path.resolve(process.cwd(), 'interfaces', 'foo.ts') - ) { - return Buffer.from(` - export interface IFoo { bar: string } - `); - } - }, - }, - }, - ], - ], - } - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.string.isRequired -};`); - }); - - it('resolves object keys used in keyof typeof', () => { - const result = transform( - ` -import React from 'react'; -import { commonKeys, commonKeyTypes } from '../common'; -const FooComponent: React.SFC<{foo: keyof typeof commonKeys, bar?: commonKeyTypes}> = () => { - return (
Hello World
); -}`, - { - ...babelOptions, - plugins: [ - [ - './scripts/babel/proptypes-from-ts-props', - { - fs: { - existsSync: () => true, - statSync: () => ({ isDirectory: () => false }), - readFileSync: () => - Buffer.from(` - export const commonKeys = { - s: 'small', - 'l': 'large', - }; - export type commonKeyTypes = keyof typeof commonKeys; - `), - }, - }, - ], - ], - } - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.oneOf(["s", "l"]).isRequired, - bar: PropTypes.oneOf(["s", "l"]) -};`); - }); - - it('resolves types exported without an import', () => { - const result = transform( - ` -import React from 'react'; -import { Foo } from '../foo'; -const FooComponent: React.SFC<{foo: Foo}> = () => { - return (
Hello World
); -}`, - { - ...babelOptions, - plugins: [ - [ - './scripts/babel/proptypes-from-ts-props', - { - fs: { - existsSync: () => true, - statSync: () => ({ isDirectory: () => false }), - readFileSync: filepath => { - if (filepath.endsWith(`${path.sep}foo`)) { - return Buffer.from(` - export { Foo } from './Foo'; - `); - } - - if (filepath.endsWith(`${path.sep}Foo`)) { - return Buffer.from(` - export type Foo = string; - `); - } - - throw new Error( - `Test tried to import from ${filepath}` - ); - }, - }, - }, - ], - ], - } - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.string.isRequired -};`); - }); - }); - }); - }); - - describe('indexed property access', () => { - it('follows indexed properties', () => { - const result = transform( - ` -import React from 'react'; -interface Foo { - foo: () => {}; -} -const FooComponent: React.SFC<{bar: Foo['foo']}> = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - bar: PropTypes.func.isRequired -};`); - }); - }); - - describe('supported component declarations', () => { - it('annotates React.SFC components', () => { - const result = transform( - ` -import React from 'react'; -const FooComponent: React.SFC<{foo: string, bar?: number}> = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.string.isRequired, - bar: PropTypes.number -};`); - }); - - it('annotates SFC components', () => { - const result = transform( - ` -import React, { SFC } from 'react'; -const FooComponent: SFC<{foo: string, bar?: number}> = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.string.isRequired, - bar: PropTypes.number -};`); - }); - - it('annotates FunctionComponent components', () => { - const result = transform( - ` -import React, { FunctionComponent } from 'react'; -const FooComponent: FunctionComponent<{foo: string, bar?: number}> = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.string.isRequired, - bar: PropTypes.number -};`); - }); - - it('annotates indirected FunctionComponent components', () => { - const result = transform( - ` -import React, { FunctionComponent } from 'react'; -type FooType = FunctionComponent<{foo: string, bar?: number}>; -const FooComponent: FooType = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.string.isRequired, - bar: PropTypes.number -};`); - }); - - it('annotates React.FunctionComponent components', () => { - const result = transform( - ` -import React from 'react'; -const FooComponent: React.FunctionComponent<{foo: string, bar?: number}> = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - foo: PropTypes.string.isRequired, - bar: PropTypes.number -};`); - }); - - it('annotates React.Component components', () => { - const result = transform( - ` -import React from 'react'; -class FooComponent extends React.Component<{foo: string, bar?: number}> { - render() { - return (
Hello World
); - } -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -class FooComponent extends React.Component { - render() { - return
Hello World
; - } -} -FooComponent.propTypes = { - foo: PropTypes.string.isRequired, - bar: PropTypes.number -};`); - }); - - it('annotates React.PureComponent components', () => { - const result = transform( - ` -import React from 'react'; -class FooComponent extends React.PureComponent<{foo: string, bar?: number}> { - render() { - return (
Hello World
); - } -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -class FooComponent extends React.PureComponent { - render() { - return
Hello World
; - } -} -FooComponent.propTypes = { - foo: PropTypes.string.isRequired, - bar: PropTypes.number -};`); - }); - - it('annotates Component components', () => { - const result = transform( - ` -import React, { Component } from 'react'; -class FooComponent extends Component<{foo: string, bar?: number}> { - render() { - return (
Hello World
); - } -}`, - babelOptions - ); - - expect(result.code).toBe(`import React, { Component } from 'react'; -import PropTypes from "prop-types"; -class FooComponent extends Component { - render() { - return
Hello World
; - } -} -FooComponent.propTypes = { - foo: PropTypes.string.isRequired, - bar: PropTypes.number -};`); - }); - - it('annotates PureComponent components', () => { - const result = transform( - ` -import React, { PureComponent } from 'react'; -class FooComponent extends PureComponent<{foo: string, bar?: number}> { - render() { - return (
Hello World
); - } -}`, - babelOptions - ); - - expect(result.code).toBe(`import React, { PureComponent } from 'react'; -import PropTypes from "prop-types"; -class FooComponent extends PureComponent { - render() { - return
Hello World
; - } -} -FooComponent.propTypes = { - foo: PropTypes.string.isRequired, - bar: PropTypes.number -};`); - }); - }); - - describe('comments', () => { - it('copies comments from types to proptypes', () => { - const result = transform( - ` -import React, { SFC } from 'react'; -interface FooProps { - // this is the foo prop - foo: string, - /** - * this is the optional bar prop - */ - bar?: number -} -const FooComponent: SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - // this is the foo prop - foo: PropTypes.string.isRequired, - /** - * this is the optional bar prop - */ - bar: PropTypes.number -};`); - }); - - it('copies comments from intersected types', () => { - const result = transform( - ` -import React, { SFC } from 'react'; -interface iFoo { - // this is the foo prop - foo: string -} -interface iBar { - /* bar's foo */ - foo: string, - /** - * this is the optional bar prop - */ - bar?: number -} -const FooComponent: SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - /* bar's foo */ - // this is the foo prop - foo: PropTypes.string.isRequired, - /** - * this is the optional bar prop - */ - bar: PropTypes.number -};`); - }); - }); - - describe('self-referencing types', () => { - it("doesn't explode on self-referencing interfaces", () => { - const result = transform( - ` -import React, { SFC } from 'react'; -interface FooProps { - label: string; - children?: FooProps[]; -} -const FooComponent: SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - label: PropTypes.string.isRequired, - children: PropTypes.arrayOf(PropTypes.any.isRequired) -};`); - }); - - it("doesn't explode on self-referencing types", () => { - const result = transform( - ` -import React, { SFC } from 'react'; -type FooProps = { - label: string; - children?: FooProps[]; -} -const FooComponent: SFC = () => { - return (
Hello World
); -}`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = () => { - return
Hello World
; -}; -FooComponent.propTypes = { - label: PropTypes.string.isRequired, - children: PropTypes.arrayOf(PropTypes.any.isRequired) -};`); - }); - }); - - describe('forwardRef', () => { - it('attaches proptypes to components returned by forwardRef', () => { - const result = transform( - ` -import React, { forwardRef } from 'react'; -interface FooProps { - foo: string; - bar?: number; -} -const FooComponent = forwardRef(() => { - return (
Hello World
); -})`, - babelOptions - ); - - expect(result.code).toBe(`import React, { forwardRef } from 'react'; -import PropTypes from "prop-types"; -const FooComponent = forwardRef(() => { - return
Hello World
; -}); -FooComponent.propTypes = { - foo: PropTypes.string.isRequired, - bar: PropTypes.number -};`); - }); - - it('attaches proptypes to components returned by React.forwardRef', () => { - const result = transform( - ` -import React from 'react'; -interface FooProps { - foo: string; - bar?: number; -} -const FooComponent = React.forwardRef(() => { - return (
Hello World
); -})`, - babelOptions - ); - - expect(result.code).toBe(`import React from 'react'; -import PropTypes from "prop-types"; -const FooComponent = React.forwardRef(() => { - return
Hello World
; -}); -FooComponent.propTypes = { - foo: PropTypes.string.isRequired, - bar: PropTypes.number -};`); - }); - }); - - describe('misc', () => { - it('supports non-initialized variable declarations', () => { - const result = transform( - ` -let something: any; -`, - babelOptions - ); - - expect(result.code).toBe('let something;'); - }); - - it('skips non-typescript imports', () => { - const result = transform( - ` -import something from './somewhere.txt'; -`, - { - ...babelOptions, - plugins: [ - [ - './scripts/babel/proptypes-from-ts-props', - { - fs: { - existsSync: () => true, - statSync: () => ({ isDirectory: () => false }), - readFileSync: () => { - return Buffer.from(` - this is not valid javascript - `); - }, - }, - }, - ], - ], - } - ); - - expect(result.code).toBe("export {};"); - }); - }); - }); -}); diff --git a/packages/eui/scripts/compile-eui.js b/packages/eui/scripts/compile-eui.js index 14ee2282bbf..b1e2531ec9e 100755 --- a/packages/eui/scripts/compile-eui.js +++ b/packages/eui/scripts/compile-eui.js @@ -30,7 +30,10 @@ const IGNORE_TESTENV = [ '**/*.testenv.tsx', '**/*.testenv.ts', ]; -const IGNORE_PACKAGES = ['**/react-datepicker/test/**/*.js']; +const IGNORE_PACKAGES = [ + '**/react-datepicker/test/**/*.js', + '**/react-datepicker/test/**/*.jsx', +]; async function renameTestEnvFiles() { const files = glob.globIterate('test-env/**/*.testenv.js', { @@ -111,26 +114,31 @@ async function copySvgFiles() { ); } -function runBabel({ outDir, ignore, configFile, env = {} }) { +function runSwc({ outDir, ignore, moduleType, isOptimize, isTestEnv }) { return new Promise((resolve, reject) => { + const ignoreArgs = ignore.flatMap((pattern) => ['--ignore', pattern]); + const args = [ - '--quiet', - `--out-dir=${outDir}`, - '--extensions=.js,.ts,.tsx', - `--ignore=${ignore}`, + '.', + '--out-dir', + path.join(packageRootDir, outDir), + '--config-file', + path.join(packageRootDir, '.swcrc'), + ...ignoreArgs, + '--extensions=.js,.ts,.tsx,.jsx', ]; - if (configFile) { - args.push(`--config-file=${configFile}`); + if (isOptimize || isTestEnv) { + args.push('-C', 'jsc.externalHelpers=true'); } - args.push('src'); + if (moduleType) { + args.push('-C', `module.type=${moduleType}`); + } - const child = spawn('yarn', ['exec', 'babel', ...args], { - env: { - ...process.env, - ...env, - }, + const child = spawn('yarn', ['exec', 'swc', ...args], { + env: process.env, + cwd: srcDir, stdio: 'inherit', }); @@ -138,7 +146,7 @@ function runBabel({ outDir, ignore, configFile, env = {} }) { if (code === 0) { resolve(); } else { - reject(new Error(`babel ${outDir} exited with code ${code}`)); + reject(new Error(`swc ${outDir} exited with code ${code}`)); } }); }); @@ -149,73 +157,53 @@ async function compileLib() { console.log('Compiling src/ to es/, lib/, optimize/, and test-env/'); - // Run all code (com|trans)pilation through babel (ESNext JS & TypeScript) - const defaultIgnore = [ ...IGNORE_BUILD, ...IGNORE_TESTS, ...IGNORE_TESTENV, ...IGNORE_PACKAGES, - ].join(','); - const testEnvIgnore = [ - ...IGNORE_BUILD, - ...IGNORE_TESTS, - ...IGNORE_PACKAGES, - ].join(','); + ]; + const testEnvIgnore = [...IGNORE_BUILD, ...IGNORE_TESTS, ...IGNORE_PACKAGES]; - const babelConfigs = [ + const outputs = [ { outDir: 'es', ignore: defaultIgnore, - env: { - BABEL_MODULES: false, - NO_COREJS_POLYFILL: true, - }, + moduleType: 'es6', }, { outDir: 'lib', ignore: defaultIgnore, - env: { - NO_COREJS_POLYFILL: true, - }, + moduleType: 'commonjs', }, { outDir: 'optimize/es', ignore: defaultIgnore, - configFile: './.babelrc-optimize.js', - env: { - BABEL_MODULES: false, - NO_COREJS_POLYFILL: true, - }, + moduleType: 'es6', + isOptimize: true, }, { outDir: 'optimize/lib', ignore: defaultIgnore, - configFile: './.babelrc-optimize.js', - env: { - NO_COREJS_POLYFILL: true, - }, + moduleType: 'commonjs', + isOptimize: true, }, { outDir: 'test-env', ignore: testEnvIgnore, - configFile: './.babelrc-test-env.js', - env: { - NO_COREJS_POLYFILL: true, - }, + moduleType: 'commonjs', + isTestEnv: true, }, ]; if (process.argv.includes('--no-parallel')) { - for (const config of babelConfigs) { - await runBabel(config); + for (const output of outputs) { + await runSwc(output); } } else { - const results = await Promise.allSettled(babelConfigs.map(runBabel)); + const results = await Promise.allSettled(outputs.map(runSwc)); const failed = results.filter((r) => r.status === 'rejected'); - if (failed.length) { - throw new Error(`${failed.length} Babel builds failed`); - } + if (failed.length) throw new Error(`${failed.length} SWC builds failed`); } await renameTestEnvFiles(); @@ -289,6 +277,7 @@ async function compileBundle() { const relativePath = filePath.replace(/^test\//, ''); const destPath = path.join(dir, relativePath); + await fs.mkdir(path.dirname(destPath), { recursive: true }); await fs.copyFile(fullPath, destPath); } } diff --git a/packages/eui/scripts/jest/.babelrc.js b/packages/eui/scripts/jest/.babelrc.js index fdb7e3db10b..43e28778003 100644 --- a/packages/eui/scripts/jest/.babelrc.js +++ b/packages/eui/scripts/jest/.babelrc.js @@ -1,5 +1,4 @@ module.exports = { - extends: '../../.babelrc.js', presets: [ [ '@babel/env', @@ -7,5 +6,8 @@ module.exports = { targets: { node: 'current' }, }, ], + ['@babel/react', { runtime: 'classic' }], + '@emotion/babel-preset-css-prop', + ['@babel/typescript', { isTSX: true, allExtensions: true }], ], }; diff --git a/packages/eui/scripts/jest/config.js b/packages/eui/scripts/jest/config.js index 732ba30560c..08e3fa11626 100644 --- a/packages/eui/scripts/jest/config.js +++ b/packages/eui/scripts/jest/config.js @@ -62,7 +62,7 @@ const config = { testEnvironment: 'jsdom', testMatch: ['**/*.test.js', '**/*.test.ts', '**/*.test.tsx'], transform: { - '^.+\\.(js|tsx?)$': 'babel-jest', + '^.+\\.(js|tsx?)$': '@swc/jest', }, snapshotSerializers: [ '/node_modules/enzyme-to-json/serializer', diff --git a/packages/eui/src/components/search_bar/query/default_syntax.ts b/packages/eui/src/components/search_bar/query/default_syntax.ts index 25303b16edd..ba7ccfcceaf 100644 --- a/packages/eui/src/components/search_bar/query/default_syntax.ts +++ b/packages/eui/src/components/search_bar/query/default_syntax.ts @@ -10,221 +10,8 @@ import { _AST, AST, Clause, OperatorType, Value } from './ast'; import { isArray, isString, isDateLike } from '../../../services/predicate'; import { dateFormat as defaultDateFormat } from './date_format'; import { DateValue, dateValueParser, isDateValue } from './date_value'; -// @ts-ignore This is a Babel plugin that parses inline PEG grammars. -import peg from 'pegjs-inline-precompile'; // eslint-disable-line import/no-unresolved - -const parser = peg` -{ - const { AST, Exp, unescapeValue, unescapePhraseValue, resolveFieldValue, recognizedFields } = options; - const hasRecognizedFields = recognizedFields && recognizedFields.length > 0; - const ctx = Object.assign({ error }, options ); -} - -Query - = clauses:Clauses { return clauses; } - / space? { return []; } - -Clauses - = space? head:Clause tail:( - space clause:Clause { return clause } - )* space? { - return [ head, ...tail] - } - -Clause - = GroupClause - / IsClause - / FieldClause - / TermClause - -SubGroupClause - = "(" head:Clause tail:( - space? orWord space? clause:Clause { return clause } - )* ")" { - return [head, ...tail]; - } - -GroupClause - = space? "-" group:SubGroupClause { return AST.Group.mustNot(group) } - / space? group:SubGroupClause { return AST.Group.must(group) } - -TermClause - = space? "-" value:termValue { return AST.Term.mustNot(value); } - / space? value:termValue { return AST.Term.must(value); } - -IsClause - = space? "-" flag:IsFlag { return AST.Is.mustNot(flag); } - / space? flag:IsFlag { return AST.Is.must(flag); } - -IsFlag - = "is:" flag:flagName { - validateFlag(flag, location(), ctx); - return flag; - } - -FieldClause "field" - = space? "-" fv:FieldEQValue { return AST.Field.mustNot.eq(fv.field, fv.value); } - / space? "-" fv:FieldEXACTValue { return AST.Field.mustNot.exact(fv.field, fv.value); } - / space? "-" fv:FieldGTValue { return AST.Field.mustNot.gt(fv.field, fv.value); } - / space? "-" fv:FieldGTEValue { return AST.Field.mustNot.gte(fv.field, fv.value); } - / space? "-" fv:FieldLTValue { return AST.Field.mustNot.lt(fv.field, fv.value); } - / space? "-" fv:FieldLTEValue { return AST.Field.mustNot.lte(fv.field, fv.value); } - / space? fv:FieldEQValue { return AST.Field.must.eq(fv.field, fv.value); } - / space? fv:FieldEXACTValue { return AST.Field.must.exact(fv.field, fv.value); } - / space? fv:FieldGTValue { return AST.Field.must.gt(fv.field, fv.value); } - / space? fv:FieldGTEValue { return AST.Field.must.gte(fv.field, fv.value); } - / space? fv:FieldLTValue { return AST.Field.must.lt(fv.field, fv.value); } - / space? fv:FieldLTEValue { return AST.Field.must.lte(fv.field, fv.value); } - -FieldEQValue - = field:fieldName ":" valueExpression:fieldContainsValue { - return {field, value: resolveFieldValue(field, valueExpression, ctx) }; - } - -FieldEXACTValue - = field:fieldName "=" valueExpression:fieldContainsValue { - return {field, value: resolveFieldValue(field, valueExpression, ctx) }; - } - -FieldGTValue - = field:fieldName ">" valueExpression:fieldRangeValue { - return {field, value: resolveFieldValue(field, valueExpression, ctx)}; - } - -FieldGTEValue - = field:fieldName ">=" valueExpression:fieldRangeValue { - return {field, value: resolveFieldValue(field, valueExpression, ctx)}; - } - -FieldLTValue - = field:fieldName "<" valueExpression:fieldRangeValue { - return {field, value: resolveFieldValue(field, valueExpression, ctx)}; - } - -FieldLTEValue - = field:fieldName "<=" valueExpression:fieldRangeValue { - return {field, value: resolveFieldValue(field, valueExpression, ctx)}; - } - -flagName "flag name" - = identifier - -// If recognizedFields was given in options, the identifier must match an allowed field -fieldName "field name" - = id:identifier &{ return !hasRecognizedFields || recognizedFields.includes(id); } { return id; } - -identifier - = identifierChar+ { return unescapeValue(text()); } - -identifierChar - = alnum - / [-_] - / escapedChar - -fieldRangeValue - = rangeValue - -fieldContainsValue "field value" - = containsOrValues - / containsValue - -termValue "term" - = value:containsValue { return value.expression; } - -containsOrValues - = "(" space? head:containsValue tail:( - space orWord space value:containsValue { return value; } - )* space? ")" { return [ head, ...tail ]; } - -rangeValue - = numberWord - / date - -containsValue - = numberWord - / date - / booleanWord - / phrase - / word - -phrase - = '"' phrase:( - space? (phraseWord+)? (space phraseWord+)* space? { return unescapePhraseValue(text()); } - ) '"' { return Exp.string(phrase, location()); } - -phraseWord - // not a backslash, quote, or space - = [^\\\\" ]+ - // escaped character - / '\\\\' (.) - -word - = wordChar+ { - if (text().toLowerCase() === 'or') { - error( - 'To use OR in a text search, put it inside quotes: "or". To ' + - 'perform a logical OR, enclose the words in parenthesis: (foo:bar or bar).' - ); - } - return Exp.string(unescapeValue(text()), location()); - } - -wordChar - = alnum - / [-_*:/@] - / escapedChar - / extendedGlyph - -// This isn't _strictly_ correct: -// for our purposes, a non-ascii word character is considered to -// be anything above \`Latin-1 Punctuation & Symbols\`, which ends at U+00BF -// This allows any non-ascii character, including the full set of unicode characters -// even those in the supplementary planes (U+010000 → U+10FFFF) as those will be seen individually -// in their surrogate pairs which are of the format /[\uD800-\uDBFF][\uDC00-\uDFFF]/ -extendedGlyph - = [\u00C0-\uFFFF] - -escapedChar - = "\\\\" reservedChar - -reservedChar - = [\-:\\\\()] - -orWord - = ([oO][rR]) - -// only match booleans followed by whitespace or end of input -booleanWord - = bool:boolean &space { return bool; } - / bool:boolean !. { return bool; } - -boolean - = [tT][rR][uU][eE] { return Exp.boolean(text(), location()); } - / [fF][aA][lL][sS][eE] { return Exp.boolean(text(), location()); } - / [yY][eE][sS] { return Exp.boolean(text(), location()); } - / [nN][oO] { return Exp.boolean(text(), location()); } - / [oO][nN] { return Exp.boolean(text(), location()); } - / [oO][fF][fF] { return Exp.boolean(text(), location()); } - -number - = [\\-]?[0-9]+("."[0-9]+)* { return Exp.number(text(), location()); } - -// only match numbers followed by whitespace or end of input -numberWord - = num:number &space { return num; } - / num:number !. { return num; } - -date - = "'" expression:((!"'" .)+ { return text(); }) "'" { - return Exp.date(expression, location()); - } - -alnum "alpha numeric" - = [a-zA-Z0-9\\.] - -space "whitespace" - = [ \\t\\n\\r]+ -`; +// @ts-ignore Query parser is a generated file pre-built by PEG.js +import { parse } from './query_parser'; type DataType = 'date' | 'number' | 'string' | 'boolean'; @@ -499,7 +286,7 @@ export const defaultSyntax: Syntax = Object.freeze({ const dateFormat = options.dateFormat || defaultDateFormat; const parseDate = dateValueParser(dateFormat); const { recognizedFields, ...schema } = options.schema || {}; - const clauses = parser.parse(query, { + const clauses = parse(query, { AST, Exp, unescapeValue, diff --git a/packages/eui/src/components/search_bar/query/query.pegjs b/packages/eui/src/components/search_bar/query/query.pegjs new file mode 100644 index 00000000000..2841a333b17 --- /dev/null +++ b/packages/eui/src/components/search_bar/query/query.pegjs @@ -0,0 +1,210 @@ +{ + const { AST, Exp, unescapeValue, unescapePhraseValue, resolveFieldValue, recognizedFields } = options; + const hasRecognizedFields = recognizedFields && recognizedFields.length > 0; + const ctx = Object.assign({ error }, options ); +} + +Query + = clauses:Clauses { return clauses; } + / space? { return []; } + +Clauses + = space? head:Clause tail:( + space clause:Clause { return clause } + )* space? { + return [ head, ...tail] + } + +Clause + = GroupClause + / IsClause + / FieldClause + / TermClause + +SubGroupClause + = "(" head:Clause tail:( + space? orWord space? clause:Clause { return clause } + )* ")" { + return [head, ...tail]; + } + +GroupClause + = space? "-" group:SubGroupClause { return AST.Group.mustNot(group) } + / space? group:SubGroupClause { return AST.Group.must(group) } + +TermClause + = space? "-" value:termValue { return AST.Term.mustNot(value); } + / space? value:termValue { return AST.Term.must(value); } + +IsClause + = space? "-" flag:IsFlag { return AST.Is.mustNot(flag); } + / space? flag:IsFlag { return AST.Is.must(flag); } + +IsFlag + = "is:" flag:flagName { + validateFlag(flag, location(), ctx); + return flag; + } + +FieldClause "field" + = space? "-" fv:FieldEQValue { return AST.Field.mustNot.eq(fv.field, fv.value); } + / space? "-" fv:FieldEXACTValue { return AST.Field.mustNot.exact(fv.field, fv.value); } + / space? "-" fv:FieldGTValue { return AST.Field.mustNot.gt(fv.field, fv.value); } + / space? "-" fv:FieldGTEValue { return AST.Field.mustNot.gte(fv.field, fv.value); } + / space? "-" fv:FieldLTValue { return AST.Field.mustNot.lt(fv.field, fv.value); } + / space? "-" fv:FieldLTEValue { return AST.Field.mustNot.lte(fv.field, fv.value); } + / space? fv:FieldEQValue { return AST.Field.must.eq(fv.field, fv.value); } + / space? fv:FieldEXACTValue { return AST.Field.must.exact(fv.field, fv.value); } + / space? fv:FieldGTValue { return AST.Field.must.gt(fv.field, fv.value); } + / space? fv:FieldGTEValue { return AST.Field.must.gte(fv.field, fv.value); } + / space? fv:FieldLTValue { return AST.Field.must.lt(fv.field, fv.value); } + / space? fv:FieldLTEValue { return AST.Field.must.lte(fv.field, fv.value); } + +FieldEQValue + = field:fieldName ":" valueExpression:fieldContainsValue { + return {field, value: resolveFieldValue(field, valueExpression, ctx) }; + } + +FieldEXACTValue + = field:fieldName "=" valueExpression:fieldContainsValue { + return {field, value: resolveFieldValue(field, valueExpression, ctx) }; + } + +FieldGTValue + = field:fieldName ">" valueExpression:fieldRangeValue { + return {field, value: resolveFieldValue(field, valueExpression, ctx)}; + } + +FieldGTEValue + = field:fieldName ">=" valueExpression:fieldRangeValue { + return {field, value: resolveFieldValue(field, valueExpression, ctx)}; + } + +FieldLTValue + = field:fieldName "<" valueExpression:fieldRangeValue { + return {field, value: resolveFieldValue(field, valueExpression, ctx)}; + } + +FieldLTEValue + = field:fieldName "<=" valueExpression:fieldRangeValue { + return {field, value: resolveFieldValue(field, valueExpression, ctx)}; + } + +flagName "flag name" + = identifier + +// If recognizedFields was given in options, the identifier must match an allowed field +fieldName "field name" + = id:identifier &{ return !hasRecognizedFields || recognizedFields.includes(id); } { return id; } + +identifier + = identifierChar+ { return unescapeValue(text()); } + +identifierChar + = alnum + / [-_] + / escapedChar + +fieldRangeValue + = rangeValue + +fieldContainsValue "field value" + = containsOrValues + / containsValue + +termValue "term" + = value:containsValue { return value.expression; } + +containsOrValues + = "(" space? head:containsValue tail:( + space orWord space value:containsValue { return value; } + )* space? ")" { return [ head, ...tail ]; } + +rangeValue + = numberWord + / date + +containsValue + = numberWord + / date + / booleanWord + / phrase + / word + +phrase + = '"' phrase:( + space? (phraseWord+)? (space phraseWord+)* space? { return unescapePhraseValue(text()); } + ) '"' { return Exp.string(phrase, location()); } + +phraseWord + // not a backslash, quote, or space + = [^\\\\" ]+ + // escaped character + / '\\\\' (.) + +word + = wordChar+ { + if (text().toLowerCase() === 'or') { + error( + 'To use OR in a text search, put it inside quotes: "or". To ' + + 'perform a logical OR, enclose the words in parenthesis: (foo:bar or bar).' + ); + } + return Exp.string(unescapeValue(text()), location()); + } + +wordChar + = alnum + / [-_*:/@] + / escapedChar + / extendedGlyph + +// This isn't _strictly_ correct: +// for our purposes, a non-ascii word character is considered to +// be anything above \`Latin-1 Punctuation & Symbols\`, which ends at U+00BF +// This allows any non-ascii character, including the full set of unicode characters +// even those in the supplementary planes (U+010000 → U+10FFFF) as those will be seen individually +// in their surrogate pairs which are of the format /[\uD800-\uDBFF][\uDC00-\uDFFF]/ +extendedGlyph + = [\u00C0-\uFFFF] + +escapedChar + = "\\\\" reservedChar + +reservedChar + = [\-:\\\\()] + +orWord + = ([oO][rR]) + +// only match booleans followed by whitespace or end of input +booleanWord + = bool:boolean &space { return bool; } + / bool:boolean !. { return bool; } + +boolean + = [tT][rR][uU][eE] { return Exp.boolean(text(), location()); } + / [fF][aA][lL][sS][eE] { return Exp.boolean(text(), location()); } + / [yY][eE][sS] { return Exp.boolean(text(), location()); } + / [nN][oO] { return Exp.boolean(text(), location()); } + / [oO][fF][fF] { return Exp.boolean(text(), location()); } + +number + = [\\-]?[0-9]+("."[0-9]+)* { return Exp.number(text(), location()); } + +// only match numbers followed by whitespace or end of input +numberWord + = num:number &space { return num; } + / num:number !. { return num; } + +date + = "'" expression:((!"'" .)+ { return text(); }) "'" { + return Exp.date(expression, location()); + } + +alnum "alpha numeric" + = [a-zA-Z0-9\\.] + +space "whitespace" + = [ \\t\\n\\r]+ + diff --git a/packages/eui/src/components/search_bar/query/query_parser.js b/packages/eui/src/components/search_bar/query/query_parser.js new file mode 100644 index 00000000000..a77d79d0b41 --- /dev/null +++ b/packages/eui/src/components/search_bar/query/query_parser.js @@ -0,0 +1,2746 @@ +/* + * Generated by PEG.js 0.10.0. + * + * http://pegjs.org/ + */ + +"use strict"; + +function peg$subclass(child, parent) { + function ctor() { this.constructor = child; } + ctor.prototype = parent.prototype; + child.prototype = new ctor(); +} + +function peg$SyntaxError(message, expected, found, location) { + this.message = message; + this.expected = expected; + this.found = found; + this.location = location; + this.name = "SyntaxError"; + + if (typeof Error.captureStackTrace === "function") { + Error.captureStackTrace(this, peg$SyntaxError); + } +} + +peg$subclass(peg$SyntaxError, Error); + +peg$SyntaxError.buildMessage = function(expected, found) { + var DESCRIBE_EXPECTATION_FNS = { + literal: function(expectation) { + return "\"" + literalEscape(expectation.text) + "\""; + }, + + "class": function(expectation) { + var escapedParts = "", + i; + + for (i = 0; i < expectation.parts.length; i++) { + escapedParts += expectation.parts[i] instanceof Array + ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) + : classEscape(expectation.parts[i]); + } + + return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; + }, + + any: function(expectation) { + return "any character"; + }, + + end: function(expectation) { + return "end of input"; + }, + + other: function(expectation) { + return expectation.description; + } + }; + + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } + + function literalEscape(s) { + return s + .replace(/\\/g, '\\\\') + .replace(/"/g, '\\"') + .replace(/\0/g, '\\0') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); + } + + function classEscape(s) { + return s + .replace(/\\/g, '\\\\') + .replace(/\]/g, '\\]') + .replace(/\^/g, '\\^') + .replace(/-/g, '\\-') + .replace(/\0/g, '\\0') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\r/g, '\\r') + .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); + } + + function describeExpectation(expectation) { + return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); + } + + function describeExpected(expected) { + var descriptions = new Array(expected.length), + i, j; + + for (i = 0; i < expected.length; i++) { + descriptions[i] = describeExpectation(expected[i]); + } + + descriptions.sort(); + + if (descriptions.length > 0) { + for (i = 1, j = 1; i < descriptions.length; i++) { + if (descriptions[i - 1] !== descriptions[i]) { + descriptions[j] = descriptions[i]; + j++; + } + } + descriptions.length = j; + } + + switch (descriptions.length) { + case 1: + return descriptions[0]; + + case 2: + return descriptions[0] + " or " + descriptions[1]; + + default: + return descriptions.slice(0, -1).join(", ") + + ", or " + + descriptions[descriptions.length - 1]; + } + } + + function describeFound(found) { + return found ? "\"" + literalEscape(found) + "\"" : "end of input"; + } + + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; +}; + +function peg$parse(input, options) { + options = options !== void 0 ? options : {}; + + var peg$FAILED = {}, + + peg$startRuleFunctions = { Query: peg$parseQuery }, + peg$startRuleFunction = peg$parseQuery, + + peg$c0 = function(clauses) { return clauses; }, + peg$c1 = function() { return []; }, + peg$c2 = function(head, clause) { return clause }, + peg$c3 = function(head, tail) { + return [ head, ...tail] + }, + peg$c4 = "(", + peg$c5 = peg$literalExpectation("(", false), + peg$c6 = ")", + peg$c7 = peg$literalExpectation(")", false), + peg$c8 = function(head, tail) { + return [head, ...tail]; + }, + peg$c9 = "-", + peg$c10 = peg$literalExpectation("-", false), + peg$c11 = function(group) { return AST.Group.mustNot(group) }, + peg$c12 = function(group) { return AST.Group.must(group) }, + peg$c13 = function(value) { return AST.Term.mustNot(value); }, + peg$c14 = function(value) { return AST.Term.must(value); }, + peg$c15 = function(flag) { return AST.Is.mustNot(flag); }, + peg$c16 = function(flag) { return AST.Is.must(flag); }, + peg$c17 = "is:", + peg$c18 = peg$literalExpectation("is:", false), + peg$c19 = function(flag) { + validateFlag(flag, location(), ctx); + return flag; + }, + peg$c20 = peg$otherExpectation("field"), + peg$c21 = function(fv) { return AST.Field.mustNot.eq(fv.field, fv.value); }, + peg$c22 = function(fv) { return AST.Field.mustNot.exact(fv.field, fv.value); }, + peg$c23 = function(fv) { return AST.Field.mustNot.gt(fv.field, fv.value); }, + peg$c24 = function(fv) { return AST.Field.mustNot.gte(fv.field, fv.value); }, + peg$c25 = function(fv) { return AST.Field.mustNot.lt(fv.field, fv.value); }, + peg$c26 = function(fv) { return AST.Field.mustNot.lte(fv.field, fv.value); }, + peg$c27 = function(fv) { return AST.Field.must.eq(fv.field, fv.value); }, + peg$c28 = function(fv) { return AST.Field.must.exact(fv.field, fv.value); }, + peg$c29 = function(fv) { return AST.Field.must.gt(fv.field, fv.value); }, + peg$c30 = function(fv) { return AST.Field.must.gte(fv.field, fv.value); }, + peg$c31 = function(fv) { return AST.Field.must.lt(fv.field, fv.value); }, + peg$c32 = function(fv) { return AST.Field.must.lte(fv.field, fv.value); }, + peg$c33 = ":", + peg$c34 = peg$literalExpectation(":", false), + peg$c35 = function(field, valueExpression) { + return {field, value: resolveFieldValue(field, valueExpression, ctx) }; + }, + peg$c36 = "=", + peg$c37 = peg$literalExpectation("=", false), + peg$c38 = ">", + peg$c39 = peg$literalExpectation(">", false), + peg$c40 = function(field, valueExpression) { + return {field, value: resolveFieldValue(field, valueExpression, ctx)}; + }, + peg$c41 = ">=", + peg$c42 = peg$literalExpectation(">=", false), + peg$c43 = "<", + peg$c44 = peg$literalExpectation("<", false), + peg$c45 = "<=", + peg$c46 = peg$literalExpectation("<=", false), + peg$c47 = peg$otherExpectation("flag name"), + peg$c48 = peg$otherExpectation("field name"), + peg$c49 = function(id) { return !hasRecognizedFields || recognizedFields.includes(id); }, + peg$c50 = function(id) { return id; }, + peg$c51 = function() { return unescapeValue(text()); }, + peg$c52 = /^[\-_]/, + peg$c53 = peg$classExpectation(["-", "_"], false, false), + peg$c54 = peg$otherExpectation("field value"), + peg$c55 = peg$otherExpectation("term"), + peg$c56 = function(value) { return value.expression; }, + peg$c57 = function(head, value) { return value; }, + peg$c58 = function(head, tail) { return [ head, ...tail ]; }, + peg$c59 = "\"", + peg$c60 = peg$literalExpectation("\"", false), + peg$c61 = function() { return unescapePhraseValue(text()); }, + peg$c62 = function(phrase) { return Exp.string(phrase, location()); }, + peg$c63 = /^[^\\\\" ]/, + peg$c64 = peg$classExpectation(["\\", "\\", "\"", " "], true, false), + peg$c65 = "\\\\", + peg$c66 = peg$literalExpectation("\\\\", false), + peg$c67 = peg$anyExpectation(), + peg$c68 = function() { + if (text().toLowerCase() === 'or') { + error( + 'To use OR in a text search, put it inside quotes: "or". To ' + + 'perform a logical OR, enclose the words in parenthesis: (foo:bar or bar).' + ); + } + return Exp.string(unescapeValue(text()), location()); + }, + peg$c69 = /^[\-_*:\/@]/, + peg$c70 = peg$classExpectation(["-", "_", "*", ":", "/", "@"], false, false), + peg$c71 = /^[\xC0-\uFFFF]/, + peg$c72 = peg$classExpectation([["\xC0", "\uFFFF"]], false, false), + peg$c73 = /^[\-:\\\\()]/, + peg$c74 = peg$classExpectation(["-", ":", "\\", "\\", "(", ")"], false, false), + peg$c75 = /^[oO]/, + peg$c76 = peg$classExpectation(["o", "O"], false, false), + peg$c77 = /^[rR]/, + peg$c78 = peg$classExpectation(["r", "R"], false, false), + peg$c79 = function(bool) { return bool; }, + peg$c80 = /^[tT]/, + peg$c81 = peg$classExpectation(["t", "T"], false, false), + peg$c82 = /^[uU]/, + peg$c83 = peg$classExpectation(["u", "U"], false, false), + peg$c84 = /^[eE]/, + peg$c85 = peg$classExpectation(["e", "E"], false, false), + peg$c86 = function() { return Exp.boolean(text(), location()); }, + peg$c87 = /^[fF]/, + peg$c88 = peg$classExpectation(["f", "F"], false, false), + peg$c89 = /^[aA]/, + peg$c90 = peg$classExpectation(["a", "A"], false, false), + peg$c91 = /^[lL]/, + peg$c92 = peg$classExpectation(["l", "L"], false, false), + peg$c93 = /^[sS]/, + peg$c94 = peg$classExpectation(["s", "S"], false, false), + peg$c95 = /^[yY]/, + peg$c96 = peg$classExpectation(["y", "Y"], false, false), + peg$c97 = /^[nN]/, + peg$c98 = peg$classExpectation(["n", "N"], false, false), + peg$c99 = /^[\\\-]/, + peg$c100 = peg$classExpectation(["\\", "-"], false, false), + peg$c101 = /^[0-9]/, + peg$c102 = peg$classExpectation([["0", "9"]], false, false), + peg$c103 = ".", + peg$c104 = peg$literalExpectation(".", false), + peg$c105 = function() { return Exp.number(text(), location()); }, + peg$c106 = function(num) { return num; }, + peg$c107 = "'", + peg$c108 = peg$literalExpectation("'", false), + peg$c109 = function() { return text(); }, + peg$c110 = function(expression) { + return Exp.date(expression, location()); + }, + peg$c111 = peg$otherExpectation("alpha numeric"), + peg$c112 = /^[a-zA-Z0-9\\.]/, + peg$c113 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "\\", "."], false, false), + peg$c114 = peg$otherExpectation("whitespace"), + peg$c115 = /^[ \\t\\n\\r]/, + peg$c116 = peg$classExpectation([" ", "\\", "t", "\\", "n", "\\", "r"], false, false), + + peg$currPos = 0, + peg$savedPos = 0, + peg$posDetailsCache = [{ line: 1, column: 1 }], + peg$maxFailPos = 0, + peg$maxFailExpected = [], + peg$silentFails = 0, + + peg$result; + + if ("startRule" in options) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + } + + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + + function text() { + return input.substring(peg$savedPos, peg$currPos); + } + + function location() { + return peg$computeLocation(peg$savedPos, peg$currPos); + } + + function expected(description, location) { + location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) + + throw peg$buildStructuredError( + [peg$otherExpectation(description)], + input.substring(peg$savedPos, peg$currPos), + location + ); + } + + function error(message, location) { + location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) + + throw peg$buildSimpleError(message, location); + } + + function peg$literalExpectation(text, ignoreCase) { + return { type: "literal", text: text, ignoreCase: ignoreCase }; + } + + function peg$classExpectation(parts, inverted, ignoreCase) { + return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; + } + + function peg$anyExpectation() { + return { type: "any" }; + } + + function peg$endExpectation() { + return { type: "end" }; + } + + function peg$otherExpectation(description) { + return { type: "other", description: description }; + } + + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos], p; + + if (details) { + return details; + } else { + p = pos - 1; + while (!peg$posDetailsCache[p]) { + p--; + } + + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column + }; + + while (p < pos) { + if (input.charCodeAt(p) === 10) { + details.line++; + details.column = 1; + } else { + details.column++; + } + + p++; + } + + peg$posDetailsCache[pos] = details; + return details; + } + } + + function peg$computeLocation(startPos, endPos) { + var startPosDetails = peg$computePosDetails(startPos), + endPosDetails = peg$computePosDetails(endPos); + + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; + } + + function peg$fail(expected) { + if (peg$currPos < peg$maxFailPos) { return; } + + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + + peg$maxFailExpected.push(expected); + } + + function peg$buildSimpleError(message, location) { + return new peg$SyntaxError(message, null, null, location); + } + + function peg$buildStructuredError(expected, found, location) { + return new peg$SyntaxError( + peg$SyntaxError.buildMessage(expected, found), + expected, + found, + location + ); + } + + function peg$parseQuery() { + var s0, s1; + + s0 = peg$currPos; + s1 = peg$parseClauses(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c0(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c1(); + } + s0 = s1; + } + + return s0; + } + + function peg$parseClauses() { + var s0, s1, s2, s3, s4, s5, s6; + + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseClause(); + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$currPos; + s5 = peg$parsespace(); + if (s5 !== peg$FAILED) { + s6 = peg$parseClause(); + if (s6 !== peg$FAILED) { + peg$savedPos = s4; + s5 = peg$c2(s2, s6); + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + s5 = peg$parsespace(); + if (s5 !== peg$FAILED) { + s6 = peg$parseClause(); + if (s6 !== peg$FAILED) { + peg$savedPos = s4; + s5 = peg$c2(s2, s6); + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + if (s3 !== peg$FAILED) { + s4 = peg$parsespace(); + if (s4 === peg$FAILED) { + s4 = null; + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c3(s2, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseClause() { + var s0; + + s0 = peg$parseGroupClause(); + if (s0 === peg$FAILED) { + s0 = peg$parseIsClause(); + if (s0 === peg$FAILED) { + s0 = peg$parseFieldClause(); + if (s0 === peg$FAILED) { + s0 = peg$parseTermClause(); + } + } + } + + return s0; + } + + function peg$parseSubGroupClause() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 40) { + s1 = peg$c4; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseClause(); + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$currPos; + s5 = peg$parsespace(); + if (s5 === peg$FAILED) { + s5 = null; + } + if (s5 !== peg$FAILED) { + s6 = peg$parseorWord(); + if (s6 !== peg$FAILED) { + s7 = peg$parsespace(); + if (s7 === peg$FAILED) { + s7 = null; + } + if (s7 !== peg$FAILED) { + s8 = peg$parseClause(); + if (s8 !== peg$FAILED) { + peg$savedPos = s4; + s5 = peg$c2(s2, s8); + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + s5 = peg$parsespace(); + if (s5 === peg$FAILED) { + s5 = null; + } + if (s5 !== peg$FAILED) { + s6 = peg$parseorWord(); + if (s6 !== peg$FAILED) { + s7 = peg$parsespace(); + if (s7 === peg$FAILED) { + s7 = null; + } + if (s7 !== peg$FAILED) { + s8 = peg$parseClause(); + if (s8 !== peg$FAILED) { + peg$savedPos = s4; + s5 = peg$c2(s2, s8); + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s4 = peg$c6; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c7); } + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c8(s2, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseGroupClause() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 45) { + s2 = peg$c9; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c10); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseSubGroupClause(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c11(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseSubGroupClause(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c12(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + return s0; + } + + function peg$parseTermClause() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 45) { + s2 = peg$c9; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c10); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parsetermValue(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c13(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parsetermValue(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c14(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + return s0; + } + + function peg$parseIsClause() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 45) { + s2 = peg$c9; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c10); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseIsFlag(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c15(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseIsFlag(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c16(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + return s0; + } + + function peg$parseIsFlag() { + var s0, s1, s2; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 3) === peg$c17) { + s1 = peg$c17; + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c18); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseflagName(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c19(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseFieldClause() { + var s0, s1, s2, s3; + + peg$silentFails++; + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 45) { + s2 = peg$c9; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c10); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseFieldEQValue(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c21(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 45) { + s2 = peg$c9; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c10); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseFieldEXACTValue(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c22(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 45) { + s2 = peg$c9; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c10); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseFieldGTValue(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c23(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 45) { + s2 = peg$c9; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c10); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseFieldGTEValue(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c24(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 45) { + s2 = peg$c9; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c10); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseFieldLTValue(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c25(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 45) { + s2 = peg$c9; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c10); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseFieldLTEValue(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c26(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseFieldEQValue(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c27(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseFieldEXACTValue(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c28(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseFieldGTValue(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c29(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseFieldGTEValue(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c30(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseFieldLTValue(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c31(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsespace(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseFieldLTEValue(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c32(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + } + } + } + } + } + } + } + } + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c20); } + } + + return s0; + } + + function peg$parseFieldEQValue() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsefieldName(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 58) { + s2 = peg$c33; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c34); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parsefieldContainsValue(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c35(s1, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseFieldEXACTValue() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsefieldName(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 61) { + s2 = peg$c36; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c37); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parsefieldContainsValue(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c35(s1, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseFieldGTValue() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsefieldName(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 62) { + s2 = peg$c38; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c39); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parserangeValue(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c40(s1, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseFieldGTEValue() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsefieldName(); + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c41) { + s2 = peg$c41; + peg$currPos += 2; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c42); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parserangeValue(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c40(s1, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseFieldLTValue() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsefieldName(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 60) { + s2 = peg$c43; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c44); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parserangeValue(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c40(s1, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseFieldLTEValue() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsefieldName(); + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 2) === peg$c45) { + s2 = peg$c45; + peg$currPos += 2; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c46); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parserangeValue(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c40(s1, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parseflagName() { + var s0, s1; + + peg$silentFails++; + s0 = peg$parseidentifier(); + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c47); } + } + + return s0; + } + + function peg$parsefieldName() { + var s0, s1, s2; + + peg$silentFails++; + s0 = peg$currPos; + s1 = peg$parseidentifier(); + if (s1 !== peg$FAILED) { + peg$savedPos = peg$currPos; + s2 = peg$c49(s1); + if (s2) { + s2 = void 0; + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c50(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c48); } + } + + return s0; + } + + function peg$parseidentifier() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = []; + s2 = peg$parseidentifierChar(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseidentifierChar(); + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c51(); + } + s0 = s1; + + return s0; + } + + function peg$parseidentifierChar() { + var s0; + + s0 = peg$parsealnum(); + if (s0 === peg$FAILED) { + if (peg$c52.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c53); } + } + if (s0 === peg$FAILED) { + s0 = peg$parseescapedChar(); + } + } + + return s0; + } + + function peg$parsefieldContainsValue() { + var s0, s1; + + peg$silentFails++; + s0 = peg$parsecontainsOrValues(); + if (s0 === peg$FAILED) { + s0 = peg$parsecontainsValue(); + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c54); } + } + + return s0; + } + + function peg$parsetermValue() { + var s0, s1; + + peg$silentFails++; + s0 = peg$currPos; + s1 = peg$parsecontainsValue(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c56(s1); + } + s0 = s1; + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c55); } + } + + return s0; + } + + function peg$parsecontainsOrValues() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 40) { + s1 = peg$c4; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsespace(); + if (s2 === peg$FAILED) { + s2 = null; + } + if (s2 !== peg$FAILED) { + s3 = peg$parsecontainsValue(); + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$currPos; + s6 = peg$parsespace(); + if (s6 !== peg$FAILED) { + s7 = peg$parseorWord(); + if (s7 !== peg$FAILED) { + s8 = peg$parsespace(); + if (s8 !== peg$FAILED) { + s9 = peg$parsecontainsValue(); + if (s9 !== peg$FAILED) { + peg$savedPos = s5; + s6 = peg$c57(s3, s9); + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$currPos; + s6 = peg$parsespace(); + if (s6 !== peg$FAILED) { + s7 = peg$parseorWord(); + if (s7 !== peg$FAILED) { + s8 = peg$parsespace(); + if (s8 !== peg$FAILED) { + s9 = peg$parsecontainsValue(); + if (s9 !== peg$FAILED) { + peg$savedPos = s5; + s6 = peg$c57(s3, s9); + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + } + if (s4 !== peg$FAILED) { + s5 = peg$parsespace(); + if (s5 === peg$FAILED) { + s5 = null; + } + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s6 = peg$c6; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c7); } + } + if (s6 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c58(s3, s4); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parserangeValue() { + var s0; + + s0 = peg$parsenumberWord(); + if (s0 === peg$FAILED) { + s0 = peg$parsedate(); + } + + return s0; + } + + function peg$parsecontainsValue() { + var s0; + + s0 = peg$parsenumberWord(); + if (s0 === peg$FAILED) { + s0 = peg$parsedate(); + if (s0 === peg$FAILED) { + s0 = peg$parsebooleanWord(); + if (s0 === peg$FAILED) { + s0 = peg$parsephrase(); + if (s0 === peg$FAILED) { + s0 = peg$parseword(); + } + } + } + } + + return s0; + } + + function peg$parsephrase() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 34) { + s1 = peg$c59; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c60); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + s3 = peg$parsespace(); + if (s3 === peg$FAILED) { + s3 = null; + } + if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$parsephraseWord(); + if (s5 !== peg$FAILED) { + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parsephraseWord(); + } + } else { + s4 = peg$FAILED; + } + if (s4 === peg$FAILED) { + s4 = null; + } + if (s4 !== peg$FAILED) { + s5 = []; + s6 = peg$currPos; + s7 = peg$parsespace(); + if (s7 !== peg$FAILED) { + s8 = []; + s9 = peg$parsephraseWord(); + if (s9 !== peg$FAILED) { + while (s9 !== peg$FAILED) { + s8.push(s9); + s9 = peg$parsephraseWord(); + } + } else { + s8 = peg$FAILED; + } + if (s8 !== peg$FAILED) { + s7 = [s7, s8]; + s6 = s7; + } else { + peg$currPos = s6; + s6 = peg$FAILED; + } + } else { + peg$currPos = s6; + s6 = peg$FAILED; + } + while (s6 !== peg$FAILED) { + s5.push(s6); + s6 = peg$currPos; + s7 = peg$parsespace(); + if (s7 !== peg$FAILED) { + s8 = []; + s9 = peg$parsephraseWord(); + if (s9 !== peg$FAILED) { + while (s9 !== peg$FAILED) { + s8.push(s9); + s9 = peg$parsephraseWord(); + } + } else { + s8 = peg$FAILED; + } + if (s8 !== peg$FAILED) { + s7 = [s7, s8]; + s6 = s7; + } else { + peg$currPos = s6; + s6 = peg$FAILED; + } + } else { + peg$currPos = s6; + s6 = peg$FAILED; + } + } + if (s5 !== peg$FAILED) { + s6 = peg$parsespace(); + if (s6 === peg$FAILED) { + s6 = null; + } + if (s6 !== peg$FAILED) { + peg$savedPos = s2; + s3 = peg$c61(); + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s3 = peg$c59; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c60); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c62(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsephraseWord() { + var s0, s1, s2; + + s0 = []; + if (peg$c63.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c64); } + } + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$c63.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c64); } + } + } + } else { + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c65) { + s1 = peg$c65; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c66); } + } + if (s1 !== peg$FAILED) { + if (input.length > peg$currPos) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c67); } + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + return s0; + } + + function peg$parseword() { + var s0, s1, s2; + + s0 = peg$currPos; + s1 = []; + s2 = peg$parsewordChar(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parsewordChar(); + } + } else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c68(); + } + s0 = s1; + + return s0; + } + + function peg$parsewordChar() { + var s0; + + s0 = peg$parsealnum(); + if (s0 === peg$FAILED) { + if (peg$c69.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c70); } + } + if (s0 === peg$FAILED) { + s0 = peg$parseescapedChar(); + if (s0 === peg$FAILED) { + s0 = peg$parseextendedGlyph(); + } + } + } + + return s0; + } + + function peg$parseextendedGlyph() { + var s0; + + if (peg$c71.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c72); } + } + + return s0; + } + + function peg$parseescapedChar() { + var s0, s1, s2; + + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c65) { + s1 = peg$c65; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c66); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parsereservedChar(); + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsereservedChar() { + var s0; + + if (peg$c73.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c74); } + } + + return s0; + } + + function peg$parseorWord() { + var s0, s1, s2; + + s0 = peg$currPos; + if (peg$c75.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c76); } + } + if (s1 !== peg$FAILED) { + if (peg$c77.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c78); } + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsebooleanWord() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parseboolean(); + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parsespace(); + peg$silentFails--; + if (s3 !== peg$FAILED) { + peg$currPos = s2; + s2 = void 0; + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c79(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseboolean(); + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + if (input.length > peg$currPos) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c67); } + } + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = void 0; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c79(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + return s0; + } + + function peg$parseboolean() { + var s0, s1, s2, s3, s4, s5; + + s0 = peg$currPos; + if (peg$c80.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c81); } + } + if (s1 !== peg$FAILED) { + if (peg$c77.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c78); } + } + if (s2 !== peg$FAILED) { + if (peg$c82.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c83); } + } + if (s3 !== peg$FAILED) { + if (peg$c84.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c85); } + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c86(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (peg$c87.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c88); } + } + if (s1 !== peg$FAILED) { + if (peg$c89.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c90); } + } + if (s2 !== peg$FAILED) { + if (peg$c91.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c92); } + } + if (s3 !== peg$FAILED) { + if (peg$c93.test(input.charAt(peg$currPos))) { + s4 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c94); } + } + if (s4 !== peg$FAILED) { + if (peg$c84.test(input.charAt(peg$currPos))) { + s5 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c85); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c86(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (peg$c95.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c96); } + } + if (s1 !== peg$FAILED) { + if (peg$c84.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c85); } + } + if (s2 !== peg$FAILED) { + if (peg$c93.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c94); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c86(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (peg$c97.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c98); } + } + if (s1 !== peg$FAILED) { + if (peg$c75.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c76); } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c86(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (peg$c75.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c76); } + } + if (s1 !== peg$FAILED) { + if (peg$c87.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c88); } + } + if (s2 !== peg$FAILED) { + if (peg$c87.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c88); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c86(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + } + } + + return s0; + } + + function peg$parsenumber() { + var s0, s1, s2, s3, s4, s5, s6, s7; + + s0 = peg$currPos; + if (peg$c99.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c100); } + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = []; + if (peg$c101.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c102); } + } + if (s3 !== peg$FAILED) { + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c101.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c102); } + } + } + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c103; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c104); } + } + if (s5 !== peg$FAILED) { + s6 = []; + if (peg$c101.test(input.charAt(peg$currPos))) { + s7 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c102); } + } + if (s7 !== peg$FAILED) { + while (s7 !== peg$FAILED) { + s6.push(s7); + if (peg$c101.test(input.charAt(peg$currPos))) { + s7 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c102); } + } + } + } else { + s6 = peg$FAILED; + } + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 46) { + s5 = peg$c103; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c104); } + } + if (s5 !== peg$FAILED) { + s6 = []; + if (peg$c101.test(input.charAt(peg$currPos))) { + s7 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c102); } + } + if (s7 !== peg$FAILED) { + while (s7 !== peg$FAILED) { + s6.push(s7); + if (peg$c101.test(input.charAt(peg$currPos))) { + s7 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c102); } + } + } + } else { + s6 = peg$FAILED; + } + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c105(); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsenumberWord() { + var s0, s1, s2, s3; + + s0 = peg$currPos; + s1 = peg$parsenumber(); + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + s3 = peg$parsespace(); + peg$silentFails--; + if (s3 !== peg$FAILED) { + peg$currPos = s2; + s2 = void 0; + } else { + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c106(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parsenumber(); + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + peg$silentFails++; + if (input.length > peg$currPos) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c67); } + } + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = void 0; + } else { + peg$currPos = s2; + s2 = peg$FAILED; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c106(s1); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + + return s0; + } + + function peg$parsedate() { + var s0, s1, s2, s3, s4, s5, s6; + + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 39) { + s1 = peg$c107; + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c108); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + s3 = []; + s4 = peg$currPos; + s5 = peg$currPos; + peg$silentFails++; + if (input.charCodeAt(peg$currPos) === 39) { + s6 = peg$c107; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c108); } + } + peg$silentFails--; + if (s6 === peg$FAILED) { + s5 = void 0; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + if (s5 !== peg$FAILED) { + if (input.length > peg$currPos) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c67); } + } + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + if (s4 !== peg$FAILED) { + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + s5 = peg$currPos; + peg$silentFails++; + if (input.charCodeAt(peg$currPos) === 39) { + s6 = peg$c107; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c108); } + } + peg$silentFails--; + if (s6 === peg$FAILED) { + s5 = void 0; + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + if (s5 !== peg$FAILED) { + if (input.length > peg$currPos) { + s6 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c67); } + } + if (s6 !== peg$FAILED) { + s5 = [s5, s6]; + s4 = s5; + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + } else { + s3 = peg$FAILED; + } + if (s3 !== peg$FAILED) { + peg$savedPos = s2; + s3 = peg$c109(); + } + s2 = s3; + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 39) { + s3 = peg$c107; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c108); } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c110(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } else { + peg$currPos = s0; + s0 = peg$FAILED; + } + + return s0; + } + + function peg$parsealnum() { + var s0, s1; + + peg$silentFails++; + if (peg$c112.test(input.charAt(peg$currPos))) { + s0 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c113); } + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c111); } + } + + return s0; + } + + function peg$parsespace() { + var s0, s1; + + peg$silentFails++; + s0 = []; + if (peg$c115.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c116); } + } + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$c115.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c116); } + } + } + } else { + s0 = peg$FAILED; + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c114); } + } + + return s0; + } + + + const { AST, Exp, unescapeValue, unescapePhraseValue, resolveFieldValue, recognizedFields } = options; + const hasRecognizedFields = recognizedFields && recognizedFields.length > 0; + const ctx = Object.assign({ error }, options ); + + + peg$result = peg$startRuleFunction(); + + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail(peg$endExpectation()); + } + + throw peg$buildStructuredError( + peg$maxFailExpected, + peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, + peg$maxFailPos < input.length + ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) + : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) + ); + } +} + +module.exports = { + SyntaxError: peg$SyntaxError, + parse: peg$parse +}; diff --git a/yarn.lock b/yarn.lock index ed0e233d048..926f8e68b00 100644 --- a/yarn.lock +++ b/yarn.lock @@ -509,6 +509,17 @@ __metadata: languageName: node linkType: hard +"@babel/code-frame@npm:^7.27.1": + version: 7.27.1 + resolution: "@babel/code-frame@npm:7.27.1" + dependencies: + "@babel/helper-validator-identifier": "npm:^7.27.1" + js-tokens: "npm:^4.0.0" + picocolors: "npm:^1.1.1" + checksum: 10c0/5dd9a18baa5fce4741ba729acc3a3272c49c25cb8736c4b18e113099520e7ef7b545a4096a26d600e4416157e63e87d66db46aa3fbf0a5f2286da2705c12da00 + languageName: node + linkType: hard + "@babel/compat-data@npm:^7.20.5": version: 7.21.0 resolution: "@babel/compat-data@npm:7.21.0" @@ -641,6 +652,19 @@ __metadata: languageName: node linkType: hard +"@babel/generator@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/generator@npm:7.28.5" + dependencies: + "@babel/parser": "npm:^7.28.5" + "@babel/types": "npm:^7.28.5" + "@jridgewell/gen-mapping": "npm:^0.3.12" + "@jridgewell/trace-mapping": "npm:^0.3.28" + jsesc: "npm:^3.0.2" + checksum: 10c0/9f219fe1d5431b6919f1a5c60db8d5d34fe546c0d8f5a8511b32f847569234ffc8032beb9e7404649a143f54e15224ecb53a3d11b6bb85c3203e573d91fca752 + languageName: node + linkType: hard + "@babel/helper-annotate-as-pure@npm:^7.18.6": version: 7.18.6 resolution: "@babel/helper-annotate-as-pure@npm:7.18.6" @@ -686,6 +710,15 @@ __metadata: languageName: node linkType: hard +"@babel/helper-annotate-as-pure@npm:^7.27.3": + version: 7.27.3 + resolution: "@babel/helper-annotate-as-pure@npm:7.27.3" + dependencies: + "@babel/types": "npm:^7.27.3" + checksum: 10c0/94996ce0a05b7229f956033e6dcd69393db2b0886d0db6aff41e704390402b8cdcca11f61449cb4f86cfd9e61b5ad3a73e4fa661eeed7846b125bd1c33dbc633 + languageName: node + linkType: hard + "@babel/helper-builder-binary-assignment-operator-visitor@npm:^7.24.6": version: 7.24.6 resolution: "@babel/helper-builder-binary-assignment-operator-visitor@npm:7.24.6" @@ -773,20 +806,19 @@ __metadata: linkType: hard "@babel/helper-create-class-features-plugin@npm:^7.18.6": - version: 7.21.0 - resolution: "@babel/helper-create-class-features-plugin@npm:7.21.0" - dependencies: - "@babel/helper-annotate-as-pure": "npm:^7.18.6" - "@babel/helper-environment-visitor": "npm:^7.18.9" - "@babel/helper-function-name": "npm:^7.21.0" - "@babel/helper-member-expression-to-functions": "npm:^7.21.0" - "@babel/helper-optimise-call-expression": "npm:^7.18.6" - "@babel/helper-replace-supers": "npm:^7.20.7" - "@babel/helper-skip-transparent-expression-wrappers": "npm:^7.20.0" - "@babel/helper-split-export-declaration": "npm:^7.18.6" + version: 7.28.5 + resolution: "@babel/helper-create-class-features-plugin@npm:7.28.5" + dependencies: + "@babel/helper-annotate-as-pure": "npm:^7.27.3" + "@babel/helper-member-expression-to-functions": "npm:^7.28.5" + "@babel/helper-optimise-call-expression": "npm:^7.27.1" + "@babel/helper-replace-supers": "npm:^7.27.1" + "@babel/helper-skip-transparent-expression-wrappers": "npm:^7.27.1" + "@babel/traverse": "npm:^7.28.5" + semver: "npm:^6.3.1" peerDependencies: "@babel/core": ^7.0.0 - checksum: 10c0/a034b6cc4ebf255ba3b1a5093ddf09321f7a70e438490c2ae5e517de8dfbf4cf5086f725e28f01864eb3798f704ce2be9b1adb0a748d756ebae14c4c8d6d8188 + checksum: 10c0/786a6514efcf4514aaad85beed419b9184d059f4c9a9a95108f320142764999827252a851f7071de19f29424d369616573ecbaa347f1ce23fb12fc6827d9ff56 languageName: node linkType: hard @@ -973,7 +1005,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-function-name@npm:^7.19.0, @babel/helper-function-name@npm:^7.21.0": +"@babel/helper-function-name@npm:^7.21.0": version: 7.21.0 resolution: "@babel/helper-function-name@npm:7.21.0" dependencies: @@ -1013,6 +1045,13 @@ __metadata: languageName: node linkType: hard +"@babel/helper-globals@npm:^7.28.0": + version: 7.28.0 + resolution: "@babel/helper-globals@npm:7.28.0" + checksum: 10c0/5a0cd0c0e8c764b5f27f2095e4243e8af6fa145daea2b41b53c0c1414fe6ff139e3640f4e2207ae2b3d2153a1abd346f901c26c290ee7cb3881dd922d4ee9232 + languageName: node + linkType: hard + "@babel/helper-hoist-variables@npm:^7.18.6": version: 7.18.6 resolution: "@babel/helper-hoist-variables@npm:7.18.6" @@ -1049,15 +1088,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-member-expression-to-functions@npm:^7.20.7, @babel/helper-member-expression-to-functions@npm:^7.21.0": - version: 7.21.0 - resolution: "@babel/helper-member-expression-to-functions@npm:7.21.0" - dependencies: - "@babel/types": "npm:^7.21.0" - checksum: 10c0/e9e5a57a306268e379ebefa7698008dfff60e53c35e719f2ad0e9b447901a05ec0cb03982d4f386acdcbdddbdf2ee04950cdc464754253bb488c7da2ff922503 - languageName: node - linkType: hard - "@babel/helper-member-expression-to-functions@npm:^7.24.6": version: 7.24.6 resolution: "@babel/helper-member-expression-to-functions@npm:7.24.6" @@ -1087,6 +1117,16 @@ __metadata: languageName: node linkType: hard +"@babel/helper-member-expression-to-functions@npm:^7.27.1, @babel/helper-member-expression-to-functions@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/helper-member-expression-to-functions@npm:7.28.5" + dependencies: + "@babel/traverse": "npm:^7.28.5" + "@babel/types": "npm:^7.28.5" + checksum: 10c0/4e6e05fbf4dffd0bc3e55e28fcaab008850be6de5a7013994ce874ec2beb90619cda4744b11607a60f8aae0227694502908add6188ceb1b5223596e765b44814 + languageName: node + linkType: hard + "@babel/helper-module-imports@npm:^7.16.7, @babel/helper-module-imports@npm:^7.18.6": version: 7.18.6 resolution: "@babel/helper-module-imports@npm:7.18.6" @@ -1177,15 +1217,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-optimise-call-expression@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/helper-optimise-call-expression@npm:7.18.6" - dependencies: - "@babel/types": "npm:^7.18.6" - checksum: 10c0/f1352ebc5d9abae6088e7d9b4b6b445c406ba552ef61e967ec77d005ff65752265b002b6faaf16cc293f9e37753760ef05c1f4b26cda1039256917022ba5669c - languageName: node - linkType: hard - "@babel/helper-optimise-call-expression@npm:^7.24.6": version: 7.24.6 resolution: "@babel/helper-optimise-call-expression@npm:7.24.6" @@ -1213,6 +1244,15 @@ __metadata: languageName: node linkType: hard +"@babel/helper-optimise-call-expression@npm:^7.27.1": + version: 7.27.1 + resolution: "@babel/helper-optimise-call-expression@npm:7.27.1" + dependencies: + "@babel/types": "npm:^7.27.1" + checksum: 10c0/6b861e7fcf6031b9c9fc2de3cd6c005e94a459d6caf3621d93346b52774925800ca29d4f64595a5ceacf4d161eb0d27649ae385110ed69491d9776686fa488e6 + languageName: node + linkType: hard + "@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.19.0, @babel/helper-plugin-utils@npm:^7.20.2, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3": version: 7.20.2 resolution: "@babel/helper-plugin-utils@npm:7.20.2" @@ -1255,20 +1295,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-remap-async-to-generator@npm:^7.18.9": - version: 7.18.9 - resolution: "@babel/helper-remap-async-to-generator@npm:7.18.9" - dependencies: - "@babel/helper-annotate-as-pure": "npm:^7.18.6" - "@babel/helper-environment-visitor": "npm:^7.18.9" - "@babel/helper-wrap-function": "npm:^7.18.9" - "@babel/types": "npm:^7.18.9" - peerDependencies: - "@babel/core": ^7.0.0 - checksum: 10c0/e6b2a906bdb3ec40d9cee7b7f8d02a561334603a0c57406a37c77d301ca77412ff33f2cef9d89421d7c3b1359604d613c596621a2ff22129612213198c5d1527 - languageName: node - linkType: hard - "@babel/helper-remap-async-to-generator@npm:^7.24.6": version: 7.24.6 resolution: "@babel/helper-remap-async-to-generator@npm:7.24.6" @@ -1308,20 +1334,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-replace-supers@npm:^7.20.7": - version: 7.20.7 - resolution: "@babel/helper-replace-supers@npm:7.20.7" - dependencies: - "@babel/helper-environment-visitor": "npm:^7.18.9" - "@babel/helper-member-expression-to-functions": "npm:^7.20.7" - "@babel/helper-optimise-call-expression": "npm:^7.18.6" - "@babel/template": "npm:^7.20.7" - "@babel/traverse": "npm:^7.20.7" - "@babel/types": "npm:^7.20.7" - checksum: 10c0/6d44965bdc24b61df89d8d92e3b86afe48d6a5932d7c8c059fb8bf53b9cf2845ed627e8261fac9b369b9a4dd1621e8e60a19f19902dc27e005f254d7a8cbffda - languageName: node - linkType: hard - "@babel/helper-replace-supers@npm:^7.24.6": version: 7.24.6 resolution: "@babel/helper-replace-supers@npm:7.24.6" @@ -1361,6 +1373,19 @@ __metadata: languageName: node linkType: hard +"@babel/helper-replace-supers@npm:^7.27.1": + version: 7.27.1 + resolution: "@babel/helper-replace-supers@npm:7.27.1" + dependencies: + "@babel/helper-member-expression-to-functions": "npm:^7.27.1" + "@babel/helper-optimise-call-expression": "npm:^7.27.1" + "@babel/traverse": "npm:^7.27.1" + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 10c0/4f2eaaf5fcc196580221a7ccd0f8873447b5d52745ad4096418f6101a1d2e712e9f93722c9a32bc9769a1dc197e001f60d6f5438d4dfde4b9c6a9e4df719354c + languageName: node + linkType: hard + "@babel/helper-simple-access@npm:^7.24.6": version: 7.24.6 resolution: "@babel/helper-simple-access@npm:7.24.6" @@ -1380,15 +1405,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-skip-transparent-expression-wrappers@npm:^7.20.0": - version: 7.20.0 - resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.20.0" - dependencies: - "@babel/types": "npm:^7.20.0" - checksum: 10c0/8529fb760ffbc3efc22ec5a079039fae65f40a90e9986642a85c1727aabdf6a79929546412f6210593970d2f97041f73bdd316e481d61110d6edcac1f97670a9 - languageName: node - linkType: hard - "@babel/helper-skip-transparent-expression-wrappers@npm:^7.24.6": version: 7.24.6 resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.24.6" @@ -1418,6 +1434,16 @@ __metadata: languageName: node linkType: hard +"@babel/helper-skip-transparent-expression-wrappers@npm:^7.27.1": + version: 7.27.1 + resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.27.1" + dependencies: + "@babel/traverse": "npm:^7.27.1" + "@babel/types": "npm:^7.27.1" + checksum: 10c0/f625013bcdea422c470223a2614e90d2c1cc9d832e97f32ca1b4f82b34bb4aa67c3904cb4b116375d3b5b753acfb3951ed50835a1e832e7225295c7b0c24dff7 + languageName: node + linkType: hard + "@babel/helper-split-export-declaration@npm:^7.18.6": version: 7.18.6 resolution: "@babel/helper-split-export-declaration@npm:7.18.6" @@ -1496,6 +1522,13 @@ __metadata: languageName: node linkType: hard +"@babel/helper-string-parser@npm:^7.27.1": + version: 7.27.1 + resolution: "@babel/helper-string-parser@npm:7.27.1" + checksum: 10c0/8bda3448e07b5583727c103560bcf9c4c24b3c1051a4c516d4050ef69df37bb9a4734a585fe12725b8c2763de0a265aa1e909b485a4e3270b7cfd3e4dbe4b602 + languageName: node + linkType: hard + "@babel/helper-validator-identifier@npm:^7.18.6, @babel/helper-validator-identifier@npm:^7.19.1": version: 7.19.1 resolution: "@babel/helper-validator-identifier@npm:7.19.1" @@ -1538,6 +1571,13 @@ __metadata: languageName: node linkType: hard +"@babel/helper-validator-identifier@npm:^7.27.1, @babel/helper-validator-identifier@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/helper-validator-identifier@npm:7.28.5" + checksum: 10c0/42aaebed91f739a41f3d80b72752d1f95fd7c72394e8e4bd7cdd88817e0774d80a432451bcba17c2c642c257c483bf1d409dd4548883429ea9493a3bc4ab0847 + languageName: node + linkType: hard + "@babel/helper-validator-option@npm:^7.18.6": version: 7.21.0 resolution: "@babel/helper-validator-option@npm:7.21.0" @@ -1573,18 +1613,6 @@ __metadata: languageName: node linkType: hard -"@babel/helper-wrap-function@npm:^7.18.9": - version: 7.20.5 - resolution: "@babel/helper-wrap-function@npm:7.20.5" - dependencies: - "@babel/helper-function-name": "npm:^7.19.0" - "@babel/template": "npm:^7.18.10" - "@babel/traverse": "npm:^7.20.5" - "@babel/types": "npm:^7.20.5" - checksum: 10c0/b5ea154778f6dbeb3cb9917933ea364f8f643aa79665c51f4a4b903bc451b3d18a738ab9952bdb43a81647f301a9be305bfcf02f2222b1235197e52c525703d6 - languageName: node - linkType: hard - "@babel/helper-wrap-function@npm:^7.24.6": version: 7.24.6 resolution: "@babel/helper-wrap-function@npm:7.24.6" @@ -1687,7 +1715,7 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.0.0, @babel/parser@npm:^7.1.0, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.21.3, @babel/parser@npm:^7.6.0": +"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.21.3, @babel/parser@npm:^7.6.0": version: 7.21.3 resolution: "@babel/parser@npm:7.21.3" bin: @@ -1754,6 +1782,17 @@ __metadata: languageName: node linkType: hard +"@babel/parser@npm:^7.27.2, @babel/parser@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/parser@npm:7.28.5" + dependencies: + "@babel/types": "npm:^7.28.5" + bin: + parser: ./bin/babel-parser.js + checksum: 10c0/5bbe48bf2c79594ac02b490a41ffde7ef5aa22a9a88ad6bcc78432a6ba8a9d638d531d868bd1f104633f1f6bba9905746e15185b8276a3756c42b765d131b1ef + languageName: node + linkType: hard + "@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:^7.24.6": version: 7.24.6 resolution: "@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:7.24.6" @@ -2361,19 +2400,6 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-async-to-generator@npm:^7.20.7": - version: 7.20.7 - resolution: "@babel/plugin-transform-async-to-generator@npm:7.20.7" - dependencies: - "@babel/helper-module-imports": "npm:^7.18.6" - "@babel/helper-plugin-utils": "npm:^7.20.2" - "@babel/helper-remap-async-to-generator": "npm:^7.18.9" - peerDependencies: - "@babel/core": ^7.0.0-0 - checksum: 10c0/c98caeafbffbdb40fd5d9d4c7a835d624ba1ada814e8e675d99a9c83bd40780ab6a52e3b873e81dc7ce045a3990427073e634f07cc2f2681d780faee0717d7e9 - languageName: node - linkType: hard - "@babel/plugin-transform-async-to-generator@npm:^7.24.6": version: 7.24.6 resolution: "@babel/plugin-transform-async-to-generator@npm:7.24.6" @@ -3980,22 +4006,6 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-runtime@npm:^7.21.4": - version: 7.24.6 - resolution: "@babel/plugin-transform-runtime@npm:7.24.6" - dependencies: - "@babel/helper-module-imports": "npm:^7.24.6" - "@babel/helper-plugin-utils": "npm:^7.24.6" - babel-plugin-polyfill-corejs2: "npm:^0.4.10" - babel-plugin-polyfill-corejs3: "npm:^0.10.1" - babel-plugin-polyfill-regenerator: "npm:^0.6.1" - semver: "npm:^6.3.1" - peerDependencies: - "@babel/core": ^7.0.0-0 - checksum: 10c0/89c43c1236506ecbfc547b12936283ca41e611430c2d2e6d12bf1cbdb0d80760cdae481951f486946733e1c9ae064cb05f4bc779c65b3288d40963b0c4a20c5c - languageName: node - linkType: hard - "@babel/plugin-transform-runtime@npm:^7.25.9": version: 7.26.9 resolution: "@babel/plugin-transform-runtime@npm:7.26.9" @@ -4858,7 +4868,7 @@ __metadata: languageName: node linkType: hard -"@babel/template@npm:^7.12.13, @babel/template@npm:^7.18.10, @babel/template@npm:^7.20.7": +"@babel/template@npm:^7.12.13, @babel/template@npm:^7.20.7": version: 7.20.7 resolution: "@babel/template@npm:7.20.7" dependencies: @@ -4924,7 +4934,18 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.13.0, @babel/traverse@npm:^7.20.5, @babel/traverse@npm:^7.20.7": +"@babel/template@npm:^7.27.2": + version: 7.27.2 + resolution: "@babel/template@npm:7.27.2" + dependencies: + "@babel/code-frame": "npm:^7.27.1" + "@babel/parser": "npm:^7.27.2" + "@babel/types": "npm:^7.27.1" + checksum: 10c0/ed9e9022651e463cc5f2cc21942f0e74544f1754d231add6348ff1b472985a3b3502041c0be62dc99ed2d12cfae0c51394bf827452b98a2f8769c03b87aadc81 + languageName: node + linkType: hard + +"@babel/traverse@npm:^7.13.0": version: 7.21.3 resolution: "@babel/traverse@npm:7.21.3" dependencies: @@ -5026,7 +5047,22 @@ __metadata: languageName: node linkType: hard -"@babel/types@npm:^7.0.0, @babel/types@npm:^7.13.0, @babel/types@npm:^7.18.6, @babel/types@npm:^7.18.9, @babel/types@npm:^7.19.0, @babel/types@npm:^7.20.0, @babel/types@npm:^7.20.5, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.0, @babel/types@npm:^7.21.3, @babel/types@npm:^7.3.0, @babel/types@npm:^7.4.4": +"@babel/traverse@npm:^7.27.1, @babel/traverse@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/traverse@npm:7.28.5" + dependencies: + "@babel/code-frame": "npm:^7.27.1" + "@babel/generator": "npm:^7.28.5" + "@babel/helper-globals": "npm:^7.28.0" + "@babel/parser": "npm:^7.28.5" + "@babel/template": "npm:^7.27.2" + "@babel/types": "npm:^7.28.5" + debug: "npm:^4.3.1" + checksum: 10c0/f6c4a595993ae2b73f2d4cd9c062f2e232174d293edd4abe1d715bd6281da8d99e47c65857e8d0917d9384c65972f4acdebc6749a7c40a8fcc38b3c7fb3e706f + languageName: node + linkType: hard + +"@babel/types@npm:^7.0.0, @babel/types@npm:^7.13.0, @babel/types@npm:^7.18.6, @babel/types@npm:^7.18.9, @babel/types@npm:^7.19.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.0, @babel/types@npm:^7.21.3, @babel/types@npm:^7.3.0, @babel/types@npm:^7.4.4": version: 7.21.3 resolution: "@babel/types@npm:7.21.3" dependencies: @@ -5101,6 +5137,16 @@ __metadata: languageName: node linkType: hard +"@babel/types@npm:^7.27.1, @babel/types@npm:^7.27.3, @babel/types@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/types@npm:7.28.5" + dependencies: + "@babel/helper-string-parser": "npm:^7.27.1" + "@babel/helper-validator-identifier": "npm:^7.28.5" + checksum: 10c0/a5a483d2100befbf125793640dec26b90b95fd233a94c19573325898a5ce1e52cdfa96e495c7dcc31b5eca5b66ce3e6d4a0f5a4a62daec271455959f208ab08a + languageName: node + linkType: hard + "@base2/pretty-print-object@npm:1.0.1": version: 1.0.1 resolution: "@base2/pretty-print-object@npm:1.0.1" @@ -5115,6 +5161,13 @@ __metadata: languageName: node linkType: hard +"@borewit/text-codec@npm:^0.1.0": + version: 0.1.1 + resolution: "@borewit/text-codec@npm:0.1.1" + checksum: 10c0/c92606b355111053f9db47d485c8679cc09a5be0eb2738aad5b922d3744465f2fce47144ffb27d5106fa431d1d2e5a2e0140d0a22351dccf49693098702c0274 + languageName: node + linkType: hard + "@cfaester/enzyme-adapter-react-18@npm:^0.7.0": version: 0.7.0 resolution: "@cfaester/enzyme-adapter-react-18@npm:0.7.0" @@ -7307,8 +7360,6 @@ __metadata: "@babel/core": "npm:^7.21.8" "@babel/plugin-proposal-class-properties": "npm:^7.18.6" "@babel/plugin-proposal-object-rest-spread": "npm:^7.20.7" - "@babel/plugin-transform-async-to-generator": "npm:^7.20.7" - "@babel/plugin-transform-runtime": "npm:^7.21.4" "@babel/preset-env": "npm:^7.21.5" "@babel/preset-react": "npm:^7.18.6" "@babel/preset-typescript": "npm:^7.21.5" @@ -7348,6 +7399,11 @@ __metadata: "@svgr/core": "npm:8.0.0" "@svgr/plugin-jsx": "npm:^8.0.1" "@svgr/plugin-svgo": "npm:^8.0.1" + "@swc/cli": "npm:^0.7.9" + "@swc/core": "npm:^1.15.2" + "@swc/helpers": "npm:^0.5.17" + "@swc/jest": "npm:^0.2.39" + "@swc/plugin-emotion": "npm:^13.0.0" "@testing-library/jest-dom": "npm:^5.16.3" "@testing-library/react": "npm:^14.0.0" "@testing-library/react-17": "npm:@testing-library/react@^12.1.5" @@ -7381,9 +7437,6 @@ __metadata: babel-jest: "npm:^29.7.0" babel-loader: "npm:^9.1.2" babel-plugin-add-module-exports: "npm:^1.0.4" - babel-plugin-inline-react-svg: "npm:^2.0.2" - babel-plugin-istanbul: "npm:^6.1.1" - babel-plugin-pegjs-inline-precompile: "npm:^0.1.1" buffer: "npm:^6.0.3" buildkite-test-collector: "npm:^1.7.2" cache-loader: "npm:^4.1.0" @@ -7486,6 +7539,8 @@ __metadata: stylelint-config-prettier-scss: "npm:^1.0.0" stylelint-config-standard: "npm:^33.0.0" stylelint-config-standard-scss: "npm:^9.0.0" + swc-loader: "npm:^0.2.6" + swc-plugin-coverage-instrument: "npm:^0.0.32" tabbable: "npm:^5.3.3" terser-webpack-plugin: "npm:^5.3.5" text-diff: "npm:^1.0.1" @@ -8317,6 +8372,15 @@ __metadata: languageName: node linkType: hard +"@jest/create-cache-key-function@npm:^30.0.0": + version: 30.2.0 + resolution: "@jest/create-cache-key-function@npm:30.2.0" + dependencies: + "@jest/types": "npm:30.2.0" + checksum: 10c0/0485bd42456494f640e2c29df71e8319f27053815609a209366fa8e9bb314f08c0b5828e0b733edb3670a33e9731ee2158288b73269045796c625d6b5c69cabe + languageName: node + linkType: hard + "@jest/environment@npm:^29.7.0": version: 29.7.0 resolution: "@jest/environment@npm:29.7.0" @@ -8374,6 +8438,16 @@ __metadata: languageName: node linkType: hard +"@jest/pattern@npm:30.0.1": + version: 30.0.1 + resolution: "@jest/pattern@npm:30.0.1" + dependencies: + "@types/node": "npm:*" + jest-regex-util: "npm:30.0.1" + checksum: 10c0/32c5a7bfb6c591f004dac0ed36d645002ed168971e4c89bd915d1577031672870032594767557b855c5bc330aa1e39a2f54bf150d2ee88a7a0886e9cb65318bc + languageName: node + linkType: hard + "@jest/reporters@npm:^29.7.0": version: 29.7.0 resolution: "@jest/reporters@npm:29.7.0" @@ -8411,6 +8485,15 @@ __metadata: languageName: node linkType: hard +"@jest/schemas@npm:30.0.5": + version: 30.0.5 + resolution: "@jest/schemas@npm:30.0.5" + dependencies: + "@sinclair/typebox": "npm:^0.34.0" + checksum: 10c0/449dcd7ec5c6505e9ac3169d1143937e67044ae3e66a729ce4baf31812dfd30535f2b3b2934393c97cfdf5984ff581120e6b38f62b8560c8b5b7cc07f4175f65 + languageName: node + linkType: hard + "@jest/schemas@npm:^29.6.3": version: 29.6.3 resolution: "@jest/schemas@npm:29.6.3" @@ -8478,6 +8561,21 @@ __metadata: languageName: node linkType: hard +"@jest/types@npm:30.2.0": + version: 30.2.0 + resolution: "@jest/types@npm:30.2.0" + dependencies: + "@jest/pattern": "npm:30.0.1" + "@jest/schemas": "npm:30.0.5" + "@types/istanbul-lib-coverage": "npm:^2.0.6" + "@types/istanbul-reports": "npm:^3.0.4" + "@types/node": "npm:*" + "@types/yargs": "npm:^17.0.33" + chalk: "npm:^4.1.2" + checksum: 10c0/ae121f6963bd9ed1cd9651db7be91bf14c05bff0d0eec4fca9fecf586bea4005e8f1de8cc9b8ef72e424ea96a309d123bef510b55a6a17a3b4b91a39d775e5cd + languageName: node + linkType: hard + "@jest/types@npm:^24.9.0": version: 24.9.0 resolution: "@jest/types@npm:24.9.0" @@ -8524,6 +8622,16 @@ __metadata: languageName: node linkType: hard +"@jridgewell/gen-mapping@npm:^0.3.12": + version: 0.3.13 + resolution: "@jridgewell/gen-mapping@npm:0.3.13" + dependencies: + "@jridgewell/sourcemap-codec": "npm:^1.5.0" + "@jridgewell/trace-mapping": "npm:^0.3.24" + checksum: 10c0/9a7d65fb13bd9aec1fbab74cda08496839b7e2ceb31f5ab922b323e94d7c481ce0fc4fd7e12e2610915ed8af51178bdc61e168e92a8c8b8303b030b03489b13b + languageName: node + linkType: hard + "@jridgewell/gen-mapping@npm:^0.3.5": version: 0.3.5 resolution: "@jridgewell/gen-mapping@npm:0.3.5" @@ -8597,6 +8705,13 @@ __metadata: languageName: node linkType: hard +"@jridgewell/sourcemap-codec@npm:^1.5.0": + version: 1.5.5 + resolution: "@jridgewell/sourcemap-codec@npm:1.5.5" + checksum: 10c0/f9e538f302b63c0ebc06eecb1dd9918dd4289ed36147a0ddce35d6ea4d7ebbda243cda7b2213b6a5e1d8087a298d5cf630fb2bd39329cdecb82017023f6081a0 + languageName: node + linkType: hard + "@jridgewell/trace-mapping@npm:0.3.9": version: 0.3.9 resolution: "@jridgewell/trace-mapping@npm:0.3.9" @@ -8627,6 +8742,16 @@ __metadata: languageName: node linkType: hard +"@jridgewell/trace-mapping@npm:^0.3.28": + version: 0.3.31 + resolution: "@jridgewell/trace-mapping@npm:0.3.31" + dependencies: + "@jridgewell/resolve-uri": "npm:^3.1.0" + "@jridgewell/sourcemap-codec": "npm:^1.4.14" + checksum: 10c0/4b30ec8cd56c5fd9a661f088230af01e0c1a3888d11ffb6b47639700f71225be21d1f7e168048d6d4f9449207b978a235c07c8f15c07705685d16dc06280e9d9 + languageName: node + linkType: hard + "@leichtgewicht/ip-codec@npm:^2.0.1": version: 2.0.4 resolution: "@leichtgewicht/ip-codec@npm:2.0.4" @@ -9004,6 +9129,185 @@ __metadata: languageName: node linkType: hard +"@napi-rs/nice-android-arm-eabi@npm:1.1.1": + version: 1.1.1 + resolution: "@napi-rs/nice-android-arm-eabi@npm:1.1.1" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@napi-rs/nice-android-arm64@npm:1.1.1": + version: 1.1.1 + resolution: "@napi-rs/nice-android-arm64@npm:1.1.1" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@napi-rs/nice-darwin-arm64@npm:1.1.1": + version: 1.1.1 + resolution: "@napi-rs/nice-darwin-arm64@npm:1.1.1" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@napi-rs/nice-darwin-x64@npm:1.1.1": + version: 1.1.1 + resolution: "@napi-rs/nice-darwin-x64@npm:1.1.1" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@napi-rs/nice-freebsd-x64@npm:1.1.1": + version: 1.1.1 + resolution: "@napi-rs/nice-freebsd-x64@npm:1.1.1" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@napi-rs/nice-linux-arm-gnueabihf@npm:1.1.1": + version: 1.1.1 + resolution: "@napi-rs/nice-linux-arm-gnueabihf@npm:1.1.1" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@napi-rs/nice-linux-arm64-gnu@npm:1.1.1": + version: 1.1.1 + resolution: "@napi-rs/nice-linux-arm64-gnu@npm:1.1.1" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@napi-rs/nice-linux-arm64-musl@npm:1.1.1": + version: 1.1.1 + resolution: "@napi-rs/nice-linux-arm64-musl@npm:1.1.1" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@napi-rs/nice-linux-ppc64-gnu@npm:1.1.1": + version: 1.1.1 + resolution: "@napi-rs/nice-linux-ppc64-gnu@npm:1.1.1" + conditions: os=linux & cpu=ppc64 & libc=glibc + languageName: node + linkType: hard + +"@napi-rs/nice-linux-riscv64-gnu@npm:1.1.1": + version: 1.1.1 + resolution: "@napi-rs/nice-linux-riscv64-gnu@npm:1.1.1" + conditions: os=linux & cpu=riscv64 & libc=glibc + languageName: node + linkType: hard + +"@napi-rs/nice-linux-s390x-gnu@npm:1.1.1": + version: 1.1.1 + resolution: "@napi-rs/nice-linux-s390x-gnu@npm:1.1.1" + conditions: os=linux & cpu=s390x & libc=glibc + languageName: node + linkType: hard + +"@napi-rs/nice-linux-x64-gnu@npm:1.1.1": + version: 1.1.1 + resolution: "@napi-rs/nice-linux-x64-gnu@npm:1.1.1" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@napi-rs/nice-linux-x64-musl@npm:1.1.1": + version: 1.1.1 + resolution: "@napi-rs/nice-linux-x64-musl@npm:1.1.1" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@napi-rs/nice-openharmony-arm64@npm:1.1.1": + version: 1.1.1 + resolution: "@napi-rs/nice-openharmony-arm64@npm:1.1.1" + conditions: os=openharmony & cpu=arm64 + languageName: node + linkType: hard + +"@napi-rs/nice-win32-arm64-msvc@npm:1.1.1": + version: 1.1.1 + resolution: "@napi-rs/nice-win32-arm64-msvc@npm:1.1.1" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@napi-rs/nice-win32-ia32-msvc@npm:1.1.1": + version: 1.1.1 + resolution: "@napi-rs/nice-win32-ia32-msvc@npm:1.1.1" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@napi-rs/nice-win32-x64-msvc@npm:1.1.1": + version: 1.1.1 + resolution: "@napi-rs/nice-win32-x64-msvc@npm:1.1.1" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@napi-rs/nice@npm:^1.0.1": + version: 1.1.1 + resolution: "@napi-rs/nice@npm:1.1.1" + dependencies: + "@napi-rs/nice-android-arm-eabi": "npm:1.1.1" + "@napi-rs/nice-android-arm64": "npm:1.1.1" + "@napi-rs/nice-darwin-arm64": "npm:1.1.1" + "@napi-rs/nice-darwin-x64": "npm:1.1.1" + "@napi-rs/nice-freebsd-x64": "npm:1.1.1" + "@napi-rs/nice-linux-arm-gnueabihf": "npm:1.1.1" + "@napi-rs/nice-linux-arm64-gnu": "npm:1.1.1" + "@napi-rs/nice-linux-arm64-musl": "npm:1.1.1" + "@napi-rs/nice-linux-ppc64-gnu": "npm:1.1.1" + "@napi-rs/nice-linux-riscv64-gnu": "npm:1.1.1" + "@napi-rs/nice-linux-s390x-gnu": "npm:1.1.1" + "@napi-rs/nice-linux-x64-gnu": "npm:1.1.1" + "@napi-rs/nice-linux-x64-musl": "npm:1.1.1" + "@napi-rs/nice-openharmony-arm64": "npm:1.1.1" + "@napi-rs/nice-win32-arm64-msvc": "npm:1.1.1" + "@napi-rs/nice-win32-ia32-msvc": "npm:1.1.1" + "@napi-rs/nice-win32-x64-msvc": "npm:1.1.1" + dependenciesMeta: + "@napi-rs/nice-android-arm-eabi": + optional: true + "@napi-rs/nice-android-arm64": + optional: true + "@napi-rs/nice-darwin-arm64": + optional: true + "@napi-rs/nice-darwin-x64": + optional: true + "@napi-rs/nice-freebsd-x64": + optional: true + "@napi-rs/nice-linux-arm-gnueabihf": + optional: true + "@napi-rs/nice-linux-arm64-gnu": + optional: true + "@napi-rs/nice-linux-arm64-musl": + optional: true + "@napi-rs/nice-linux-ppc64-gnu": + optional: true + "@napi-rs/nice-linux-riscv64-gnu": + optional: true + "@napi-rs/nice-linux-s390x-gnu": + optional: true + "@napi-rs/nice-linux-x64-gnu": + optional: true + "@napi-rs/nice-linux-x64-musl": + optional: true + "@napi-rs/nice-openharmony-arm64": + optional: true + "@napi-rs/nice-win32-arm64-msvc": + optional: true + "@napi-rs/nice-win32-ia32-msvc": + optional: true + "@napi-rs/nice-win32-x64-msvc": + optional: true + checksum: 10c0/517eacfd5d5de191f1469a6caad9f9e26924b25079550149fc792fb09d15184013a8a81966a666f08c0a93fbb17a458d50ba9e2e9d6a61141c6c515d083733b2 + languageName: node + linkType: hard + "@nicolo-ribaudo/chokidar-2@npm:2.1.8-no-fsevents.3": version: 2.1.8-no-fsevents.3 resolution: "@nicolo-ribaudo/chokidar-2@npm:2.1.8-no-fsevents.3" @@ -9541,6 +9845,13 @@ __metadata: languageName: node linkType: hard +"@sinclair/typebox@npm:^0.34.0": + version: 0.34.41 + resolution: "@sinclair/typebox@npm:0.34.41" + checksum: 10c0/0fb61fc2f90c25e30b19b0096eb8ab3ccef401d3e2acfce42168ff0ee877ba5981c8243fa6b1035ac756cde95316724e978b2837dd642d7e4e095de03a999c90 + languageName: node + linkType: hard + "@sindresorhus/is@npm:^0.14.0": version: 0.14.0 resolution: "@sindresorhus/is@npm:0.14.0" @@ -10312,6 +10623,156 @@ __metadata: languageName: node linkType: hard +"@swc/cli@npm:^0.7.9": + version: 0.7.9 + resolution: "@swc/cli@npm:0.7.9" + dependencies: + "@swc/counter": "npm:^0.1.3" + "@xhmikosr/bin-wrapper": "npm:^13.0.5" + commander: "npm:^8.3.0" + minimatch: "npm:^9.0.3" + piscina: "npm:^4.3.1" + semver: "npm:^7.3.8" + slash: "npm:3.0.0" + source-map: "npm:^0.7.3" + tinyglobby: "npm:^0.2.13" + peerDependencies: + "@swc/core": ^1.2.66 + chokidar: ^4.0.1 + peerDependenciesMeta: + chokidar: + optional: true + bin: + spack: bin/spack.js + swc: bin/swc.js + swcx: bin/swcx.js + checksum: 10c0/6b8cc41dd9a2230cef78a50550c77b09f987df33c057e2bd36d402f939f4c547a525e21a8fcff01551fc500901ecefff00389f69e32d1c11a9a77f598bd947e7 + languageName: node + linkType: hard + +"@swc/core-darwin-arm64@npm:1.15.2": + version: 1.15.2 + resolution: "@swc/core-darwin-arm64@npm:1.15.2" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@swc/core-darwin-x64@npm:1.15.2": + version: 1.15.2 + resolution: "@swc/core-darwin-x64@npm:1.15.2" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@swc/core-linux-arm-gnueabihf@npm:1.15.2": + version: 1.15.2 + resolution: "@swc/core-linux-arm-gnueabihf@npm:1.15.2" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@swc/core-linux-arm64-gnu@npm:1.15.2": + version: 1.15.2 + resolution: "@swc/core-linux-arm64-gnu@npm:1.15.2" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@swc/core-linux-arm64-musl@npm:1.15.2": + version: 1.15.2 + resolution: "@swc/core-linux-arm64-musl@npm:1.15.2" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@swc/core-linux-x64-gnu@npm:1.15.2": + version: 1.15.2 + resolution: "@swc/core-linux-x64-gnu@npm:1.15.2" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@swc/core-linux-x64-musl@npm:1.15.2": + version: 1.15.2 + resolution: "@swc/core-linux-x64-musl@npm:1.15.2" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@swc/core-win32-arm64-msvc@npm:1.15.2": + version: 1.15.2 + resolution: "@swc/core-win32-arm64-msvc@npm:1.15.2" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@swc/core-win32-ia32-msvc@npm:1.15.2": + version: 1.15.2 + resolution: "@swc/core-win32-ia32-msvc@npm:1.15.2" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@swc/core-win32-x64-msvc@npm:1.15.2": + version: 1.15.2 + resolution: "@swc/core-win32-x64-msvc@npm:1.15.2" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@swc/core@npm:^1.15.2": + version: 1.15.2 + resolution: "@swc/core@npm:1.15.2" + dependencies: + "@swc/core-darwin-arm64": "npm:1.15.2" + "@swc/core-darwin-x64": "npm:1.15.2" + "@swc/core-linux-arm-gnueabihf": "npm:1.15.2" + "@swc/core-linux-arm64-gnu": "npm:1.15.2" + "@swc/core-linux-arm64-musl": "npm:1.15.2" + "@swc/core-linux-x64-gnu": "npm:1.15.2" + "@swc/core-linux-x64-musl": "npm:1.15.2" + "@swc/core-win32-arm64-msvc": "npm:1.15.2" + "@swc/core-win32-ia32-msvc": "npm:1.15.2" + "@swc/core-win32-x64-msvc": "npm:1.15.2" + "@swc/counter": "npm:^0.1.3" + "@swc/types": "npm:^0.1.25" + peerDependencies: + "@swc/helpers": ">=0.5.17" + dependenciesMeta: + "@swc/core-darwin-arm64": + optional: true + "@swc/core-darwin-x64": + optional: true + "@swc/core-linux-arm-gnueabihf": + optional: true + "@swc/core-linux-arm64-gnu": + optional: true + "@swc/core-linux-arm64-musl": + optional: true + "@swc/core-linux-x64-gnu": + optional: true + "@swc/core-linux-x64-musl": + optional: true + "@swc/core-win32-arm64-msvc": + optional: true + "@swc/core-win32-ia32-msvc": + optional: true + "@swc/core-win32-x64-msvc": + optional: true + peerDependenciesMeta: + "@swc/helpers": + optional: true + checksum: 10c0/6141ae1800971af903fb4240ce8675ab30d65883c00a9c416c1d83291626dc6044d62dd66d3b6f0534d159b60b7c5f9a7c421c3cc19957bd8a98d134b92109ef + languageName: node + linkType: hard + +"@swc/counter@npm:^0.1.3": + version: 0.1.3 + resolution: "@swc/counter@npm:0.1.3" + checksum: 10c0/8424f60f6bf8694cfd2a9bca45845bce29f26105cda8cf19cdb9fd3e78dc6338699e4db77a89ae449260bafa1cc6bec307e81e7fb96dbf7dcfce0eea55151356 + languageName: node + linkType: hard + "@swc/helpers@npm:^0.5.11": version: 0.5.15 resolution: "@swc/helpers@npm:0.5.15" @@ -10321,6 +10782,46 @@ __metadata: languageName: node linkType: hard +"@swc/helpers@npm:^0.5.17": + version: 0.5.17 + resolution: "@swc/helpers@npm:0.5.17" + dependencies: + tslib: "npm:^2.8.0" + checksum: 10c0/fe1f33ebb968558c5a0c595e54f2e479e4609bff844f9ca9a2d1ffd8dd8504c26f862a11b031f48f75c95b0381c2966c3dd156e25942f90089badd24341e7dbb + languageName: node + linkType: hard + +"@swc/jest@npm:^0.2.39": + version: 0.2.39 + resolution: "@swc/jest@npm:0.2.39" + dependencies: + "@jest/create-cache-key-function": "npm:^30.0.0" + "@swc/counter": "npm:^0.1.3" + jsonc-parser: "npm:^3.2.0" + peerDependencies: + "@swc/core": "*" + checksum: 10c0/2df5f215bb7a3f31e1db606e3ac01c4e67900e8db004b38dbfaa09f87bcc2b054070211086e095eddcd174ee561b696fcf679ea38263fa6daf69fee37dacbdc9 + languageName: node + linkType: hard + +"@swc/plugin-emotion@npm:^13.0.0": + version: 13.0.0 + resolution: "@swc/plugin-emotion@npm:13.0.0" + dependencies: + "@swc/counter": "npm:^0.1.3" + checksum: 10c0/30210bfed0b49aa382f51c5c7d203f62d33c9969290c6aead7945af2db2b9d79b76e9b9f6fcc3dc34c8619789d10ceb0a238f034690c615dd7111d722f63cfc0 + languageName: node + linkType: hard + +"@swc/types@npm:^0.1.25": + version: 0.1.25 + resolution: "@swc/types@npm:0.1.25" + dependencies: + "@swc/counter": "npm:^0.1.3" + checksum: 10c0/847a5b20b131281f89d640a7ed4887fb65724807d53d334b230e84b98c21097aa10cd28a074f9ed287a6ce109e443dd4bafbe7dcfb62333d7806c4ea3e7f8aca + languageName: node + linkType: hard + "@szmarczak/http-timer@npm:^1.1.2": version: 1.1.2 resolution: "@szmarczak/http-timer@npm:1.1.2" @@ -10498,6 +10999,24 @@ __metadata: languageName: node linkType: hard +"@tokenizer/inflate@npm:^0.2.6": + version: 0.2.7 + resolution: "@tokenizer/inflate@npm:0.2.7" + dependencies: + debug: "npm:^4.4.0" + fflate: "npm:^0.8.2" + token-types: "npm:^6.0.0" + checksum: 10c0/75bd0c510810dfd62be9d963216b5852cde021e1f8aab43b37662bc6aa75e65fd7277fcab7d463186b55cee36a5b61129916161bdb2a7d18064016156c7daf4f + languageName: node + linkType: hard + +"@tokenizer/token@npm:^0.3.0": + version: 0.3.0 + resolution: "@tokenizer/token@npm:0.3.0" + checksum: 10c0/7ab9a822d4b5ff3f5bca7f7d14d46bdd8432528e028db4a52be7fbf90c7f495cc1af1324691dda2813c6af8dc4b8eb29de3107d4508165f9aa5b53e7d501f155 + languageName: node + linkType: hard + "@tootallnate/once@npm:1": version: 1.1.2 resolution: "@tootallnate/once@npm:1.1.2" @@ -11026,7 +11545,7 @@ __metadata: languageName: node linkType: hard -"@types/istanbul-lib-coverage@npm:^2.0.1": +"@types/istanbul-lib-coverage@npm:^2.0.1, @types/istanbul-lib-coverage@npm:^2.0.6": version: 2.0.6 resolution: "@types/istanbul-lib-coverage@npm:2.0.6" checksum: 10c0/3948088654f3eeb45363f1db158354fb013b362dba2a5c2c18c559484d5eb9f6fd85b23d66c0a7c2fcfab7308d0a585b14dadaca6cc8bf89ebfdc7f8f5102fb7 @@ -11052,7 +11571,7 @@ __metadata: languageName: node linkType: hard -"@types/istanbul-reports@npm:^3.0.0": +"@types/istanbul-reports@npm:^3.0.0, @types/istanbul-reports@npm:^3.0.4": version: 3.0.4 resolution: "@types/istanbul-reports@npm:3.0.4" dependencies: @@ -11741,6 +12260,15 @@ __metadata: languageName: node linkType: hard +"@types/yargs@npm:^17.0.33": + version: 17.0.35 + resolution: "@types/yargs@npm:17.0.35" + dependencies: + "@types/yargs-parser": "npm:*" + checksum: 10c0/609557826a6b85e73ccf587923f6429850d6dc70e420b455bab4601b670bfadf684b09ae288bccedab042c48ba65f1666133cf375814204b544009f57d6eef63 + languageName: node + linkType: hard + "@types/yargs@npm:^17.0.8": version: 17.0.32 resolution: "@types/yargs@npm:17.0.32" @@ -12936,6 +13464,123 @@ __metadata: languageName: node linkType: hard +"@xhmikosr/archive-type@npm:^7.1.0": + version: 7.1.0 + resolution: "@xhmikosr/archive-type@npm:7.1.0" + dependencies: + file-type: "npm:^20.5.0" + checksum: 10c0/10e36dd8d4e8522d4e935820ba676e5125dbbe86360314bf67369bf5590c52663a32d38a0a31654a23fb7f92accd457847f19779e1069a790c16b5b51b198843 + languageName: node + linkType: hard + +"@xhmikosr/bin-check@npm:^7.1.0": + version: 7.1.0 + resolution: "@xhmikosr/bin-check@npm:7.1.0" + dependencies: + execa: "npm:^5.1.1" + isexe: "npm:^2.0.0" + checksum: 10c0/c609f9eae93774b49f15b38189b05253fd628c5f35e305bb06b509f7b12ab667ea2b68fb60ff0563283a1f3e35994023dc02393876e6f29a11a1640a805e5413 + languageName: node + linkType: hard + +"@xhmikosr/bin-wrapper@npm:^13.0.5": + version: 13.2.0 + resolution: "@xhmikosr/bin-wrapper@npm:13.2.0" + dependencies: + "@xhmikosr/bin-check": "npm:^7.1.0" + "@xhmikosr/downloader": "npm:^15.2.0" + "@xhmikosr/os-filter-obj": "npm:^3.0.0" + bin-version-check: "npm:^5.1.0" + checksum: 10c0/d20361b314d506f4b8d69e192f13438e2cd8f7b222f94693664234c8d9816d0044c000e38f7c11dd0c6681b846b0ab2072a37fe1e42e6f253101e3d144ad6d3c + languageName: node + linkType: hard + +"@xhmikosr/decompress-tar@npm:^8.0.1, @xhmikosr/decompress-tar@npm:^8.1.0": + version: 8.1.0 + resolution: "@xhmikosr/decompress-tar@npm:8.1.0" + dependencies: + file-type: "npm:^20.5.0" + is-stream: "npm:^2.0.1" + tar-stream: "npm:^3.1.7" + checksum: 10c0/d0ec69b0304780202890ccec82f1ce20f1483c7de085c546d18b9960d21f7cf8b8932d8707fce53f6bb7a8b585e6c76f1281762e0b6a0481380c0a321ba6e6e6 + languageName: node + linkType: hard + +"@xhmikosr/decompress-tarbz2@npm:^8.1.0": + version: 8.1.0 + resolution: "@xhmikosr/decompress-tarbz2@npm:8.1.0" + dependencies: + "@xhmikosr/decompress-tar": "npm:^8.0.1" + file-type: "npm:^20.5.0" + is-stream: "npm:^2.0.1" + seek-bzip: "npm:^2.0.0" + unbzip2-stream: "npm:^1.4.3" + checksum: 10c0/87c23631d99ca2f51b2f34c79a5a3db6812598bcd39eb9f15f77112eae16ac36ea43907a1fd0acdc83b64a85ed4273d7a321f44cc3a3ca842c533b433e3c97a5 + languageName: node + linkType: hard + +"@xhmikosr/decompress-targz@npm:^8.1.0": + version: 8.1.0 + resolution: "@xhmikosr/decompress-targz@npm:8.1.0" + dependencies: + "@xhmikosr/decompress-tar": "npm:^8.0.1" + file-type: "npm:^20.5.0" + is-stream: "npm:^2.0.1" + checksum: 10c0/6de5215a8197d0321db919b8ad89dd050f2fc90fbfd4e2392183d0a9a9aaa855633074ece1dd1e270f63965d7733ff0b7a9a8105235cb7f6f90c255455094154 + languageName: node + linkType: hard + +"@xhmikosr/decompress-unzip@npm:^7.1.0": + version: 7.1.0 + resolution: "@xhmikosr/decompress-unzip@npm:7.1.0" + dependencies: + file-type: "npm:^20.5.0" + get-stream: "npm:^6.0.1" + yauzl: "npm:^3.1.2" + checksum: 10c0/3583916ae1316a4250c5f5774276439a1170c8c90c92c9642ff28c2cc443cb8060707dc27ec57065cb19c699aea006d5c3dd9179f901113517bceb7b73d58c57 + languageName: node + linkType: hard + +"@xhmikosr/decompress@npm:^10.2.0": + version: 10.2.0 + resolution: "@xhmikosr/decompress@npm:10.2.0" + dependencies: + "@xhmikosr/decompress-tar": "npm:^8.1.0" + "@xhmikosr/decompress-tarbz2": "npm:^8.1.0" + "@xhmikosr/decompress-targz": "npm:^8.1.0" + "@xhmikosr/decompress-unzip": "npm:^7.1.0" + graceful-fs: "npm:^4.2.11" + strip-dirs: "npm:^3.0.0" + checksum: 10c0/d4af98c3a91d913dd210591c23b081d179ec07fcfd3ced2fe884b17ea315bcc7b2e7e0cb66e1ab04c5a85cde46c32f955692dcd7735b876a83008df1ffbb88a8 + languageName: node + linkType: hard + +"@xhmikosr/downloader@npm:^15.2.0": + version: 15.2.0 + resolution: "@xhmikosr/downloader@npm:15.2.0" + dependencies: + "@xhmikosr/archive-type": "npm:^7.1.0" + "@xhmikosr/decompress": "npm:^10.2.0" + content-disposition: "npm:^0.5.4" + defaults: "npm:^2.0.2" + ext-name: "npm:^5.0.0" + file-type: "npm:^20.5.0" + filenamify: "npm:^6.0.0" + get-stream: "npm:^6.0.1" + got: "npm:^13.0.0" + checksum: 10c0/b5ff18c00ab5163c1215d27f49ca0319b2153aafd22c43e1bb19c4460d52ecb50c71eb4e7b6eba491adeab5920f4154b8a57c7a2893cf0ae4f3d868363391a5e + languageName: node + linkType: hard + +"@xhmikosr/os-filter-obj@npm:^3.0.0": + version: 3.0.0 + resolution: "@xhmikosr/os-filter-obj@npm:3.0.0" + dependencies: + arch: "npm:^3.0.0" + checksum: 10c0/e4f774ef8d36144b53749f02b602494653442379582756546415c05a5094f79931521cc0c430ab9f824a83a500ca64b8dd560e9f9b31e967bb608d2418050592 + languageName: node + linkType: hard + "@xtuc/ieee754@npm:^1.2.0": version: 1.2.0 resolution: "@xtuc/ieee754@npm:1.2.0" @@ -14159,6 +14804,13 @@ __metadata: languageName: node linkType: hard +"arch@npm:^3.0.0": + version: 3.0.0 + resolution: "arch@npm:3.0.0" + checksum: 10c0/abefcc6738a29632a2b48e7f5910f42fb26d2e2f9c6954cac80b6bdfc4048685c604ef8eb3fd862a7c0884785b20a66a1b44e2ba4b628fd34b80a0cc6a5a0493 + languageName: node + linkType: hard + "archy@npm:^1.0.0": version: 1.0.0 resolution: "archy@npm:1.0.0" @@ -14783,6 +15435,18 @@ __metadata: languageName: node linkType: hard +"b4a@npm:^1.6.4": + version: 1.7.3 + resolution: "b4a@npm:1.7.3" + peerDependencies: + react-native-b4a: "*" + peerDependenciesMeta: + react-native-b4a: + optional: true + checksum: 10c0/ac16d186e00fa0d16de1f1a4af413953bc762d50d5a0e382aaa744a13886600313b7293403ad77fc83f6b1489c3fc2610494d1026754a51d1b7cdac2115a7598 + languageName: node + linkType: hard + "babel-jest@npm:^29.7.0": version: 29.7.0 resolution: "babel-jest@npm:29.7.0" @@ -14842,21 +15506,6 @@ __metadata: languageName: node linkType: hard -"babel-plugin-inline-react-svg@npm:^2.0.2": - version: 2.0.2 - resolution: "babel-plugin-inline-react-svg@npm:2.0.2" - dependencies: - "@babel/helper-plugin-utils": "npm:^7.0.0" - "@babel/parser": "npm:^7.0.0" - lodash.isplainobject: "npm:^4.0.6" - resolve: "npm:^2.0.0-next.4" - svgo: "npm:^2.8.0" - peerDependencies: - "@babel/core": ^7.0.0 - checksum: 10c0/eac0b963bb71457b78a4ed266a3c1fdd84549c912e10228ae6432de5354b66a59377cc8bce8dabd14c746a8e6c8106405c84426255bf9c4950c7a06300a76276 - languageName: node - linkType: hard - "babel-plugin-istanbul@npm:^6.1.1": version: 6.1.1 resolution: "babel-plugin-istanbul@npm:6.1.1" @@ -14893,16 +15542,6 @@ __metadata: languageName: node linkType: hard -"babel-plugin-pegjs-inline-precompile@npm:^0.1.1": - version: 0.1.1 - resolution: "babel-plugin-pegjs-inline-precompile@npm:0.1.1" - dependencies: - babylon: "npm:^6.18.0" - pegjs: "npm:^0.10.0" - checksum: 10c0/f05cbe488bae090ccbaa440193b52353ca8d6d96abf4e63bf61bd7c6789496580e2c268ba8baf12a4bb3b052f187160c0608467c5d7bc43fda642e5c8a1fe192 - languageName: node - linkType: hard - "babel-plugin-polyfill-corejs2@npm:^0.4.10": version: 0.4.10 resolution: "babel-plugin-polyfill-corejs2@npm:0.4.10" @@ -14916,7 +15555,7 @@ __metadata: languageName: node linkType: hard -"babel-plugin-polyfill-corejs3@npm:^0.10.1, babel-plugin-polyfill-corejs3@npm:^0.10.4": +"babel-plugin-polyfill-corejs3@npm:^0.10.4": version: 0.10.4 resolution: "babel-plugin-polyfill-corejs3@npm:0.10.4" dependencies: @@ -14997,15 +15636,6 @@ __metadata: languageName: node linkType: hard -"babylon@npm:^6.18.0": - version: 6.18.0 - resolution: "babylon@npm:6.18.0" - bin: - babylon: ./bin/babylon.js - checksum: 10c0/9b1bf946e16782deadb1f5414c1269efa6044eb1e97a3de2051f09a3f2a54e97be3542d4242b28d23de0ef67816f519d38ce1ec3ddb7be306131c39a60e5a667 - languageName: node - linkType: hard - "bail@npm:^1.0.0": version: 1.0.5 resolution: "bail@npm:1.0.5" @@ -15034,6 +15664,18 @@ __metadata: languageName: node linkType: hard +"bare-events@npm:^2.7.0": + version: 2.8.2 + resolution: "bare-events@npm:2.8.2" + peerDependencies: + bare-abort-controller: "*" + peerDependenciesMeta: + bare-abort-controller: + optional: true + checksum: 10c0/53fef240cf2cdcca62f78b6eead90ddb5a59b0929f414b13a63764c2b4f9de98ea8a578d033b04d64bb7b86dfbc402e937984e69950855cc3754c7b63da7db21 + languageName: node + linkType: hard + "base64-js@npm:^1.0.2, base64-js@npm:^1.3.1": version: 1.5.1 resolution: "base64-js@npm:1.5.1" @@ -15127,6 +15769,17 @@ __metadata: languageName: node linkType: hard +"bin-version-check@npm:^5.1.0": + version: 5.1.0 + resolution: "bin-version-check@npm:5.1.0" + dependencies: + bin-version: "npm:^6.0.0" + semver: "npm:^7.5.3" + semver-truncate: "npm:^3.0.0" + checksum: 10c0/f2a855b53b41e7200ab10fe6981fbd564430c2d58f7ae48cf71fe74b0071b802963efc0fa11fa066c0116057e8072e0a7cd63e2dae79283e37cc444a023116b4 + languageName: node + linkType: hard + "bin-version@npm:^3.0.0": version: 3.1.0 resolution: "bin-version@npm:3.1.0" @@ -15137,6 +15790,16 @@ __metadata: languageName: node linkType: hard +"bin-version@npm:^6.0.0": + version: 6.0.0 + resolution: "bin-version@npm:6.0.0" + dependencies: + execa: "npm:^5.0.0" + find-versions: "npm:^5.0.0" + checksum: 10c0/e06083cdeb056910009740687ae9ba3175d42c72082408d4c5cb88c91fa102d5a8aef9112c127e94c3b48b611ce048abef390a9b8376521e42541635dbd3c506 + languageName: node + linkType: hard + "binary-extensions@npm:^2.0.0": version: 2.2.0 resolution: "binary-extensions@npm:2.2.0" @@ -15512,7 +16175,7 @@ __metadata: languageName: node linkType: hard -"buffer@npm:^5.5.0, buffer@npm:^5.6.0": +"buffer@npm:^5.2.1, buffer@npm:^5.5.0, buffer@npm:^5.6.0": version: 5.7.1 resolution: "buffer@npm:5.7.1" dependencies: @@ -17242,7 +17905,7 @@ __metadata: languageName: node linkType: hard -"commander@npm:^6.2.0, commander@npm:^6.2.1": +"commander@npm:^6.0.0, commander@npm:^6.2.0, commander@npm:^6.2.1": version: 6.2.1 resolution: "commander@npm:6.2.1" checksum: 10c0/85748abd9d18c8bc88febed58b98f66b7c591d9b5017cad459565761d7b29ca13b7783ea2ee5ce84bf235897333706c4ce29adf1ce15c8252780e7000e2ce9ea @@ -17447,7 +18110,7 @@ __metadata: languageName: node linkType: hard -"content-disposition@npm:0.5.4": +"content-disposition@npm:0.5.4, content-disposition@npm:^0.5.4": version: 0.5.4 resolution: "content-disposition@npm:0.5.4" dependencies: @@ -18225,16 +18888,6 @@ __metadata: languageName: node linkType: hard -"css-tree@npm:^1.1.2, css-tree@npm:^1.1.3": - version: 1.1.3 - resolution: "css-tree@npm:1.1.3" - dependencies: - mdn-data: "npm:2.0.14" - source-map: "npm:^0.6.1" - checksum: 10c0/499a507bfa39b8b2128f49736882c0dd636b0cd3370f2c69f4558ec86d269113286b7df469afc955de6a68b0dba00bc533e40022a73698081d600072d5d83c1c - languageName: node - linkType: hard - "css-tree@npm:^2.2.1, css-tree@npm:^2.3.1": version: 2.3.1 resolution: "css-tree@npm:2.3.1" @@ -18477,15 +19130,6 @@ __metadata: languageName: node linkType: hard -"csso@npm:^4.2.0": - version: 4.2.0 - resolution: "csso@npm:4.2.0" - dependencies: - css-tree: "npm:^1.1.2" - checksum: 10c0/f8c6b1300efaa0f8855a7905ae3794a29c6496e7f16a71dec31eb6ca7cfb1f058a4b03fd39b66c4deac6cb06bf6b4ba86da7b67d7320389cb9994d52b924b903 - languageName: node - linkType: hard - "csso@npm:^5.0.5": version: 5.0.5 resolution: "csso@npm:5.0.5" @@ -18925,6 +19569,18 @@ __metadata: languageName: node linkType: hard +"debug@npm:^4.4.0": + version: 4.4.3 + resolution: "debug@npm:4.4.3" + dependencies: + ms: "npm:^2.1.3" + peerDependenciesMeta: + supports-color: + optional: true + checksum: 10c0/d79136ec6c83ecbefd0f6a5593da6a9c91ec4d7ddc4b54c883d6e71ec9accb5f67a1a5e96d00a328196b5b5c86d365e98d8a3a70856aaf16b4e7b1985e67f5a6 + languageName: node + linkType: hard + "debuglog@npm:^1.0.1": version: 1.0.1 resolution: "debuglog@npm:1.0.1" @@ -19130,6 +19786,13 @@ __metadata: languageName: node linkType: hard +"defaults@npm:^2.0.2": + version: 2.0.2 + resolution: "defaults@npm:2.0.2" + checksum: 10c0/3c10658b31cd388fde654a95bd37f69e95f199887cc2386031bd8ae0964f0af22d8ef221c4d4737cca38358be4a606f69f20bd3bb604afa6328f72b4e2a217a6 + languageName: node + linkType: hard + "defer-to-connect@npm:^1.0.1": version: 1.1.3 resolution: "defer-to-connect@npm:1.1.3" @@ -21184,6 +21847,15 @@ __metadata: languageName: node linkType: hard +"events-universal@npm:^1.0.0": + version: 1.0.1 + resolution: "events-universal@npm:1.0.1" + dependencies: + bare-events: "npm:^2.7.0" + checksum: 10c0/a1d9a5e9f95843650f8ec240dd1221454c110189a9813f32cdf7185759b43f1f964367ac7dca4ebc69150b59043f2d77c7e122b0d03abf7c25477ea5494785a5 + languageName: node + linkType: hard + "events@npm:1.1.1": version: 1.1.1 resolution: "events@npm:1.1.1" @@ -21263,7 +21935,7 @@ __metadata: languageName: node linkType: hard -"execa@npm:^5.0.0": +"execa@npm:^5.0.0, execa@npm:^5.1.1": version: 5.1.1 resolution: "execa@npm:5.1.1" dependencies: @@ -21419,6 +22091,25 @@ __metadata: languageName: node linkType: hard +"ext-list@npm:^2.0.0": + version: 2.2.2 + resolution: "ext-list@npm:2.2.2" + dependencies: + mime-db: "npm:^1.28.0" + checksum: 10c0/bfdb435f333dccbf3f9698dc9d8e38eb47b42d756800bfafa9ec0c1c8aace877c40095baf36f691bcfd09bb88ed247c6e51596e75a158280fa19cf8588a7e258 + languageName: node + linkType: hard + +"ext-name@npm:^5.0.0": + version: 5.0.0 + resolution: "ext-name@npm:5.0.0" + dependencies: + ext-list: "npm:^2.0.0" + sort-keys-length: "npm:^1.0.0" + checksum: 10c0/6750b34636bb6dca78e1bcc797615af68ecf50d62cf774624a32ee7879da99c949b5c41e8aa56ede4eb15c6abad6b1a8858d0934faab75ff6e2fd6f408debe18 + languageName: node + linkType: hard + "extend-shallow@npm:^2.0.1": version: 2.0.1 resolution: "extend-shallow@npm:2.0.1" @@ -21535,6 +22226,13 @@ __metadata: languageName: node linkType: hard +"fast-fifo@npm:^1.2.0, fast-fifo@npm:^1.3.2": + version: 1.3.2 + resolution: "fast-fifo@npm:1.3.2" + checksum: 10c0/d53f6f786875e8b0529f784b59b4b05d4b5c31c651710496440006a398389a579c8dbcd2081311478b5bf77f4b0b21de69109c5a4eabea9d8e8783d1eb864e4c + languageName: node + linkType: hard + "fast-glob@npm:^2.0.2, fast-glob@npm:^2.2.6": version: 2.2.7 resolution: "fast-glob@npm:2.2.7" @@ -21700,6 +22398,18 @@ __metadata: languageName: node linkType: hard +"fdir@npm:^6.5.0": + version: 6.5.0 + resolution: "fdir@npm:6.5.0" + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + checksum: 10c0/e345083c4306b3aed6cb8ec551e26c36bab5c511e99ea4576a16750ddc8d3240e63826cc624f5ae17ad4dc82e68a253213b60d556c11bfad064b7607847ed07f + languageName: node + linkType: hard + "feed@npm:^4.2.2": version: 4.2.2 resolution: "feed@npm:4.2.2" @@ -21709,6 +22419,13 @@ __metadata: languageName: node linkType: hard +"fflate@npm:^0.8.2": + version: 0.8.2 + resolution: "fflate@npm:0.8.2" + checksum: 10c0/03448d630c0a583abea594835a9fdb2aaf7d67787055a761515bf4ed862913cfd693b4c4ffd5c3f3b355a70cf1e19033e9ae5aedcca103188aaff91b8bd6e293 + languageName: node + linkType: hard + "figgy-pudding@npm:^3.5.1": version: 3.5.1 resolution: "figgy-pudding@npm:3.5.1" @@ -21800,6 +22517,18 @@ __metadata: languageName: node linkType: hard +"file-type@npm:^20.5.0": + version: 20.5.0 + resolution: "file-type@npm:20.5.0" + dependencies: + "@tokenizer/inflate": "npm:^0.2.6" + strtok3: "npm:^10.2.0" + token-types: "npm:^6.0.0" + uint8array-extras: "npm:^1.4.0" + checksum: 10c0/9b13d7e4eca79752008f036712a42df78393f05b88b9013c5754b04d3eb90b051cb692836a04acf7d2c696cb9f28077ddf8ebd6830175807f14fddf837d63be3 + languageName: node + linkType: hard + "filelist@npm:^1.0.1": version: 1.0.1 resolution: "filelist@npm:1.0.1" @@ -21809,6 +22538,22 @@ __metadata: languageName: node linkType: hard +"filename-reserved-regex@npm:^3.0.0": + version: 3.0.0 + resolution: "filename-reserved-regex@npm:3.0.0" + checksum: 10c0/2b1df851a37f84723f9d8daf885ddfadd3dea2a124474db405295962abc1a01d6c9b6b27edec33bad32ef601e1a220f8a34d34f30ca5a911709700e2b517e268 + languageName: node + linkType: hard + +"filenamify@npm:^6.0.0": + version: 6.0.0 + resolution: "filenamify@npm:6.0.0" + dependencies: + filename-reserved-regex: "npm:^3.0.0" + checksum: 10c0/6798be1f7eea9eddb4517527a890a9d1b97083a6392b0ca392b79034d02d92411830d1b0e29f85ebfcb5cd4f8494388c7f9975fbada9d5f4088fc8474fdf20ae + languageName: node + linkType: hard + "filesize@npm:^3.6.1": version: 3.6.1 resolution: "filesize@npm:3.6.1" @@ -22040,6 +22785,15 @@ __metadata: languageName: node linkType: hard +"find-versions@npm:^5.0.0": + version: 5.1.0 + resolution: "find-versions@npm:5.1.0" + dependencies: + semver-regex: "npm:^4.0.5" + checksum: 10c0/f1ef79d0850e0bd1eba03def02892d31feccdef75129c14b2a2d1cec563e2c51ad5a01f6a7a2d59ddbf9ecca1014ff8a6353ff2e2885e004f7a81ab1488899d4 + languageName: node + linkType: hard + "find-yarn-workspace-root2@npm:1.2.16": version: 1.2.16 resolution: "find-yarn-workspace-root2@npm:1.2.16" @@ -23331,6 +24085,25 @@ __metadata: languageName: node linkType: hard +"got@npm:^13.0.0": + version: 13.0.0 + resolution: "got@npm:13.0.0" + dependencies: + "@sindresorhus/is": "npm:^5.2.0" + "@szmarczak/http-timer": "npm:^5.0.1" + cacheable-lookup: "npm:^7.0.0" + cacheable-request: "npm:^10.2.8" + decompress-response: "npm:^6.0.0" + form-data-encoder: "npm:^2.1.2" + get-stream: "npm:^6.0.1" + http2-wrapper: "npm:^2.1.10" + lowercase-keys: "npm:^3.0.0" + p-cancelable: "npm:^3.0.0" + responselike: "npm:^3.0.0" + checksum: 10c0/d6a4648dc46f1f9df2637b8730d4e664349a93cb6df62c66dfbb48f7887ba79742a1cc90739a4eb1c15f790ca838ff641c5cdecdc877993627274aeb0f02b92d + languageName: node + linkType: hard + "got@npm:^6.2.0, got@npm:^6.7.1": version: 6.7.1 resolution: "got@npm:6.7.1" @@ -25074,6 +25847,15 @@ __metadata: languageName: node linkType: hard +"inspect-with-kind@npm:^1.0.5": + version: 1.0.5 + resolution: "inspect-with-kind@npm:1.0.5" + dependencies: + kind-of: "npm:^6.0.2" + checksum: 10c0/4a7ca641927d24b5f0fabbad48ed940cffa840d6cfa07b6bc475593f6e0679b4d30ec1714de289cb17b10214a36e6bdccc257262a1163e33741425e5d311e8d1 + languageName: node + linkType: hard + "internal-slot@npm:^1.0.3": version: 1.0.3 resolution: "internal-slot@npm:1.0.3" @@ -25932,7 +26714,7 @@ __metadata: languageName: node linkType: hard -"is-stream@npm:^2.0.0": +"is-stream@npm:^2.0.0, is-stream@npm:^2.0.1": version: 2.0.1 resolution: "is-stream@npm:2.0.1" checksum: 10c0/7c284241313fc6efc329b8d7f08e16c0efeb6baab1b4cd0ba579eb78e5af1aa5da11e68559896a2067cd6c526bd29241dda4eb1225e627d5aa1a89a76d4635a5 @@ -26687,6 +27469,13 @@ __metadata: languageName: node linkType: hard +"jest-regex-util@npm:30.0.1": + version: 30.0.1 + resolution: "jest-regex-util@npm:30.0.1" + checksum: 10c0/f30c70524ebde2d1012afe5ffa5691d5d00f7d5ba9e43d588f6460ac6fe96f9e620f2f9b36a02d0d3e7e77bc8efb8b3450ae3b80ac53c8be5099e01bf54f6728 + languageName: node + linkType: hard + "jest-regex-util@npm:^29.6.3": version: 29.6.3 resolution: "jest-regex-util@npm:29.6.3" @@ -27181,6 +27970,13 @@ __metadata: languageName: node linkType: hard +"jsonc-parser@npm:^3.2.0": + version: 3.3.1 + resolution: "jsonc-parser@npm:3.3.1" + checksum: 10c0/269c3ae0a0e4f907a914bf334306c384aabb9929bd8c99f909275ebd5c2d3bc70b9bcd119ad794f339dec9f24b6a4ee9cd5a8ab2e6435e730ad4075388fc2ab6 + languageName: node + linkType: hard + "jsonfile@npm:^3.0.0": version: 3.0.1 resolution: "jsonfile@npm:3.0.1" @@ -27689,13 +28485,6 @@ __metadata: languageName: node linkType: hard -"lodash.isplainobject@npm:^4.0.6": - version: 4.0.6 - resolution: "lodash.isplainobject@npm:4.0.6" - checksum: 10c0/afd70b5c450d1e09f32a737bed06ff85b873ecd3d3d3400458725283e3f2e0bb6bf48e67dbe7a309eb371a822b16a26cca4a63c8c52db3fc7dc9d5f9dd324cbb - languageName: node - linkType: hard - "lodash.maxby@npm:^4.6.0": version: 4.6.0 resolution: "lodash.maxby@npm:4.6.0" @@ -28604,13 +29393,6 @@ __metadata: languageName: node linkType: hard -"mdn-data@npm:2.0.14": - version: 2.0.14 - resolution: "mdn-data@npm:2.0.14" - checksum: 10c0/67241f8708c1e665a061d2b042d2d243366e93e5bf1f917693007f6d55111588b952dcbfd3ea9c2d0969fb754aad81b30fdcfdcc24546495fc3b24336b28d4bd - languageName: node - linkType: hard - "mdn-data@npm:2.0.28": version: 2.0.28 resolution: "mdn-data@npm:2.0.28" @@ -29444,6 +30226,13 @@ __metadata: languageName: node linkType: hard +"mime-db@npm:^1.28.0": + version: 1.54.0 + resolution: "mime-db@npm:1.54.0" + checksum: 10c0/8d907917bc2a90fa2df842cdf5dfeaf509adc15fe0531e07bb2f6ab15992416479015828d6a74200041c492e42cce3ebf78e5ce714388a0a538ea9c53eece284 + languageName: node + linkType: hard + "mime-db@npm:~1.33.0": version: 1.33.0 resolution: "mime-db@npm:1.33.0" @@ -29625,21 +30414,21 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^9.0.4": - version: 9.0.4 - resolution: "minimatch@npm:9.0.4" +"minimatch@npm:^9.0.3, minimatch@npm:^9.0.5": + version: 9.0.5 + resolution: "minimatch@npm:9.0.5" dependencies: brace-expansion: "npm:^2.0.1" - checksum: 10c0/2c16f21f50e64922864e560ff97c587d15fd491f65d92a677a344e970fe62aafdbeafe648965fa96d33c061b4d0eabfe0213466203dd793367e7f28658cf6414 + checksum: 10c0/de96cf5e35bdf0eab3e2c853522f98ffbe9a36c37797778d2665231ec1f20a9447a7e567cb640901f89e4daaa95ae5d70c65a9e8aa2bb0019b6facbc3c0575ed languageName: node linkType: hard -"minimatch@npm:^9.0.5": - version: 9.0.5 - resolution: "minimatch@npm:9.0.5" +"minimatch@npm:^9.0.4": + version: 9.0.4 + resolution: "minimatch@npm:9.0.4" dependencies: brace-expansion: "npm:^2.0.1" - checksum: 10c0/de96cf5e35bdf0eab3e2c853522f98ffbe9a36c37797778d2665231ec1f20a9447a7e567cb640901f89e4daaa95ae5d70c65a9e8aa2bb0019b6facbc3c0575ed + checksum: 10c0/2c16f21f50e64922864e560ff97c587d15fd491f65d92a677a344e970fe62aafdbeafe648965fa96d33c061b4d0eabfe0213466203dd793367e7f28658cf6414 languageName: node linkType: hard @@ -32136,6 +32925,13 @@ __metadata: languageName: node linkType: hard +"picomatch@npm:^4.0.3": + version: 4.0.3 + resolution: "picomatch@npm:4.0.3" + checksum: 10c0/9582c951e95eebee5434f59e426cddd228a7b97a0161a375aed4be244bd3fe8e3a31b846808ea14ef2c8a2527a6eeab7b3946a67d5979e81694654f939473ae2 + languageName: node + linkType: hard + "pify@npm:^2.0.0, pify@npm:^2.2.0, pify@npm:^2.3.0": version: 2.3.0 resolution: "pify@npm:2.3.0" @@ -32180,6 +32976,18 @@ __metadata: languageName: node linkType: hard +"piscina@npm:^4.3.1": + version: 4.9.2 + resolution: "piscina@npm:4.9.2" + dependencies: + "@napi-rs/nice": "npm:^1.0.1" + dependenciesMeta: + "@napi-rs/nice": + optional: true + checksum: 10c0/ab67830065ff41523cd901db41b11045cb00a0be43bf79323ff7b4ef2fbce5e3a56ad440d99d6c3944ce94451a0a69fd175500e3220b21efe54142e601322189 + languageName: node + linkType: hard + "pixelmatch@npm:^5.2.0": version: 5.3.0 resolution: "pixelmatch@npm:5.3.0" @@ -36692,6 +37500,18 @@ __metadata: languageName: node linkType: hard +"seek-bzip@npm:^2.0.0": + version: 2.0.0 + resolution: "seek-bzip@npm:2.0.0" + dependencies: + commander: "npm:^6.0.0" + bin: + seek-bunzip: bin/seek-bunzip + seek-table: bin/seek-bzip-table + checksum: 10c0/bca70b60aed2aa333b3c4f1f46a1306d3edc68aa6ac0e700c32fe40428bc9bdb8d38d7eacbf4bc276a062da25c761dccb926a91e8a02086e9897779626e9171d + languageName: node + linkType: hard + "select-hose@npm:^2.0.0": version: 2.0.0 resolution: "select-hose@npm:2.0.0" @@ -36749,6 +37569,13 @@ __metadata: languageName: node linkType: hard +"semver-regex@npm:^4.0.5": + version: 4.0.5 + resolution: "semver-regex@npm:4.0.5" + checksum: 10c0/c270eda133691dfaab90318df995e96222e4c26c47b17f7c8bd5e5fe88b81ed67b59695fe27546e0314b0f0423c7faed1f93379ad9db47c816df2ddf770918ff + languageName: node + linkType: hard + "semver-truncate@npm:^1.1.2": version: 1.1.2 resolution: "semver-truncate@npm:1.1.2" @@ -36758,6 +37585,15 @@ __metadata: languageName: node linkType: hard +"semver-truncate@npm:^3.0.0": + version: 3.0.0 + resolution: "semver-truncate@npm:3.0.0" + dependencies: + semver: "npm:^7.3.5" + checksum: 10c0/faede4e69e81590ee6b4141f5e89ae1162cd0ecafe660f0ae72bca45f16677a01a3bc26283201b695cec8409e1e861b8b2b10b0621c1661983e7ab10736caeee + languageName: node + linkType: hard + "semver@npm:2 || 3 || 4 || 5, semver@npm:^5.0.3, semver@npm:^5.1.0, semver@npm:^5.3.0, semver@npm:^5.5.0, semver@npm:^5.6.0, semver@npm:^5.7.1": version: 5.7.1 resolution: "semver@npm:5.7.1" @@ -36834,6 +37670,15 @@ __metadata: languageName: node linkType: hard +"semver@npm:^7.3.8": + version: 7.7.3 + resolution: "semver@npm:7.7.3" + bin: + semver: bin/semver.js + checksum: 10c0/4afe5c986567db82f44c8c6faef8fe9df2a9b1d98098fc1721f57c696c4c21cebd572f297fc21002f81889492345b8470473bc6f4aff5fb032a6ea59ea2bc45e + languageName: node + linkType: hard + "semver@npm:^7.5.3": version: 7.5.4 resolution: "semver@npm:7.5.4" @@ -37197,6 +38042,13 @@ __metadata: languageName: node linkType: hard +"slash@npm:3.0.0, slash@npm:^3.0.0": + version: 3.0.0 + resolution: "slash@npm:3.0.0" + checksum: 10c0/e18488c6a42bdfd4ac5be85b2ced3ccd0224773baae6ad42cfbb9ec74fc07f9fa8396bd35ee638084ead7a2a0818eb5e7151111544d4731ce843019dab4be47b + languageName: node + linkType: hard + "slash@npm:^1.0.0": version: 1.0.0 resolution: "slash@npm:1.0.0" @@ -37211,13 +38063,6 @@ __metadata: languageName: node linkType: hard -"slash@npm:^3.0.0": - version: 3.0.0 - resolution: "slash@npm:3.0.0" - checksum: 10c0/e18488c6a42bdfd4ac5be85b2ced3ccd0224773baae6ad42cfbb9ec74fc07f9fa8396bd35ee638084ead7a2a0818eb5e7151111544d4731ce843019dab4be47b - languageName: node - linkType: hard - "slash@npm:^4.0.0": version: 4.0.0 resolution: "slash@npm:4.0.0" @@ -37398,6 +38243,24 @@ __metadata: languageName: node linkType: hard +"sort-keys-length@npm:^1.0.0": + version: 1.0.1 + resolution: "sort-keys-length@npm:1.0.1" + dependencies: + sort-keys: "npm:^1.0.0" + checksum: 10c0/4567d08aa859c7e48b7e2cba14a8ae09a100f6a3bd7cf5d21dccd808d6332c945b9a7e2230a95c16e0e6eac1a943cd050ae51a5d1b4c8ec4b1e89a5801be9aa2 + languageName: node + linkType: hard + +"sort-keys@npm:^1.0.0": + version: 1.1.2 + resolution: "sort-keys@npm:1.1.2" + dependencies: + is-plain-obj: "npm:^1.0.0" + checksum: 10c0/5dd383b0299a40277051f7498c3999520138e2eb50d422962f658738341c9e82349fad4a3024d5ba1a3122688fbaf958f2a472d4c53bade55515097c2ce15420 + languageName: node + linkType: hard + "sort-keys@npm:^2.0.0": version: 2.0.0 resolution: "sort-keys@npm:2.0.0" @@ -37885,6 +38748,17 @@ __metadata: languageName: node linkType: hard +"streamx@npm:^2.15.0": + version: 2.23.0 + resolution: "streamx@npm:2.23.0" + dependencies: + events-universal: "npm:^1.0.0" + fast-fifo: "npm:^1.3.2" + text-decoder: "npm:^1.1.0" + checksum: 10c0/15708ce37818d588632fe1104e8febde573e33e8c0868bf583fce0703f3faf8d2a063c278e30df2270206811b69997f64eb78792099933a1fe757e786fbcbd44 + languageName: node + linkType: hard + "strict-uri-encode@npm:^1.0.0": version: 1.1.0 resolution: "strict-uri-encode@npm:1.1.0" @@ -38200,6 +39074,16 @@ __metadata: languageName: node linkType: hard +"strip-dirs@npm:^3.0.0": + version: 3.0.0 + resolution: "strip-dirs@npm:3.0.0" + dependencies: + inspect-with-kind: "npm:^1.0.5" + is-plain-obj: "npm:^1.1.0" + checksum: 10c0/136cc8f3543f8785c5c59dc270d98106fb6625142e34304ea66a118338e5d5051681d650484a6737bee9bcfafd259fa5c044f4dda0f3bb5a5ffebf4e77effa11 + languageName: node + linkType: hard + "strip-eof@npm:^1.0.0": version: 1.0.0 resolution: "strip-eof@npm:1.0.0" @@ -38260,6 +39144,15 @@ __metadata: languageName: node linkType: hard +"strtok3@npm:^10.2.0": + version: 10.3.4 + resolution: "strtok3@npm:10.3.4" + dependencies: + "@tokenizer/token": "npm:^0.3.0" + checksum: 10c0/277ab69e417f4545e364ffaf9d560c991f531045dbace32d77b5c822cccd76a608b782785a2c60595274288d4d32dced184a5c21dc20348791da697127dc69a8 + languageName: node + linkType: hard + "style-loader@npm:^3.3.1": version: 3.3.1 resolution: "style-loader@npm:3.3.1" @@ -38607,23 +39500,6 @@ __metadata: languageName: node linkType: hard -"svgo@npm:^2.8.0": - version: 2.8.0 - resolution: "svgo@npm:2.8.0" - dependencies: - "@trysound/sax": "npm:0.2.0" - commander: "npm:^7.2.0" - css-select: "npm:^4.1.3" - css-tree: "npm:^1.1.3" - csso: "npm:^4.2.0" - picocolors: "npm:^1.0.0" - stable: "npm:^0.1.8" - bin: - svgo: bin/svgo - checksum: 10c0/0741f5d5cad63111a90a0ce7a1a5a9013f6d293e871b75efe39addb57f29a263e45294e485a4d2ff9cc260a5d142c8b5937b2234b4ef05efdd2706fb2d360ecc - languageName: node - linkType: hard - "svgo@npm:^3.0.2": version: 3.0.2 resolution: "svgo@npm:3.0.2" @@ -38657,6 +39533,25 @@ __metadata: languageName: node linkType: hard +"swc-loader@npm:^0.2.6": + version: 0.2.6 + resolution: "swc-loader@npm:0.2.6" + dependencies: + "@swc/counter": "npm:^0.1.3" + peerDependencies: + "@swc/core": ^1.2.147 + webpack: ">=2" + checksum: 10c0/b06926c5cb153931589c2166aa4c7c052cc53c68758acdda480d1eb59ecddf7d74b168e33166c4f807cc9dbae4395de9d80a14ad43e265fffaa775638abf71ce + languageName: node + linkType: hard + +"swc-plugin-coverage-instrument@npm:^0.0.32": + version: 0.0.32 + resolution: "swc-plugin-coverage-instrument@npm:0.0.32" + checksum: 10c0/c58fc5df25529e7b9aad8e9d7e088e5699bfa321dd8a7b6e624a9fc7e6f594a15a469fc878a0100cf3760e03e2e11ae8baf36db16fbe743a96ca0e29440c61c8 + languageName: node + linkType: hard + "symbol-tree@npm:^3.2.4": version: 3.2.4 resolution: "symbol-tree@npm:3.2.4" @@ -38781,6 +39676,17 @@ __metadata: languageName: node linkType: hard +"tar-stream@npm:^3.1.7": + version: 3.1.7 + resolution: "tar-stream@npm:3.1.7" + dependencies: + b4a: "npm:^1.6.4" + fast-fifo: "npm:^1.2.0" + streamx: "npm:^2.15.0" + checksum: 10c0/a09199d21f8714bd729993ac49b6c8efcb808b544b89f23378ad6ffff6d1cb540878614ba9d4cfec11a64ef39e1a6f009a5398371491eb1fda606ffc7f70f718 + languageName: node + linkType: hard + "tar@npm:^6.0.2, tar@npm:^6.1.0, tar@npm:^6.1.11, tar@npm:^6.1.2": version: 6.1.13 resolution: "tar@npm:6.1.13" @@ -39027,6 +39933,15 @@ __metadata: languageName: node linkType: hard +"text-decoder@npm:^1.1.0": + version: 1.2.3 + resolution: "text-decoder@npm:1.2.3" + dependencies: + b4a: "npm:^1.6.4" + checksum: 10c0/569d776b9250158681c83656ef2c3e0a5d5c660c27ca69f87eedef921749a4fbf02095e5f9a0f862a25cf35258379b06e31dee9c125c9f72e273b7ca1a6d1977 + languageName: node + linkType: hard + "text-diff@npm:^1.0.1": version: 1.0.1 resolution: "text-diff@npm:1.0.1" @@ -39169,6 +40084,16 @@ __metadata: languageName: node linkType: hard +"tinyglobby@npm:^0.2.13": + version: 0.2.15 + resolution: "tinyglobby@npm:0.2.15" + dependencies: + fdir: "npm:^6.5.0" + picomatch: "npm:^4.0.3" + checksum: 10c0/869c31490d0d88eedb8305d178d4c75e7463e820df5a9b9d388291daf93e8b1eb5de1dad1c1e139767e4269fe75f3b10d5009b2cc14db96ff98986920a186844 + languageName: node + linkType: hard + "tinylogic@npm:^2.0.0": version: 2.0.0 resolution: "tinylogic@npm:2.0.0" @@ -39316,6 +40241,17 @@ __metadata: languageName: node linkType: hard +"token-types@npm:^6.0.0": + version: 6.1.1 + resolution: "token-types@npm:6.1.1" + dependencies: + "@borewit/text-codec": "npm:^0.1.0" + "@tokenizer/token": "npm:^0.3.0" + ieee754: "npm:^1.2.1" + checksum: 10c0/e2405e7789d41693a09c478b53c47ffadd735a5f4c826d9885787d022ab10e26cc4a67b03593285748bf3b0c0237e0ea2ab268abcb953ea314727201d0f6504d + languageName: node + linkType: hard + "totalist@npm:^3.0.0": version: 3.0.1 resolution: "totalist@npm:3.0.1" @@ -40058,6 +40994,13 @@ __metadata: languageName: node linkType: hard +"uint8array-extras@npm:^1.4.0": + version: 1.5.0 + resolution: "uint8array-extras@npm:1.5.0" + checksum: 10c0/0e74641ac7dadb02eadefc1ccdadba6010e007757bda824960de3c72bbe2b04e6d3af75648441f412148c4103261d54fcb60be45a2863beb76643a55fddba3bd + languageName: node + linkType: hard + "unbox-primitive@npm:^1.0.1": version: 1.0.1 resolution: "unbox-primitive@npm:1.0.1" @@ -40082,6 +41025,16 @@ __metadata: languageName: node linkType: hard +"unbzip2-stream@npm:^1.4.3": + version: 1.4.3 + resolution: "unbzip2-stream@npm:1.4.3" + dependencies: + buffer: "npm:^5.2.1" + through: "npm:^2.3.8" + checksum: 10c0/2ea2048f3c9db3499316ccc1d95ff757017ccb6f46c812d7c42466247e3b863fb178864267482f7f178254214247779daf68e85f50bd7736c3c97ba2d58b910a + languageName: node + linkType: hard + "underscore@npm:^1.9.1": version: 1.10.2 resolution: "underscore@npm:1.10.2" @@ -42478,6 +43431,16 @@ __metadata: languageName: node linkType: hard +"yauzl@npm:^3.1.2": + version: 3.2.0 + resolution: "yauzl@npm:3.2.0" + dependencies: + buffer-crc32: "npm:~0.2.3" + pend: "npm:~1.2.0" + checksum: 10c0/7b40b3dc46b95761a2a764391d257a11f494d365875af73a1b48fe16d4bd103dd178612e60168d12a0e59a8ba4f6411a15a5e8871d5a5f78255d6cc1ce39ee62 + languageName: node + linkType: hard + "yeoman-character@npm:^1.0.0": version: 1.1.0 resolution: "yeoman-character@npm:1.1.0"