diff --git a/package.json b/package.json index c6485bbd8..9044a5b82 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,8 @@ "@babel/parser": "^7.10.2", "@babel/traverse": "^7.10.1", "eleventy-plugin-sass": "^1.0.0", + "husky": "^4.2.5", + "lint-staged": "^10.2.11", "markdown-it": "^11.0.0", "markdown-it-anchor": "^5.3.0", "prettier": "^2.0.5" @@ -26,5 +28,13 @@ "dependencies": { "flow-bin": "^0.127.0", "nullthrows": "^1.1.1" + }, + "lint-staged": { + "*.{md,scss,json}": "prettier --write" + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } } } diff --git a/src/configuration/package-json.md b/src/configuration/package-json.md index 1e0585ea0..d69f7240b 100644 --- a/src/configuration/package-json.md +++ b/src/configuration/package-json.md @@ -132,18 +132,18 @@ Each of those targets contains the target's environment configuration (all of th
-| Option | Possible values | Description | -| -------------------- | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `context` | [see below](#context) | In which runtime the bundles should run. | -| `distDir` | `string` | Specify output folder (as opposed to output file) | -| `engines` | [`package.json#engines`](#engines-%2F-browserslist) | Higher priority than `package.json#engines` | -| `includeNodeModules` | [see below](#includenodemodules) | Whether to bundle all/none/some `node_module` dependencies | -| `isLibrary` | `boolean` | Library as in "npm library" | -| `minify` | `boolean` | Whether to enable minification (exact behaviour is determined by plugins).
Set by [`--no-minify`](/getting-started/cli/#parameters-specific-to-build) | -| `outputFormat` | `'global' | 'esmodule' | 'commonjs'` | Which type of imports/exports should be emitted | -| `publicUrl` | `string` | The public url of the bundle at runtime | -| `scopeHoist` | `boolean` | Whether to enable scope hoisting
Needs to be `true` for ESM and CommonJS `outputFormat`.
Set by [`--no-scope-hoist`](/getting-started/cli/#parameters-specific-to-build) | -| `sourceMap` | [see below](#sourcemap) | Enable/disable sourcemap and set options.
Overwritten by [`--no-source-maps`](/getting-started/cli/#general-parameters) | +| Option | Possible values | Description | +| -------------------- | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `context` | [see below](#context) | In which runtime the bundles should run. | +| `distDir` | `string` | Specify output folder (as opposed to output file) | +| `engines` | [`package.json#engines`](#engines-%2F-browserslist) | Higher priority than `package.json#engines` | +| `includeNodeModules` | [see below](#includenodemodules) | Whether to bundle all/none/some `node_module` dependencies | +| `isLibrary` | `boolean` | Library as in "npm library" | +| `minify` | `boolean` | Whether to enable minification (exact behaviour is determined by plugins).
Set by [`--no-minify`](/features/cli/#parameters-specific-to-build) | +| `outputFormat` | `'global' | 'esmodule' | 'commonjs'` | Which type of imports/exports should be emitted | +| `publicUrl` | `string` | The public url of the bundle at runtime | +| `scopeHoist` | `boolean` | Whether to enable scope hoisting
Needs to be `true` for ESM and CommonJS `outputFormat`.
Set by [`--no-scope-hoist`](/features/cli/#parameters-specific-to-build) | +| `sourceMap` | [see below](#sourcemap) | Enable/disable sourcemap and set options.
Overwritten by [`--no-source-maps`](/features/cli/#general-parameters) |
@@ -205,7 +205,7 @@ Can be a boolean (to simply enable / disable source maps) or an option (which is | inlineSources | `false` | Should the sourcemap contain the sources contents (otherwise, they will be loaded from `${sourceRoot}/$(name)`) | | sourceRoot | `path.relative(bundle, pojectRoot)` | Essentially the public url for the sources | -The [--no-source-maps](getting-started/cli/#general-paramaters) CLI parameter sets the default value to `false` (as opposed to `true`). +The [--no-source-maps](/features/cli/#general-parameters) CLI parameter sets the default value to `false` (as opposed to `true`). #### `engines` / `browserslist` diff --git a/src/features/node-emulation.md b/src/features/node-emulation.md index 22932df20..80ab0c3cf 100644 --- a/src/features/node-emulation.md +++ b/src/features/node-emulation.md @@ -31,7 +31,7 @@ Notably: ## 🕳️ Polyfilling & Excluding Builtin Node Modules -When (or more likely a dependency) importing packages such as `crypto`, `fs` or `process`, Parcel will either automatically use one of the listed polyfills and otherwise exclude that module. You can use [the `alises` field in your `package.json`](/getting-started/module-resolution/#aliases) +When (or more likely a dependency) importing packages such as `crypto`, `fs` or `process`, Parcel will either automatically use one of the listed polyfills and otherwise exclude that module. You can use [the `aliases` field in your `package.json`](/features/module-resolution/#aliases) | native module | npm replacement | native module | npm replacement | | ------------- | -------------------------- | -------------- | -------------------- | diff --git a/src/getting-started/webapp.md b/src/getting-started/webapp.md index d2569ab7b..38af87b1c 100644 --- a/src/getting-started/webapp.md +++ b/src/getting-started/webapp.md @@ -63,12 +63,3 @@ render(

Hello World

, document.getElementById("root")); {% endsamplefile %} {% endsample %} - -### Configuring Parcel - -When you do need to configure Parcel, it will be in one of 3 places. - -- If you need to configure the CLI, it will be a [CLI flag](cli/) -- If you need to configure your package, it will be in the [`package.json`](configuraiton/) -- If you need to configure something with your files or the Parcel asset - pipeline, it will be in [`.parcelrc`](plugin-config/) diff --git a/src/languages/postcss.md b/src/languages/postcss.md index d448535a2..7eb40bdb0 100644 --- a/src/languages/postcss.md +++ b/src/languages/postcss.md @@ -8,13 +8,13 @@ eleventyNavigation: To motivate some of the following tips, here's an overview over how Parcel processes CSS files (in that order): -- [@parcel/transformer-postcss](/official-plugins/transformer-postcss/): +- `@parcel/transformer-postcss`: Applies `.postcssrc` and might generate a CSS modules map -- [@parcel/transformer-css](/official-plugins/transformer-css/): +- `@parcel/transformer-css`: Registers `@import ...` and `url(...)` into Parcel's graph -- [@parcel/packager-css](/official-plugins/packager-css/): +- `@parcel/packager-css`: Concat all CSS assets into a single bundle. -- [@parcel/optimizer-cssnano](/official-plugins/optimizer-cssnano/): +- `@parcel/optimizer-cssnano`: Minify the bundle output from `@parcel/packager-css`. As you can see, each asset is processed individually by PostCSS and concatenated with the others afterwards. diff --git a/src/languages/typescript.md b/src/languages/typescript.md index dce2b8033..cbb1738ee 100644 --- a/src/languages/typescript.md +++ b/src/languages/typescript.md @@ -38,7 +38,7 @@ If you are using more advanced TypeScript features that include custom config se {% endsamplefile %} {% endsample %} -Because Parcel processes each file individually, it implicitly sets `isolatedModules: true` in the tsc options, this [comes with limitations as well](https://www.typescriptlang.org/tsconfig#isolatedModules), namely constant `const enum`s not being supported either. +Because Parcel processes each file individually, it implicitly sets `isolatedModules: true` in the tsc options, this comes with limitations as well, namely constant `const enum`s not being supported either. - No type checking - `const enum` isn't supported diff --git a/src/plugin-system/configuration.md b/src/plugin-system/configuration.md index 24420bba1..3762aec37 100644 --- a/src/plugin-system/configuration.md +++ b/src/plugin-system/configuration.md @@ -6,7 +6,7 @@ eleventyNavigation: summary: "Not really a plugin type: A reuseable '.parcelrc' package" --- -This is simply a [`.parcelrc`](/getting-started/plugin-config/) file wrapped into a published package, the `main` points to the config file. +This is simply a [`.parcelrc`](/configuration/plugin-configuration/) file wrapped into a published package, the `main` points to the config file. ```json { diff --git a/src/plugin-system/overview.md b/src/plugin-system/overview.md index 12a13d7af..48d638778 100644 --- a/src/plugin-system/overview.md +++ b/src/plugin-system/overview.md @@ -65,26 +65,26 @@ separate bundles. For example, if your `index.html` file links to an ### Complete List of Plugin Types (in a somewhat correct order) -- [Transformer](transformer): Converts an asset (into another asset)
+- [Transformer](/plugin-system/transformer): Converts an asset (into another asset)
_Example: convert Typescript to Javascript (per file)_ -- [Resolver](resolver): Turns dependency requests into absolute paths (or exclude them)
+- [Resolver](/plugin-system/resolver): Turns dependency requests into absolute paths (or exclude them)
_Example: add your own syntax for imports, e.g. `import "^/foo"`_ -- [Bundler](bundler): Turns an asset graph into a bundle graph
+- [Bundler](/plugin-system/bundler): Turns an asset graph into a bundle graph
_Example: create a bundler that does Vendoring (splitting app and node_modules code)_ -- [Namer](namer): Generates a filename (or filepath) for a bundle
+- [Namer](/plugin-system/namer): Generates a filename (or filepath) for a bundle
_Example: create a bundler that does Vendoring (splitting app and node_modules code)_ -- [Runtime](runtime): Programatically inserts (synthetic) assets into bundles"
+- [Runtime](/plugin-system/runtime): Programatically inserts (synthetic) assets into bundles"
_Example: add analytics to every bundle_ -- [Packager](packager): Turns a group of assets (bundle) into a bundle file"
+- [Packager](/plugin-system/packager): Turns a group of assets (bundle) into a bundle file"
_Example: concatenate all input CSS files into a CSS bundle_ -- [Optimizer](optimizer): Applies modifications to the finished bundle (similar to a transformer)
+- [Optimizer](/plugin-system/optimizer): Applies modifications to the finished bundle (similar to a transformer)
_Example: run a minifier or convert into a data-url for inline usage_

-- [Validator](validator): Analyzes assets and emit warnings and errors
+- [Validator](/plugin-system/validator): Analyzes assets and emit warnings and errors
_Example: do type-checking (Typescript, Flow)_ -- [Config](config): A reuseable '.parcelrc' package
+- [Config](/plugin-system/configuration): A reuseable '.parcelrc' package
_Example: provide a tailor-made parcel config for your boilerplate_
-- [Reporter](reporter): Listens to events of the build
+- [Reporter](/plugin-system/reporter): Listens to events of the build
_Example: generate a bundle report, run a dev server_