just-task 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,22 @@
2
2
  "name": "just-task",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 12 Sep 2023 08:01:58 GMT",
5
+ "date": "Sat, 02 Mar 2024 02:16:28 GMT",
6
+ "version": "1.9.0",
7
+ "tag": "just-task_v1.9.0",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "author": "elcraig@microsoft.com",
12
+ "package": "just-task",
13
+ "commit": "f5c5378f4b41dbb07bc5b6889e284277a0bfe5ce",
14
+ "comment": "Add an option --esm to support imports of ESM packages"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Tue, 12 Sep 2023 08:02:05 GMT",
6
21
  "version": "1.8.0",
7
22
  "tag": "just-task_v1.8.0",
8
23
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # Change Log - just-task
2
2
 
3
- This log was last generated on Tue, 12 Sep 2023 08:01:58 GMT and should not be manually modified.
3
+ This log was last generated on Sat, 02 Mar 2024 02:16:28 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.9.0
8
+
9
+ Sat, 02 Mar 2024 02:16:28 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - Add an option --esm to support imports of ESM packages (elcraig@microsoft.com)
14
+
7
15
  ## 1.8.0
8
16
 
9
- Tue, 12 Sep 2023 08:01:58 GMT
17
+ Tue, 12 Sep 2023 08:02:05 GMT
10
18
 
11
19
  ### Minor changes
12
20
 
