@foxford/tsup-config 1.0.1 → 1.0.2

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.
Files changed (3) hide show
  1. package/index.cjs +25 -1
  2. package/index.mjs +25 -1
  3. package/package.json +2 -2
package/index.cjs CHANGED
@@ -19,6 +19,18 @@ var __spreadValues = (a, b) => {
19
19
  }
20
20
  return a;
21
21
  };
22
+ var __objRest = (source, exclude) => {
23
+ var target = {};
24
+ for (var prop in source)
25
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
26
+ target[prop] = source[prop];
27
+ if (source != null && __getOwnPropSymbols)
28
+ for (var prop of __getOwnPropSymbols(source)) {
29
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
30
+ target[prop] = source[prop];
31
+ }
32
+ return target;
33
+ };
22
34
  var __export = (target, all) => {
23
35
  for (var name in all)
24
36
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -197,6 +209,7 @@ function addExtensionsToRelativeImports(outDir = "build") {
197
209
  return patched;
198
210
  }
199
211
  function createTsupConfig({ entries, overrides = {} }) {
212
+ const _a = overrides, { esbuildOptions: overrideEsbuildOptions } = _a, rest = __objRest(_a, ["esbuildOptions"]);
200
213
  const extensions = (name) => ({
201
214
  import: `./${name}.js`,
202
215
  require: `./${name}.cjs`,
@@ -217,6 +230,17 @@ function createTsupConfig({ entries, overrides = {} }) {
217
230
  clean: true,
218
231
  dts: true,
219
232
  entry: toTsupEntry(entries),
233
+ // JSX собираем automatic-рантаймом. Базовый tsconfig монорепо держит
234
+ // "jsx": "preserve" (его ждут Vite/Next в приложениях), но для esbuild это
235
+ // означает откат к classic-трансформу: он печатает React.createElement и НЕ
236
+ // добавляет импорт React. Исходники импортируют только хуки, поэтому в
237
+ // артефакте оставался несвязанный React → ReferenceError при первом же рендере
238
+ // (см. @foxford/den-react@1.0.1). Automatic-рантайм сам подтягивает
239
+ // react/jsx-runtime и от области видимости не зависит.
240
+ esbuildOptions: (options, context) => {
241
+ options.jsx = "automatic";
242
+ overrideEsbuildOptions == null ? void 0 : overrideEsbuildOptions(options, context);
243
+ },
220
244
  format: ["cjs", "esm"],
221
245
  onSuccess: () => __async(null, null, function* () {
222
246
  copyReadme();
@@ -229,7 +253,7 @@ function createTsupConfig({ entries, overrides = {} }) {
229
253
  outDir: "build",
230
254
  sourcemap: false,
231
255
  splitting: false
232
- }, overrides);
256
+ }, rest);
233
257
  }
234
258
  // Annotate the CommonJS export names for ESM import in node:
235
259
  0 && (module.exports = {
package/index.mjs CHANGED
@@ -14,6 +14,18 @@ var __spreadValues = (a, b) => {
14
14
  }
15
15
  return a;
16
16
  };
17
+ var __objRest = (source, exclude) => {
18
+ var target = {};
19
+ for (var prop in source)
20
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
21
+ target[prop] = source[prop];
22
+ if (source != null && __getOwnPropSymbols)
23
+ for (var prop of __getOwnPropSymbols(source)) {
24
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
25
+ target[prop] = source[prop];
26
+ }
27
+ return target;
28
+ };
17
29
  var __async = (__this, __arguments, generator) => {
18
30
  return new Promise((resolve, reject) => {
19
31
  var fulfilled = (value) => {
@@ -157,6 +169,7 @@ function addExtensionsToRelativeImports(outDir = "build") {
157
169
  return patched;
158
170
  }
159
171
  function createTsupConfig({ entries, overrides = {} }) {
172
+ const _a = overrides, { esbuildOptions: overrideEsbuildOptions } = _a, rest = __objRest(_a, ["esbuildOptions"]);
160
173
  const extensions = (name) => ({
161
174
  import: `./${name}.js`,
162
175
  require: `./${name}.cjs`,
@@ -177,6 +190,17 @@ function createTsupConfig({ entries, overrides = {} }) {
177
190
  clean: true,
178
191
  dts: true,
179
192
  entry: toTsupEntry(entries),
193
+ // JSX собираем automatic-рантаймом. Базовый tsconfig монорепо держит
194
+ // "jsx": "preserve" (его ждут Vite/Next в приложениях), но для esbuild это
195
+ // означает откат к classic-трансформу: он печатает React.createElement и НЕ
196
+ // добавляет импорт React. Исходники импортируют только хуки, поэтому в
197
+ // артефакте оставался несвязанный React → ReferenceError при первом же рендере
198
+ // (см. @foxford/den-react@1.0.1). Automatic-рантайм сам подтягивает
199
+ // react/jsx-runtime и от области видимости не зависит.
200
+ esbuildOptions: (options, context) => {
201
+ options.jsx = "automatic";
202
+ overrideEsbuildOptions == null ? void 0 : overrideEsbuildOptions(options, context);
203
+ },
180
204
  format: ["cjs", "esm"],
181
205
  onSuccess: () => __async(null, null, function* () {
182
206
  copyReadme();
@@ -189,7 +213,7 @@ function createTsupConfig({ entries, overrides = {} }) {
189
213
  outDir: "build",
190
214
  sourcemap: false,
191
215
  splitting: false
192
- }, overrides);
216
+ }, rest);
193
217
  }
194
218
  export {
195
219
  addExtensionsToRelativeImports,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foxford/tsup-config",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Общая сборка публикуемых пакетов: декларация точек входа, tsup-конфиг, генерация публикуемого package.json",
5
5
  "keywords": [
6
6
  "foxford",
@@ -37,6 +37,6 @@
37
37
  "index.mjs",
38
38
  "package.json"
39
39
  ],
40
- "sha": "d0aa793",
40
+ "sha": "83d658b",
41
41
  "scripts": {}
42
42
  }