-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VSC Extension JSON schema #9386
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
167 changes: 167 additions & 0 deletions
167
packages/utils/parcelforvscode/schemas/package-targets.schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
{ | ||
"title": "JSON schema for .parcelrc files", | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"type": "object", | ||
"$defs": { | ||
"engines": { | ||
"type": "object", | ||
"properties": { | ||
"browsers": { | ||
"oneOf": [ | ||
{ | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
{ | ||
"type": "string" | ||
} | ||
] | ||
} | ||
}, | ||
"additionalProperties": { | ||
"type": "string" | ||
} | ||
}, | ||
"target": { | ||
"type": "object", | ||
"properties": { | ||
"context": { | ||
"description": "The context property defines what type of environment to build for. This tells Parcel what environment-specific APIs are available, e.g. the DOM, Node filesystem APIs.", | ||
"type": "string", | ||
"enum": [ | ||
"node", | ||
"browser", | ||
"web-worker", | ||
"electron-main", | ||
"electron-renderer", | ||
"service-worker" | ||
] | ||
}, | ||
"includeNodeModules": { | ||
"description": "Determines whether to bundle node_modules or treat them as external. The default is true for browser targets, and false for library targets.", | ||
"oneOf": [ | ||
{ | ||
"type": "boolean" | ||
}, | ||
{ | ||
"type": "array", | ||
"items": { | ||
"type": "string", | ||
"description": "a wildcard or filepath" | ||
} | ||
}, | ||
{ | ||
"type": "object", | ||
"properties": {}, | ||
"additionalProperties": { | ||
"type": "boolean" | ||
} | ||
} | ||
] | ||
}, | ||
"outputFormat": { | ||
"description": "Defines what type of module to output.", | ||
"type": "string", | ||
"enum": ["global", "esmodule", "commonjs"] | ||
}, | ||
"distDir": { | ||
"description": "Sets the location where compiled bundles in this target will be written", | ||
"type": "string" | ||
}, | ||
"publicUrl": { | ||
"description": "Sets the base URL at which this bundle will be loaded at runtime", | ||
"type": "string" | ||
}, | ||
"isLibrary": { | ||
"description": "When set to true, the target is treated as a library that would be published to npm and consumed by another tool rather than used directly in a browser or other target environment.", | ||
"type": "boolean" | ||
}, | ||
"source": { | ||
"description": "Overrides the top-level `source` field in package.json for a target. This allows for each target to have different entries.", | ||
"oneOf": [ | ||
{ | ||
"type": "string" | ||
}, | ||
{ | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
] | ||
}, | ||
"sourceMap": { | ||
"description": "Enables or disables source maps, and sets source map options.", | ||
"oneOf": [ | ||
{ | ||
"type": "boolean" | ||
}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"inlineSources": { | ||
"type": "boolean" | ||
}, | ||
"sourceRoot": { | ||
"type": "string" | ||
}, | ||
"inline": { | ||
"type": "boolean" | ||
} | ||
}, | ||
"additionalProperties": false | ||
} | ||
] | ||
}, | ||
"engines": { | ||
"description": "Overrides the engines defined in the top-level `package.json#engines` and `browserslist` fields for this target.", | ||
"$ref": "#/$defs/engines" | ||
}, | ||
"optimize": { | ||
"description": "Enables or disables optimization (e.g. minification). Exact behavior is determined by plugins.", | ||
"type": "boolean" | ||
}, | ||
"scopeHoist": { | ||
"description": "Enables or disables scope hoisting.", | ||
"type": "boolean" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"commonTarget": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/$defs/target" | ||
}, | ||
{ | ||
"enum": [false] | ||
} | ||
] | ||
} | ||
}, | ||
"properties": { | ||
"targets": { | ||
"type": "object", | ||
"description": "Parcel can compile your source code in multiple different ways (targets) simultaneously.", | ||
"properties": { | ||
"main": { | ||
"$ref": "#/$defs/commonTarget" | ||
}, | ||
"module": { | ||
"$ref": "#/$defs/commonTarget" | ||
}, | ||
"browser": { | ||
"$ref": "#/$defs/commonTarget" | ||
}, | ||
"types": { | ||
"$ref": "#/$defs/commonTarget" | ||
} | ||
}, | ||
"additionalProperties": { | ||
"$ref": "#/$defs/target" | ||
} | ||
} | ||
} | ||
} |
94 changes: 94 additions & 0 deletions
94
packages/utils/parcelforvscode/schemas/parcelrc.schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
"title": "JSON schema for .parcelrc files", | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"type": "object", | ||
"allowTrailingCommas": true, | ||
"$defs": { | ||
"plugin": { | ||
"type": "string" | ||
}, | ||
"plugins": { | ||
"defaultSnippets": [ | ||
{ | ||
"body": ["$1", "..."] | ||
} | ||
], | ||
"type": "array", | ||
"uniqueItems": true, | ||
"items": { | ||
"$ref": "#/$defs/plugin" | ||
} | ||
}, | ||
"pluginGlobMap": { | ||
"type": "object", | ||
"properties": {}, | ||
"additionalProperties": { | ||
"$ref": "#/$defs/plugin" | ||
} | ||
}, | ||
"pluginsGlobMap": { | ||
"type": "object", | ||
"properties": {}, | ||
"additionalProperties": { | ||
"$ref": "#/$defs/plugins" | ||
} | ||
} | ||
}, | ||
"properties": { | ||
"extends": { | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/$defs/plugin" | ||
}, | ||
{ | ||
"$ref": "#/$defs/plugins" | ||
} | ||
], | ||
"default": "@parcel/extends-default" | ||
}, | ||
"bundler": { | ||
"description": "Transform the entire asset graph by grouping the assets into the output bundles.", | ||
"$ref": "#/$defs/plugin" | ||
}, | ||
"resolvers": { | ||
"description": "Resolve a dependency to a file path or virtual module.", | ||
"$ref": "#/$defs/plugins" | ||
}, | ||
"transformers": { | ||
"description": "Compile individual source files and extract dependencies.", | ||
"$ref": "#/$defs/pluginsGlobMap" | ||
}, | ||
"validators": { | ||
"description": "Validates individual assets and can throw errors or log warnings with diagnostics to validate the input.", | ||
"$ref": "#/$defs/pluginsGlobMap" | ||
}, | ||
"namers": { | ||
"description": "Determine the name of an output bundle.", | ||
"$ref": "#/$defs/plugins" | ||
}, | ||
"packagers": { | ||
"description": "Combine multiple assets together into a single output bundle.", | ||
"$ref": "#/$defs/pluginGlobMap" | ||
}, | ||
"optimizers": { | ||
"description": "Minify, optimize, and transform output bundles.", | ||
"$ref": "#/$defs/pluginsGlobMap" | ||
}, | ||
"compressors": { | ||
"description": "Compress and encode output bundles in multiple formats.", | ||
"$ref": "#/$defs/pluginsGlobMap" | ||
}, | ||
"reporters": { | ||
"description": "Receive events on build progress and completion.", | ||
"$ref": "#/$defs/plugins" | ||
}, | ||
"runtimes": { | ||
"description": "Return additional assets to be inserted into a bundle.", | ||
"$ref": "#/$defs/plugins" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"default": { | ||
"extends": "@parcel/config-default" | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of this JSON duplicates what https://github.com/parcel-bundler/parcel/blob/9d6da2c/packages/core/core/src/TargetDescriptor.schema.js does, but descriptions seem novel.
I think if you add descriptions into TargetDescriptor.schema.js, you can just generate this file. (my script for generating json from TargetDescriptor.schema.js https://github.com/lukaw3d/parcel-bundler-json-schemas/blob/main/main.js)