@ttoss/config 1.35.7 → 1.35.8

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/dist/esm/index.js CHANGED
@@ -215,8 +215,9 @@ var injectReactImport = /* @__PURE__ */__name(() => {
215
215
  let contents = outputFile.text;
216
216
  const usesReact = /React\./.test(contents);
217
217
  if (usesReact) {
218
- const hasBasicReactImport = /import\s+\*\s+as\s+React\s+from\s+['"]react['"]/.test(contents);
219
- if (!hasBasicReactImport) {
218
+ const hasStarReactImport = /import\s+\*\s+as\s+React\s+from\s+['"]react['"]/.test(contents);
219
+ const hasDefaultReactImport = /import\s+React\s+from\s+['"]react['"]/.test(contents) || /const\s+React\s+=\s+require\(['"]react['"]\)/.test(contents);
220
+ if (!hasStarReactImport && !hasDefaultReactImport) {
220
221
  const bannerMatch = contents.match(/^((?:\/\/[^\n]*\n|\/\*[^]*?\*\/)\s*)*/);
221
222
  const insertPosition = bannerMatch ? bannerMatch[0].length : 0;
222
223
  const isESM = /\bimport\b|\bexport\b/.test(contents);
package/dist/index.js CHANGED
@@ -259,8 +259,9 @@ var injectReactImport = /* @__PURE__ */__name(() => {
259
259
  let contents = outputFile.text;
260
260
  const usesReact = /React\./.test(contents);
261
261
  if (usesReact) {
262
- const hasBasicReactImport = /import\s+\*\s+as\s+React\s+from\s+['"]react['"]/.test(contents);
263
- if (!hasBasicReactImport) {
262
+ const hasStarReactImport = /import\s+\*\s+as\s+React\s+from\s+['"]react['"]/.test(contents);
263
+ const hasDefaultReactImport = /import\s+React\s+from\s+['"]react['"]/.test(contents) || /const\s+React\s+=\s+require\(['"]react['"]\)/.test(contents);
264
+ if (!hasStarReactImport && !hasDefaultReactImport) {
264
265
  const bannerMatch = contents.match(/^((?:\/\/[^\n]*\n|\/\*[^]*?\*\/)\s*)*/);
265
266
  const insertPosition = bannerMatch ? bannerMatch[0].length : 0;
266
267
  const isESM = /\bimport\b|\bexport\b/.test(contents);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/config",
3
- "version": "1.35.7",
3
+ "version": "1.35.8",
4
4
  "description": "Default configuration for packages.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",