diff --git a/cli/help.md b/cli/help.md index 49cee04a0e8..8e56949ad76 100644 --- a/cli/help.md +++ b/cli/help.md @@ -54,6 +54,7 @@ Basic options: --no-stdin do not read "-" from stdin --no-strict Don't emit `"use strict";` in the generated modules --strictDeprecations Throw errors for deprecated features +--systemNullSetters Replace empty SystemJS setters with `null` --no-treeshake Disable tree-shaking optimisations --no-treeshake.annotations Ignore pure call annotations --no-treeshake.moduleSideEffects Assume modules have no side-effects diff --git a/docs/01-command-line-reference.md b/docs/01-command-line-reference.md index d0c8ee205fb..857cb753e82 100755 --- a/docs/01-command-line-reference.md +++ b/docs/01-command-line-reference.md @@ -93,7 +93,8 @@ export default { // can be an array (for multiple inputs) namespaceToStringTag, noConflict, preferConst, - strict + strict, + systemNullSetters }, watch: { @@ -310,6 +311,7 @@ Many options have command line equivalents. In those cases, any arguments passed --no-stdin do not read "-" from stdin --no-strict Don't emit `"use strict";` in the generated modules --strictDeprecations Throw errors for deprecated features +--systemNullSetters Replace empty SystemJS setters with `null` --no-treeshake Disable tree-shaking optimisations --no-treeshake.annotations Ignore pure call annotations --no-treeshake.moduleSideEffects Assume modules have no side-effects diff --git a/docs/999-big-list-of-options.md b/docs/999-big-list-of-options.md index 05d99762c3d..06cd42f2762 100755 --- a/docs/999-big-list-of-options.md +++ b/docs/999-big-list-of-options.md @@ -1047,7 +1047,7 @@ Whether to include the 'use strict' pragma at the top of generated non-ES bundle #### output.systemNullSetters Type: `boolean`
-CLI: `--systemNullSetters`
+CLI: `--systemNullSetters`/`--no-systemNullSetters`
Default: `false` When outputting the `system` module format, this will replace empty setter functions with `null` as an output simplification. This is *only supported in SystemJS 6.3.3 and above*. diff --git a/src/rollup/types.d.ts b/src/rollup/types.d.ts index 6431603f230..1cb03cde7a8 100644 --- a/src/rollup/types.d.ts +++ b/src/rollup/types.d.ts @@ -609,6 +609,7 @@ export interface NormalizedOutputOptions { sourcemapFile: string | undefined; sourcemapPathTransform: ((sourcePath: string) => string) | undefined; strict: boolean; + systemNullSetters: boolean; } export type WarningHandlerWithDefault = ( diff --git a/src/utils/options/mergeOptions.ts b/src/utils/options/mergeOptions.ts index d7d53ffee89..ed10df3f63f 100644 --- a/src/utils/options/mergeOptions.ts +++ b/src/utils/options/mergeOptions.ts @@ -217,7 +217,8 @@ function mergeOutputOptions( sourcemapExcludeSources: getOption('sourcemapExcludeSources'), sourcemapFile: getOption('sourcemapFile'), sourcemapPathTransform: getOption('sourcemapPathTransform'), - strict: getOption('strict') + strict: getOption('strict'), + systemNullSetters: getOption('systemNullSetters') }; warnUnknownOptions(config, Object.keys(outputOptions), 'output options', warn); diff --git a/src/utils/options/normalizeOutputOptions.ts b/src/utils/options/normalizeOutputOptions.ts index 26375b45352..9a955d0c7a2 100644 --- a/src/utils/options/normalizeOutputOptions.ts +++ b/src/utils/options/normalizeOutputOptions.ts @@ -59,7 +59,8 @@ export function normalizeOutputOptions( sourcemapPathTransform: config.sourcemapPathTransform as | ((sourcePath: string) => string) | undefined, - strict: (config.strict as boolean | undefined) ?? true + strict: (config.strict as boolean | undefined) ?? true, + systemNullSetters: (config.systemNullSetters as boolean | undefined) || false }; warnUnknownOptions(config, Object.keys(outputOptions), 'output options', inputOptions.onwarn); diff --git a/test/hooks/index.js b/test/hooks/index.js index b7df8ef8e40..beda0d0c368 100644 --- a/test/hooks/index.js +++ b/test/hooks/index.js @@ -65,7 +65,8 @@ describe('hooks', () => { preferConst: false, sourcemap: false, sourcemapExcludeSources: false, - strict: true + strict: true, + systemNullSetters: false }); assert.strictEqual(options.banner(), 'new banner'); },