@ttoss/config 1.32.1 → 1.32.3

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @ttoss/config
2
2
 
3
- **@ttoss/config** is an opinionated configuration library for [monorepo](#monorepo) and [packages](#packages). It contains a set of [default configurations](./defaults) that you can use on your projects.
3
+ **@ttoss/config** is an opinionated configuration library for [monorepo](#monorepo) and [packages](#packages). It contains a set of default configurations that you can use on your projects.
4
4
 
5
5
  ## Install
6
6
 
package/dist/esm/index.js CHANGED
@@ -1,4 +1,11 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (target2, all) => {
4
+ for (var name in all) __defProp(target2, name, {
5
+ get: all[name],
6
+ enumerable: true
7
+ });
8
+ };
2
9
 
3
10
  // src/configCreator.ts
4
11
  import deepmerge from "deepmerge";
@@ -22,7 +29,15 @@ var defaultConfig = {
22
29
  }], "@babel/preset-typescript", ["@babel/preset-react", {
23
30
  runtime: "automatic"
24
31
  }]],
25
- plugins: [["formatjs", {
32
+ plugins: [
33
+ /**
34
+ * Carlin is full ESM and jest doesn't support import.meta.url from
35
+ * @ttoss/cloudformation. This plugin is needed to transform import.meta.url
36
+ *
37
+ * More reference about pure ESM packages:
38
+ * https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
39
+ */
40
+ "babel-plugin-transform-import-meta", ["formatjs", {
26
41
  idInterpolationPattern: "[sha512:contenthash:base64:6]",
27
42
  ast: true
28
43
  }]]
@@ -99,6 +114,13 @@ var defaultConfig6 = {
99
114
  };
100
115
  var syncpackConfig = configCreator(defaultConfig6);
101
116
 
117
+ // src/typescriptConfig.ts
118
+ var typescriptConfig_exports = {};
119
+ __export(typescriptConfig_exports, {
120
+ target: () => target
121
+ });
122
+ var target = "es2021";
123
+
102
124
  // src/tsup.ts
103
125
  import { transformAsync } from "@babel/core";
104
126
  var formatjsPlugin = {
@@ -143,7 +165,8 @@ var defaultConfig7 = {
143
165
  banner: {
144
166
  js: `/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */`
145
167
  },
146
- esbuildPlugins: [formatjsPlugin]
168
+ esbuildPlugins: [formatjsPlugin],
169
+ target
147
170
  };
148
171
  var tsupConfig = configCreator(defaultConfig7);
149
- export { babelConfig, commitlintConfig, jestConfig, lintstagedConfig, prettierConfig, syncpackConfig, tsupConfig };
172
+ export { babelConfig, commitlintConfig, jestConfig, lintstagedConfig, prettierConfig, syncpackConfig, tsupConfig, typescriptConfig_exports as typescriptConfig };
package/dist/index.d.mts CHANGED
@@ -22,8 +22,24 @@ declare const syncpackConfig: (config?: any, deepmergeConfig?: {
22
22
  arrayMerge: "append" | "overwrite";
23
23
  } | undefined) => any;
24
24
 
25
+ /**
26
+ * any on configCreator to avoid error "The inferred type of 'tsup' cannot
27
+ * be named without a reference to '.../node_modules/tsup'. This is likely not
28
+ * portable. A type annotation is necessary."
29
+ */
25
30
  declare const tsupConfig: (config?: any, deepmergeConfig?: {
26
31
  arrayMerge: "append" | "overwrite";
27
32
  } | undefined) => any;
28
33
 
29
- export { babelConfig, commitlintConfig, jestConfig, lintstagedConfig, prettierConfig, syncpackConfig, tsupConfig };
34
+ /**
35
+ * `target` to `es2021` because Node.js 20 supports ES2021 features.
36
+ * https://node.green/#ES2021
37
+ */
38
+ declare const target = "es2021";
39
+
40
+ declare const typescriptConfig_target: typeof target;
41
+ declare namespace typescriptConfig {
42
+ export { typescriptConfig_target as target };
43
+ }
44
+
45
+ export { babelConfig, commitlintConfig, jestConfig, lintstagedConfig, prettierConfig, syncpackConfig, tsupConfig, typescriptConfig };
package/dist/index.d.ts CHANGED
@@ -22,8 +22,24 @@ declare const syncpackConfig: (config?: any, deepmergeConfig?: {
22
22
  arrayMerge: "append" | "overwrite";
23
23
  } | undefined) => any;
24
24
 
25
+ /**
26
+ * any on configCreator to avoid error "The inferred type of 'tsup' cannot
27
+ * be named without a reference to '.../node_modules/tsup'. This is likely not
28
+ * portable. A type annotation is necessary."
29
+ */
25
30
  declare const tsupConfig: (config?: any, deepmergeConfig?: {
26
31
  arrayMerge: "append" | "overwrite";
27
32
  } | undefined) => any;
28
33
 
29
- export { babelConfig, commitlintConfig, jestConfig, lintstagedConfig, prettierConfig, syncpackConfig, tsupConfig };
34
+ /**
35
+ * `target` to `es2021` because Node.js 20 supports ES2021 features.
36
+ * https://node.green/#ES2021
37
+ */
38
+ declare const target = "es2021";
39
+
40
+ declare const typescriptConfig_target: typeof target;
41
+ declare namespace typescriptConfig {
42
+ export { typescriptConfig_target as target };
43
+ }
44
+
45
+ export { babelConfig, commitlintConfig, jestConfig, lintstagedConfig, prettierConfig, syncpackConfig, tsupConfig, typescriptConfig };
package/dist/index.js CHANGED
@@ -7,8 +7,8 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
7
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
8
  var __getProtoOf = Object.getPrototypeOf;
9
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __export = (target, all) => {
11
- for (var name in all) __defProp(target, name, {
10
+ var __export = (target2, all) => {
11
+ for (var name in all) __defProp(target2, name, {
12
12
  get: all[name],
13
13
  enumerable: true
14
14
  });
@@ -22,15 +22,15 @@ var __copyProps = (to, from, except, desc) => {
22
22
  }
23
23
  return to;
24
24
  };
25
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ var __toESM = (mod, isNodeMode, target2) => (target2 = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
26
  // If the importer is in node compatibility mode or this is not an ESM
27
27
  // file that has been converted to a CommonJS file using a Babel-
28
28
  // compatible transform (i.e. "__esModule" has not been set), then set
29
29
  // "default" to the CommonJS "module.exports" for node compatibility.
30
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target2, "default", {
31
31
  value: mod,
32
32
  enumerable: true
33
- }) : target, mod));
33
+ }) : target2, mod));
34
34
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
35
35
  value: true
36
36
  }), mod);