package/lib/cli.js CHANGED
@@ -36,6 +36,9 @@ option_1.option('config', {
36
36
  option_1.option('defaultConfig', {
37
37
  describe: 'path to a default just configuration file that will be used when the current project does not have a just configuration file. (includes the file name, e.g. /path/to/just.config.ts)',
38
38
  });
39
+ option_1.option('esm', {
40
+ describe: 'Configure ts-node to support imports of ESM package (changes TS module/moduleResolution settings to Node16)',
41
+ });
39
42
  const registry = undertaker_1.undertaker.registry();
40
43
  const configModule = config_1.readConfig();
41
44
  // Support named task function as exports of a config module
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAOA,OAAO,WAAW,GAAG,QAAQ,cAAc,CAAC,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,SAAS,GAAG,MAAM,GAAG,IAAI,CAS5E;AAED,wBAAgB,UAAU,IAAI;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAA;CAAE,GAAG,IAAI,CAkCnE"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAOA,OAAO,WAAW,GAAG,QAAQ,cAAc,CAAC,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,SAAS,GAAG,MAAM,GAAG,IAAI,CAS5E;AAED,wBAAgB,UAAU,IAAI;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAA;CAAE,GAAG,IAAI,CAmCnE"}
package/lib/config.js CHANGED
@@ -19,12 +19,13 @@ function resolveConfigFile(args) {
19
19
  exports.resolveConfigFile = resolveConfigFile;
20
20
  function readConfig() {
21
21
  // uses a separate instance of yargs to first parse the config (without the --help in the way) so we can parse the configFile first regardless
22
- const configFile = resolveConfigFile(option_1.argv());
22
+ const args = option_1.argv();
23
+ const configFile = resolveConfigFile(args);
23
24
  if (configFile && fs.existsSync(configFile)) {
24
25
  const ext = path.extname(configFile);
25
26
  if (ext === '.ts' || ext === '.tsx') {
26
27
  // TODO: add option to do typechecking as well
27
- enableTypeScript_1.enableTypeScript({ transpileOnly: true });
28
+ enableTypeScript_1.enableTypeScript({ transpileOnly: true, esm: args.esm });
28
29
  }
29
30
  try {
30
31
  const configModule = require(configFile);
@@ -1,4 +1,5 @@
1
- export declare function enableTypeScript({ transpileOnly }: {
1
+ export declare function enableTypeScript({ transpileOnly, esm }: {
2
2
  transpileOnly?: boolean | undefined;
3
+ esm?: boolean | undefined;
3
4
  }): void;
4
5
  //# sourceMappingURL=enableTypeScript.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"enableTypeScript.d.ts","sourceRoot":"","sources":["../src/enableTypeScript.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAAC,EAAE,aAAoB,EAAE;;CAAA,GAAG,IAAI,CA8B/D"}
1
+ {"version":3,"file":"enableTypeScript.d.ts","sourceRoot":"","sources":["../src/enableTypeScript.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAAC,EAAE,aAAoB,EAAE,GAAW,EAAE;;;CAAA,GAAG,IAAI,CA8B5E"}
@@ -4,7 +4,7 @@ exports.enableTypeScript = void 0;
4
4
  const resolve_1 = require("./resolve");
5
5
  const just_task_logger_1 = require("just-task-logger");
6
6
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
7
- function enableTypeScript({ transpileOnly = true }) {
7
+ function enableTypeScript({ transpileOnly = true, esm = false }) {
8
8
  const tsNodeModule = resolve_1.resolve('ts-node');
9
9
  if (tsNodeModule) {
10
10
  const tsNode = require(tsNodeModule);
@@ -13,11 +13,11 @@ function enableTypeScript({ transpileOnly = true }) {
13
13
  skipProject: true,
14
14
  compilerOptions: {
15
15
  target: 'es2017',
16
- module: 'commonjs',
16
+ module: esm ? 'node16' : 'commonjs',
17
17
  strict: false,
18
18
  skipLibCheck: true,
19
19
  skipDefaultLibCheck: true,
20
- moduleResolution: 'node',
20
+ moduleResolution: esm ? 'node16' : 'node',
21
21
  allowJs: true,
22
22
  esModuleInterop: true,
23
23
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "just-task",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Build task definition library",
5
5
  "keywords": [],
6
6
  "repository": {
package/src/cli.ts CHANGED
@@ -47,6 +47,10 @@ option('defaultConfig', {
47
47
  describe:
48
48
  'path to a default just configuration file that will be used when the current project does not have a just configuration file. (includes the file name, e.g. /path/to/just.config.ts)',
49
49
  });
50
+ option('esm', {
51
+ describe:
52
+ 'Configure ts-node to support imports of ESM package (changes TS module/moduleResolution settings to Node16)',
53
+ });
50
54
 
51
55
  const registry = undertaker.registry();
52
56
 
package/src/config.ts CHANGED
@@ -21,13 +21,14 @@ export function resolveConfigFile(args: yargsParser.Arguments): string | null {
21
21
 
22
22
  export function readConfig(): { [key: string]: TaskFunction } | void {
23
23
  // uses a separate instance of yargs to first parse the config (without the --help in the way) so we can parse the configFile first regardless
24
- const configFile = resolveConfigFile(argv());
24
+ const args = argv();
25
+ const configFile = resolveConfigFile(args);
25
26
 
26
27
  if (configFile && fs.existsSync(configFile)) {
27
28
  const ext = path.extname(configFile);
28
29
  if (ext === '.ts' || ext === '.tsx') {
29
30
  // TODO: add option to do typechecking as well
30
- enableTypeScript({ transpileOnly: true });
31
+ enableTypeScript({ transpileOnly: true, esm: args.esm });
31
32
  }
32
33
 
33
34
  try {
@@ -2,7 +2,7 @@ import { resolve } from './resolve';
2
2
  import { logger } from 'just-task-logger';
3
3
 
4
4
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
5
- export function enableTypeScript({ transpileOnly = true }): void {
5
+ export function enableTypeScript({ transpileOnly = true, esm = false }): void {
6
6
  const tsNodeModule = resolve('ts-node');
7
7
  if (tsNodeModule) {
8
8
  const tsNode = require(tsNodeModule);
@@ -11,11 +11,11 @@ export function enableTypeScript({ transpileOnly = true }): void {
11
11
  skipProject: true,
12
12
  compilerOptions: {
13
13
  target: 'es2017',
14
- module: 'commonjs',
14
+ module: esm ? 'node16' : 'commonjs',
15
15
  strict: false,
16
16
  skipLibCheck: true,
17
17
  skipDefaultLibCheck: true,
18
- moduleResolution: 'node',
18
+ moduleResolution: esm ? 'node16' : 'node',
19
19
  allowJs: true,
20
20
  esModuleInterop: true,
21
21
  },