Skip to content

Commit

Permalink
Improve documentation and adapt for normalized options
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed May 27, 2020
1 parent de79e2e commit a7c244a
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions cli/help.md
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion docs/01-command-line-reference.md
Expand Up @@ -93,7 +93,8 @@ export default { // can be an array (for multiple inputs)
namespaceToStringTag,
noConflict,
preferConst,
strict
strict,
systemNullSetters
},

watch: {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/999-big-list-of-options.md
Expand Up @@ -1047,7 +1047,7 @@ Whether to include the 'use strict' pragma at the top of generated non-ES bundle

#### output.systemNullSetters
Type: `boolean`<br>
CLI: `--systemNullSetters`<br>
CLI: `--systemNullSetters`/`--no-systemNullSetters`<br>
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*.
Expand Down
1 change: 1 addition & 0 deletions src/rollup/types.d.ts
Expand Up @@ -609,6 +609,7 @@ export interface NormalizedOutputOptions {
sourcemapFile: string | undefined;
sourcemapPathTransform: ((sourcePath: string) => string) | undefined;
strict: boolean;
systemNullSetters: boolean;
}

export type WarningHandlerWithDefault = (
Expand Down
3 changes: 2 additions & 1 deletion src/utils/options/mergeOptions.ts
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/utils/options/normalizeOutputOptions.ts
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion test/hooks/index.js
Expand Up @@ -65,7 +65,8 @@ describe('hooks', () => {
preferConst: false,
sourcemap: false,
sourcemapExcludeSources: false,
strict: true
strict: true,
systemNullSetters: false
});
assert.strictEqual(options.banner(), 'new banner');
},
Expand Down

0 comments on commit a7c244a

Please sign in to comment.