@@ -44,7 +44,8 @@ __export(src_exports, {
44
44
  lintstagedConfig: () => lintstagedConfig,
45
45
  prettierConfig: () => prettierConfig,
46
46
  syncpackConfig: () => syncpackConfig,
47
- tsupConfig: () => tsupConfig
47
+ tsupConfig: () => tsupConfig,
48
+ typescriptConfig: () => typescriptConfig_exports
48
49
  });
49
50
  module.exports = __toCommonJS(src_exports);
50
51
 
@@ -70,7 +71,15 @@ var defaultConfig = {
70
71
  }], "@babel/preset-typescript", ["@babel/preset-react", {
71
72
  runtime: "automatic"
72
73
  }]],
73
- plugins: [["formatjs", {
74
+ plugins: [
75
+ /**
76
+ * Carlin is full ESM and jest doesn't support import.meta.url from
77
+ * @ttoss/cloudformation. This plugin is needed to transform import.meta.url
78
+ *
79
+ * More reference about pure ESM packages:
80
+ * https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
81
+ */
82
+ "babel-plugin-transform-import-meta", ["formatjs", {
74
83
  idInterpolationPattern: "[sha512:contenthash:base64:6]",
75
84
  ast: true
76
85
  }]]
@@ -147,6 +156,13 @@ var defaultConfig6 = {
147
156
  };
148
157
  var syncpackConfig = configCreator(defaultConfig6);
149
158
 
159
+ // src/typescriptConfig.ts
160
+ var typescriptConfig_exports = {};
161
+ __export(typescriptConfig_exports, {
162
+ target: () => target
163
+ });
164
+ var target = "es2021";
165
+
150
166
  // src/tsup.ts
151
167
  var import_core = require("@babel/core");
152
168
  var formatjsPlugin = {
@@ -191,7 +207,8 @@ var defaultConfig7 = {
191
207
  banner: {
192
208
  js: `/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */`
193
209
  },
194
- esbuildPlugins: [formatjsPlugin]
210
+ esbuildPlugins: [formatjsPlugin],
211
+ target
195
212
  };
196
213
  var tsupConfig = configCreator(defaultConfig7);
197
214
  // Annotate the CommonJS export names for ESM import in node:
@@ -202,5 +219,6 @@ var tsupConfig = configCreator(defaultConfig7);
202
219
  lintstagedConfig,
203
220
  prettierConfig,
204
221
  syncpackConfig,
205
- tsupConfig
222
+ tsupConfig,
223
+ typescriptConfig
206
224
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/config",
3
- "version": "1.32.1",
3
+ "version": "1.32.3",
4
4
  "description": "Default configuration for packages.",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -19,6 +19,7 @@
19
19
  "tsconfig.json",
20
20
  "tsconfig.test.json"
21
21
  ],
22
+ "sideEffects": false,
22
23
  "typings": "dist/index.d.ts",
23
24
  "dependencies": {
24
25
  "@babel/core": "^7.23.9",
@@ -28,6 +29,7 @@
28
29
  "@commitlint/config-conventional": "^18.6.2",
29
30
  "@formatjs/ts-transformer": "^3.13.12",
30
31
  "babel-plugin-formatjs": "^10.5.13",
32
+ "babel-plugin-transform-import-meta": "^2.2.1",
31
33
  "deepmerge": "^4.3.1",
32
34
  "identity-obj-proxy": "^3.0.0",
33
35
  "prettier-package-json": "^2.8.0"
package/src/babel.ts CHANGED
@@ -8,6 +8,14 @@ export const defaultConfig: any = {
8
8
  ['@babel/preset-react', { runtime: 'automatic' }],
9
9
  ],
10
10
  plugins: [
11
+ /**
12
+ * Carlin is full ESM and jest doesn't support import.meta.url from
13
+ * @ttoss/cloudformation. This plugin is needed to transform import.meta.url
14
+ *
15
+ * More reference about pure ESM packages:
16
+ * https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
17
+ */
18
+ 'babel-plugin-transform-import-meta',
11
19
  [
12
20
  'formatjs',
13
21
  {
package/src/index.ts CHANGED
@@ -5,3 +5,4 @@ export { lintstagedConfig } from './lintstaged';
5
5
  export { prettierConfig } from './prettier';
6
6
  export { syncpackConfig } from './syncpack';
7
7
  export { tsupConfig } from './tsup';
8
+ export * as typescriptConfig from './typescriptConfig';
package/src/tsup.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as typescriptConfig from './typescriptConfig';
1
2
  import { Plugin, PluginBuild } from 'esbuild';
2
3
  import { configCreator } from './configCreator';
3
4
  import { transformAsync } from '@babel/core';
@@ -60,11 +61,13 @@ export const defaultConfig: Options = {
60
61
  js: `/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */`,
61
62
  },
62
63
  esbuildPlugins: [formatjsPlugin],
64
+ target: typescriptConfig.target,
63
65
  };
64
66
 
65
- export const tsupConfig = configCreator</**
67
+ /**
66
68
  * any on configCreator to avoid error "The inferred type of 'tsup' cannot
67
69
  * be named without a reference to '.../node_modules/tsup'. This is likely not
68
70
  * portable. A type annotation is necessary."
69
71
  */
70
- any>(defaultConfig);
72
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
73
+ export const tsupConfig = configCreator<any>(defaultConfig);
@@ -0,0 +1,5 @@
1
+ /**
2
+ * `target` to `es2021` because Node.js 20 supports ES2021 features.
3
+ * https://node.green/#ES2021
4
+ */
5
+ export const target = 'es2021';
package/tsconfig.json CHANGED
@@ -15,9 +15,12 @@
15
15
  * without a bundler, set `moduleResolution` to `NodeNext`.
16
16
  */
17
17
  "moduleResolution": "Bundler",
18
- "target": "ESNext",
19
18
  "module": "ESNext",
20
- "lib": ["DOM", "DOM.Iterable", "ESNext"],
19
+ /**
20
+ * `target` to `es2021` because Node.js 20 supports ES2021 features.
21
+ * https://node.green/#ES2021
22
+ */
23
+ "target": "es2021",
21
24
  "declaration": true,
22
25
  "sourceMap": true,
23
26
  "strict": true,