From ee971e4704ac946c876c5192963f0d0c4ae9fd2e Mon Sep 17 00:00:00 2001 From: JoltCode Date: Tue, 21 Jan 2025 19:19:50 +0000 Subject: [PATCH] Use official swc schemainstead of repo schema (#4375) --- src/api/json/catalog.json | 2 +- src/schemas/json/swcrc.json | 688 --------------------------------- src/test/swcrc/swcrc-test.json | 41 -- 3 files changed, 1 insertion(+), 730 deletions(-) delete mode 100644 src/schemas/json/swcrc.json delete mode 100644 src/test/swcrc/swcrc-test.json diff --git a/src/api/json/catalog.json b/src/api/json/catalog.json index 20316eae912..2d70e6e074c 100644 --- a/src/api/json/catalog.json +++ b/src/api/json/catalog.json @@ -6072,7 +6072,7 @@ "name": "swcrc", "description": "swc configuration files", "fileMatch": [".swcrc"], - "url": "https://json.schemastore.org/swcrc.json" + "url": "https://swc.rs/schema.json" }, { "name": "OpenWeather Road Risk API", diff --git a/src/schemas/json/swcrc.json b/src/schemas/json/swcrc.json deleted file mode 100644 index a9fc64c4f8d..00000000000 --- a/src/schemas/json/swcrc.json +++ /dev/null @@ -1,688 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://json.schemastore.org/swcrc.json", - "anyOf": [ - { - "type": "array", - "items": { - "$ref": "#/definitions/entryPoint" - } - }, - { - "$ref": "#/definitions/entryPoint" - } - ], - "definitions": { - "fileMatcher": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "$ref": "#/definitions/fileMatcher" - } - } - ] - }, - "stringStringMap": { - "type": "object", - "patternProperties": { - "": { - "type": "string" - } - } - }, - "featureOrModule": { - "anyOf": [ - { - "type": "string", - "description": "CoreJS Module" - }, - { - "type": "string", - "description": "Feature", - "enum": [ - "transform-template-literals", - "transform-literals", - "transform-function-name", - "transform-arrow-functions", - "transform-block-scoped-functions", - "transform-classes", - "transform-object-super", - "transform-shorthand-properties", - "transform-duplicate-keys", - "transform-computed-properties", - "transform-for-of", - "transform-sticky-regex", - "transform-dotall-regex", - "transform-unicode-regex", - "transform-spread", - "transform-parameters", - "transform-destructuring", - "transform-block-scoping", - "transform-typeof-symbol", - "transform-new-target", - "transform-regenerator", - "transform-exponentiation-operator", - "transform-async-to-generator", - "proposal-async-generator-functions", - "proposal-object-rest-spread", - "proposal-unicode-property-regex", - "proposal-json-strings", - "proposal-optional-catch-binding", - "transform-named-capturing-groups-regex", - "transform-member-expression-literals", - "transform-property-literals", - "transform-reserved-words", - "proposal-nullish-coalescing-operator", - "proposal-optional-chaining", - "proposal-class-properties", - "proposal-numeric-separator", - "proposal-private-methods", - "transform-unicode-escapes" - ] - } - ] - }, - "envVersion": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - }, - "envVersions": { - "type": "object", - "propertyNames": { - "enum": [ - "chrome", - "ie", - "edge", - "firefox", - "safari", - "node", - "ios", - "samsung", - "opera", - "android", - "electron", - "phantom", - "operaMobile" - ] - }, - "patternProperties": { - "": { - "$ref": "#/definitions/envVersion" - } - } - }, - "envQuery": { - "description": "Query", - "oneOf": [ - { - "description": "single query", - "type": "string" - }, - { - "description": "multiple queries", - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "envQueryOrVersion": { - "description": "QueryOrVersion", - "oneOf": [ - { - "$ref": "#/definitions/envQuery" - }, - { - "$ref": "#/definitions/envVersion" - } - ] - }, - "entryPoint": { - "type": "object", - "description": "Defines an entry point", - "properties": { - "$schema": { - "type": "string" - }, - "env": { - "type": "object", - "properties": { - "mode": { - "type": "string", - "enum": ["usage", "entry"] - }, - "debug": { - "type": "boolean" - }, - "dynamicImport": { - "type": "boolean" - }, - "loose": { - "type": "boolean" - }, - "skip": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Skipped es-features. e.g.: 'core-js/modules/foo'" - }, - "include": { - "type": "array", - "items": { - "$ref": "#/definitions/featureOrModule" - } - }, - "exclude": { - "type": "array", - "items": { - "$ref": "#/definitions/featureOrModule" - } - }, - "coreJs": { - "type": "string" - }, - "targets": { - "oneOf": [ - { - "$ref": "#/definitions/envQuery" - }, - { - "description": "EsModules", - "type": "object", - "properties": { - "esmodules": { - "type": "boolean" - } - }, - "additionalProperties": false - }, - { - "$ref": "#/definitions/envVersions", - "description": "Versions" - }, - { - "description": "HashMap", - "type": "object", - "patternProperties": { - "": { - "$ref": "#/definitions/envQueryOrVersion" - } - } - } - ] - }, - "shippedProposals": { - "type": "boolean" - }, - "forceAllTransforms": { - "type": "boolean" - }, - "bugfixes": { - "type": "boolean" - } - }, - "additionalProperties": false - }, - "test": { - "$ref": "#/definitions/fileMatcher", - "description": "Matches the files to include" - }, - "exclude": { - "$ref": "#/definitions/fileMatcher", - "description": "Matches the files to exclude" - }, - "minify": { - "type": "boolean", - "description": "If true, swc will minify the output" - }, - "module": { - "type": "object", - "description": "Describes how swc will transpile the input", - "properties": { - "type": { - "type": "string", - "enum": ["commonjs", "amd", "umd", "es6"] - }, - "strict": { - "type": "boolean", - "description": "If true, the __esModule property won't be added to the export", - "default": false - }, - "strictMode": { - "type": "boolean", - "description": "If true, swc emits the 'use strict' directive", - "default": true - }, - "lazy": { - "anyOf": [ - { - "type": "boolean", - "description": "If true, lazy-initialize non local imports (not starting with ./)" - }, - { - "type": "array", - "items": { - "type": "string", - "description": "RegEx matching file(s)" - }, - "description": "Lazy-initialize all imports matching one of the given strings" - } - ], - "default": false - }, - "noInterop": { - "type": "boolean", - "description": "Disable the use of interopRequireDefault" - }, - "moduleId": { - "type": "string", - "description": "If emitting amd-modules and specified, swc emits a named amd module" - }, - "resolveFully": { - "type": "boolean", - "description": "Make resolver fully resolve index.js" - }, - "globals": { - "$ref": "#/definitions/stringStringMap" - } - }, - "required": ["type"], - "additionalProperties": false - }, - "jsc": { - "type": "object", - "description": "Main Jsc configuration", - "properties": { - "parser": { - "description": "Configures the parser", - "type": "object", - "oneOf": [ - { - "properties": { - "syntax": { - "enum": ["ecmascript"] - }, - "jsx": { - "type": "boolean", - "description": "If true, transform jsx" - }, - "numericSeparator": { - "type": "boolean", - "description": "Support numeric separator proposal (Stage 3)" - }, - "classPrivateProperty": { - "type": "boolean", - "description": "Support private class properties" - }, - "privateMethod": { - "type": "boolean", - "description": "Support private class methods" - }, - "classProperty": { - "type": "boolean", - "description": "Support class properties" - }, - "functionBind": { - "type": "boolean", - "description": "Support function bind expression" - }, - "decorators": { - "type": "boolean", - "description": "Enable decorators" - }, - "decoratorsBeforeExport": { - "type": "boolean" - }, - "exportDefaultFrom": { - "type": "boolean" - }, - "exportNamespaceFrom": { - "type": "boolean" - }, - "dynamicImport": { - "type": "boolean" - }, - "nullishCoalescing": { - "type": "boolean" - }, - "optionalChaining": { - "type": "boolean" - }, - "importMeta": { - "type": "boolean" - }, - "topLevelAwait": { - "type": "boolean" - }, - "importAssertions": { - "type": "boolean" - } - }, - "additionalProperties": false - }, - { - "properties": { - "syntax": { - "enum": ["typescript"] - }, - "tsx": { - "type": "boolean", - "description": "If true, transform tsx" - }, - "decorators": { - "type": "boolean", - "description": "If true, transform decorators" - }, - "dynamicImport": { - "type": "boolean" - }, - "dts": { - "type": "boolean", - "description": "[DISABLED] If true, emit .d.ts files. This flag is currently skipped by serde." - }, - "noEarlyErrors": { - "type": "boolean", - "description": "[DISABLED] This flag is currently skipped by serde." - }, - "importAssertions": { - "type": "boolean" - } - }, - "additionalProperties": false - } - ] - }, - "transform": { - "type": "object", - "properties": { - "react": { - "type": "object", - "properties": { - "development": { - "type": "boolean" - }, - "importSource": { - "type": "string", - "default": "react" - }, - "pragma": { - "type": "string", - "default": "React.createElement" - }, - "pragmaFrag": { - "type": "string", - "default": "React.Fragment" - }, - "refresh": { - "type": "boolean", - "default": false - }, - "runtime": { - "type": "string", - "enum": ["automatic", "classic"], - "default": "classic" - }, - "throwIfNamespace": { - "type": "boolean", - "default": true - }, - "useBuiltins": { - "type": "boolean" - } - }, - "additionalProperties": false - }, - "constModules": { - "type": "object", - "properties": { - "globals": { - "type": "object", - "patternProperties": { - "": { - "$ref": "#/definitions/stringStringMap" - } - } - } - }, - "additionalProperties": false - }, - "optimizer": { - "type": "object", - "properties": { - "globals": { - "type": "object", - "properties": { - "vars": { - "$ref": "#/definitions/stringStringMap" - }, - "envs": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "additionalProperties": false - }, - "jsonify": { - "type": "object", - "properties": { - "minCost": { - "type": "number" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - "legacyDecorator": { - "type": "boolean" - }, - "decoratorMetadata": { - "type": "boolean", - "description": "If true, decorator metadata is emitted. Make sure \"Reflect\" is present." - }, - "useDefineForClassFields": { - "$comment": "Requires swc@1.3.40", - "type": "boolean", - "description": "If false, the old behaviour is used and _defineProperty is not generated for class properties.\nhttps://swc.rs/docs/configuration/compilation#jsctransformusedefineforclassfields" - }, - "hidden": { - "type": "object", - "properties": { - "jest": { - "type": "boolean" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - "externalHelpers": { - "type": "boolean", - "description": "If true, this option will reduce the filesize by importing from an external module" - }, - "preserveAllComments": { - "type": "boolean", - "description": "If true, all comments will be preserved during compilation" - }, - "target": { - "type": "string", - "description": "Specifies the target environment", - "enum": [ - "es3", - "es5", - "es2015", - "es2016", - "es2017", - "es2018", - "es2019", - "es2020", - "es2021", - "es2022", - "esnext" - ] - }, - "loose": { - "type": "boolean", - "description": "If true, swc generates more efficient code" - }, - "keepClassNames": { - "$comment": "Requires swc@1.2.50 and target es2016 or higher", - "type": "boolean", - "description": "Preserve original class names\nhttps://swc.rs/docs/configuration/compilation#jsckeepclassnames" - }, - "paths": { - "$comment": "Requires swc@1.2.62 and jsc.baseUrl", - "type": "object", - "description": "Should reflect \"paths\" property in project's tsconfig.json . See https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping" - }, - "baseUrl": { - "$comment": "Requires swc@1.2.62", - "type": "string", - "description": "Should reflect \"baseUrl\" property in project's tsconfig.json . See https://www.typescriptlang.org/docs/handbook/module-resolution.html#base-url" - }, - "minify": { - "$comment": "Requires swc@1.2.67", - "title": "minification options", - "type": "object", - "description": "Minification options\nhttps://swc.rs/docs/configuration/minification" - }, - "experimental": { - "title": "experimental options", - "type": "object", - "description": "Experimental options\nhttps://swc.rs/docs/configuration/compilation#jscexperimental", - "minProperties": 1, - "properties": { - "keepImportAssertions": { - "type": "boolean", - "description": "Preserve import assertions if true. This is experimental because import assertions are not covered by ecmascript specifications yet." - }, - "plugins": { - "type": "array", - "description": "A list of plugins to load", - "minItems": 1, - "items": { - "type": "array", - "description": "A tuple with a plugin name and its options", - "minItems": 2, - "maxItems": 2, - "items": [ - { - "type": "string", - "description": "Plugin name", - "minLength": 1 - }, - { - "type": "object", - "description": "Plugin options", - "additionalProperties": true - } - ] - } - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - "skipHelperInjection": { - "type": "boolean" - }, - "disableHygiene": { - "type": "boolean" - }, - "disableFixer": { - "type": "boolean" - }, - "cwd": { - "type": "string" - }, - "filename": { - "type": "string" - }, - "root": { - "type": "string" - }, - "swcrc": { - "type": "boolean" - }, - "envName": { - "type": "string" - }, - "sourceFileName": { - "type": "string" - }, - "sourceRoot": { - "type": "string" - }, - "isModule": { - "type": "boolean" - }, - "globalMark": { - "type": "number" - }, - "callerOptions": { - "type": "object", - "properties": { - "name": { - "type": "string" - } - }, - "additionalProperties": false - }, - "configFile": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "boolean" - } - ] - }, - "rootMode": { - "enum": ["root", "upward", "upward-optional"] - }, - "inputSourceMap": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "boolean" - } - ] - }, - "sourceMaps": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "boolean" - } - ] - } - }, - "additionalProperties": false - } - }, - "description": "Schema for the swc configuration file", - "title": "swc configuration schema" -} diff --git a/src/test/swcrc/swcrc-test.json b/src/test/swcrc/swcrc-test.json deleted file mode 100644 index 65ea5648c52..00000000000 --- a/src/test/swcrc/swcrc-test.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "env": { - "coreJs": "3.22", - "include": ["proposal-json-strings", "module"] - }, - "exclude": ["a"], - "jsc": { - "experimental": { - "keepImportAssertions": true, - "plugins": [ - [ - "swc-plugin-coverage-instrument", - { - "option": true - } - ] - ] - }, - "externalHelpers": false, - "loose": false, - "parser": { - "syntax": "typescript" - }, - "target": "esnext", - "transform": { - "react": { - "development": false, - "refresh": false, - "runtime": "automatic", - "useBuiltins": false - }, - "useDefineForClassFields": false - } - }, - "minify": false, - "module": { - "resolveFully": true, - "type": "commonjs" - }, - "test": "a" -}