@openuiai/next 16.2.0 → 16.3.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.
Files changed (221) hide show
  1. package/dist/bin/next +2 -2
  2. package/dist/build/get-babel-loader-config.js +1 -1
  3. package/dist/build/get-babel-loader-config.js.map +1 -1
  4. package/dist/build/index.js +3 -3
  5. package/dist/build/webpack-config.js +6 -4
  6. package/dist/build/webpack-config.js.map +1 -1
  7. package/dist/cache/cache-control.js +22 -0
  8. package/dist/cache/cache-control.js.map +1 -0
  9. package/dist/cache/clone-response.js +77 -0
  10. package/dist/cache/clone-response.js.map +1 -0
  11. package/dist/cache/dedupe-fetch.js +123 -0
  12. package/dist/cache/dedupe-fetch.js.map +1 -0
  13. package/dist/cache/lazy-result.js +46 -0
  14. package/dist/cache/lazy-result.js.map +1 -0
  15. package/dist/cache/lru-cache.js +177 -0
  16. package/dist/cache/lru-cache.js.map +1 -0
  17. package/dist/client/app-bootstrap.js +1 -1
  18. package/dist/client/index.js +1 -1
  19. package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
  20. package/dist/concurrency/batcher.js +65 -0
  21. package/dist/concurrency/batcher.js.map +1 -0
  22. package/dist/concurrency/coalesced-function.js +39 -0
  23. package/dist/concurrency/coalesced-function.js.map +1 -0
  24. package/dist/concurrency/scheduler.js +64 -0
  25. package/dist/concurrency/scheduler.js.map +1 -0
  26. package/dist/concurrency/wait.js +19 -0
  27. package/dist/concurrency/wait.js.map +1 -0
  28. package/dist/concurrency/with-promise-cache.js +24 -0
  29. package/dist/concurrency/with-promise-cache.js.map +1 -0
  30. package/dist/config/detect-typo.js +51 -0
  31. package/dist/config/detect-typo.js.map +1 -0
  32. package/dist/config/find-config.js +102 -0
  33. package/dist/config/find-config.js.map +1 -0
  34. package/dist/config/get-package-version.js +118 -0
  35. package/dist/config/get-package-version.js.map +1 -0
  36. package/dist/config/get-project-dir.js +51 -0
  37. package/dist/config/get-project-dir.js.map +1 -0
  38. package/dist/config/install-dependencies.js +40 -0
  39. package/dist/config/install-dependencies.js.map +1 -0
  40. package/dist/config/needs-experimental-react.js +16 -0
  41. package/dist/config/needs-experimental-react.js.map +1 -0
  42. package/dist/config/static-env.js +92 -0
  43. package/dist/config/static-env.js.map +1 -0
  44. package/dist/constants/constants.js +397 -0
  45. package/dist/constants/constants.js.map +1 -0
  46. package/dist/errors/compile-error.js +14 -0
  47. package/dist/errors/compile-error.js.map +1 -0
  48. package/dist/errors/error-source.js +36 -0
  49. package/dist/errors/error-source.js.map +1 -0
  50. package/dist/errors/error-telemetry-utils.js +42 -0
  51. package/dist/errors/error-telemetry-utils.js.map +1 -0
  52. package/dist/errors/fatal-error.js +14 -0
  53. package/dist/errors/fatal-error.js.map +1 -0
  54. package/dist/errors/format-server-error.js +74 -0
  55. package/dist/errors/format-server-error.js.map +1 -0
  56. package/dist/errors/invariant-error.js +18 -0
  57. package/dist/errors/invariant-error.js.map +1 -0
  58. package/dist/errors/is-error.js +65 -0
  59. package/dist/errors/is-error.js.map +1 -0
  60. package/dist/errors/no-fallback-error.js +18 -0
  61. package/dist/errors/no-fallback-error.js.map +1 -0
  62. package/dist/esm/build/get-babel-loader-config.js +1 -1
  63. package/dist/esm/build/get-babel-loader-config.js.map +1 -1
  64. package/dist/esm/build/index.js +3 -3
  65. package/dist/esm/build/webpack-config.js +6 -4
  66. package/dist/esm/build/webpack-config.js.map +1 -1
  67. package/dist/esm/client/app-bootstrap.js +1 -1
  68. package/dist/esm/client/index.js +1 -1
  69. package/dist/esm/lib/metadata/resolvers/resolve-url.js +1 -1
  70. package/dist/esm/lib/metadata/resolvers/resolve-url.js.map +1 -1
  71. package/dist/esm/lib/worker.js +1 -1
  72. package/dist/esm/lib/worker.js.map +1 -1
  73. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  74. package/dist/esm/server/lib/app-info-log.js +1 -1
  75. package/dist/esm/server/lib/start-server.js +1 -1
  76. package/dist/esm/server/websocket/setup.js +1 -1
  77. package/dist/esm/server/websocket/setup.js.map +1 -1
  78. package/dist/esm/server/websocket/types.js +1 -1
  79. package/dist/esm/server/websocket/types.js.map +1 -1
  80. package/dist/esm/shared/lib/errors/canary-only-config-error.js +1 -1
  81. package/dist/filesystem/file-exists.js +53 -0
  82. package/dist/filesystem/file-exists.js.map +1 -0
  83. package/dist/filesystem/find-pages-dir.js +65 -0
  84. package/dist/filesystem/find-pages-dir.js.map +1 -0
  85. package/dist/filesystem/find-root.js +118 -0
  86. package/dist/filesystem/find-root.js.map +1 -0
  87. package/dist/filesystem/get-files-in-dir.js +33 -0
  88. package/dist/filesystem/get-files-in-dir.js.map +1 -0
  89. package/dist/filesystem/multi-file-writer.js +75 -0
  90. package/dist/filesystem/multi-file-writer.js.map +1 -0
  91. package/dist/filesystem/realpath.js +20 -0
  92. package/dist/filesystem/realpath.js.map +1 -0
  93. package/dist/filesystem/recursive-copy.js +76 -0
  94. package/dist/filesystem/recursive-copy.js.map +1 -0
  95. package/dist/filesystem/recursive-delete.js +137 -0
  96. package/dist/filesystem/recursive-delete.js.map +1 -0
  97. package/dist/filesystem/recursive-readdir.js +124 -0
  98. package/dist/filesystem/recursive-readdir.js.map +1 -0
  99. package/dist/filesystem/rename.js +87 -0
  100. package/dist/filesystem/rename.js.map +1 -0
  101. package/dist/filesystem/write-atomic.js +28 -0
  102. package/dist/filesystem/write-atomic.js.map +1 -0
  103. package/dist/fonts/font-utils.js +43 -0
  104. package/dist/fonts/font-utils.js.map +1 -0
  105. package/dist/fonts/get-preloadable-fonts.js +39 -0
  106. package/dist/fonts/get-preloadable-fonts.js.map +1 -0
  107. package/dist/hash/bloom-filter.js +85 -0
  108. package/dist/hash/bloom-filter.js.map +1 -0
  109. package/dist/hash/etag.js +56 -0
  110. package/dist/hash/etag.js.map +1 -0
  111. package/dist/hash/fnv1a.js +56 -0
  112. package/dist/hash/fnv1a.js.map +1 -0
  113. package/dist/hash/hash.js +39 -0
  114. package/dist/hash/hash.js.map +1 -0
  115. package/dist/hostname/format-hostname.js +16 -0
  116. package/dist/hostname/format-hostname.js.map +1 -0
  117. package/dist/hostname/get-hostname.js +23 -0
  118. package/dist/hostname/get-hostname.js.map +1 -0
  119. package/dist/hostname/get-network-host.js +44 -0
  120. package/dist/hostname/get-network-host.js.map +1 -0
  121. package/dist/hostname/is-ipv6.js +41 -0
  122. package/dist/hostname/is-ipv6.js.map +1 -0
  123. package/dist/image/find-closest-quality.js +19 -0
  124. package/dist/image/find-closest-quality.js.map +1 -0
  125. package/dist/image/get-img-props.js +573 -0
  126. package/dist/image/get-img-props.js.map +1 -0
  127. package/dist/image/image-blur-svg.js +22 -0
  128. package/dist/image/image-blur-svg.js.map +1 -0
  129. package/dist/image/image-config-context.shared-runtime.js +19 -0
  130. package/dist/image/image-config-context.shared-runtime.js.map +1 -0
  131. package/dist/image/image-config.js +74 -0
  132. package/dist/image/image-config.js.map +1 -0
  133. package/dist/image/image-loader.js +91 -0
  134. package/dist/image/image-loader.js.map +1 -0
  135. package/dist/image/image-optimizer.js +1019 -0
  136. package/dist/image/image-optimizer.js.map +1 -0
  137. package/dist/image/match-local-pattern.js +46 -0
  138. package/dist/image/match-local-pattern.js.map +1 -0
  139. package/dist/image/match-remote-pattern.js +63 -0
  140. package/dist/image/match-remote-pattern.js.map +1 -0
  141. package/dist/image/mime-type.js +20 -0
  142. package/dist/image/mime-type.js.map +1 -0
  143. package/dist/lib/metadata/resolvers/resolve-url.js +1 -1
  144. package/dist/lib/metadata/resolvers/resolve-url.js.map +1 -1
  145. package/dist/lib/worker.js +1 -1
  146. package/dist/lib/worker.js.map +1 -1
  147. package/dist/memory/gc-observer.js +53 -0
  148. package/dist/memory/gc-observer.js.map +1 -0
  149. package/dist/memory/shutdown.js +29 -0
  150. package/dist/memory/shutdown.js.map +1 -0
  151. package/dist/memory/startup.js +47 -0
  152. package/dist/memory/startup.js.map +1 -0
  153. package/dist/memory/trace.js +109 -0
  154. package/dist/memory/trace.js.map +1 -0
  155. package/dist/module/client-and-server-references.js +54 -0
  156. package/dist/module/client-and-server-references.js.map +1 -0
  157. package/dist/module/format-dynamic-import-path.js +24 -0
  158. package/dist/module/format-dynamic-import-path.js.map +1 -0
  159. package/dist/module/interop-default.js +15 -0
  160. package/dist/module/interop-default.js.map +1 -0
  161. package/dist/module/resolve-from.js +79 -0
  162. package/dist/module/resolve-from.js.map +1 -0
  163. package/dist/module/semver-noop.js +18 -0
  164. package/dist/module/semver-noop.js.map +1 -0
  165. package/dist/object/deep-freeze.js +30 -0
  166. package/dist/object/deep-freeze.js.map +1 -0
  167. package/dist/object/deep-readonly.js +10 -0
  168. package/dist/object/deep-readonly.js.map +1 -0
  169. package/dist/object/is-plain-object.js +42 -0
  170. package/dist/object/is-plain-object.js.map +1 -0
  171. package/dist/object/non-nullable.js +15 -0
  172. package/dist/object/non-nullable.js.map +1 -0
  173. package/dist/object/pick.js +19 -0
  174. package/dist/object/pick.js.map +1 -0
  175. package/dist/process/setup-exception-listeners.js +11 -0
  176. package/dist/process/setup-exception-listeners.js.map +1 -0
  177. package/dist/promise/detached-promise.js +32 -0
  178. package/dist/promise/detached-promise.js.map +1 -0
  179. package/dist/promise/is-thenable.js +20 -0
  180. package/dist/promise/is-thenable.js.map +1 -0
  181. package/dist/promise/promise-with-resolvers.js +26 -0
  182. package/dist/promise/promise-with-resolvers.js.map +1 -0
  183. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  184. package/dist/server/lib/app-info-log.js +1 -1
  185. package/dist/server/lib/start-server.js +1 -1
  186. package/dist/server/websocket/setup.js +1 -1
  187. package/dist/server/websocket/setup.js.map +1 -1
  188. package/dist/server/websocket/types.js +1 -1
  189. package/dist/server/websocket/types.js.map +1 -1
  190. package/dist/shared/lib/errors/canary-only-config-error.js +1 -1
  191. package/dist/string/encode-uri-path.js +15 -0
  192. package/dist/string/encode-uri-path.js.map +1 -0
  193. package/dist/string/escape-regexp.js +22 -0
  194. package/dist/string/escape-regexp.js.map +1 -0
  195. package/dist/string/normalize-path.js +21 -0
  196. package/dist/string/normalize-path.js.map +1 -0
  197. package/dist/string/oxford-comma-list.js +15 -0
  198. package/dist/string/oxford-comma-list.js.map +1 -0
  199. package/dist/string/pretty-bytes.js +74 -0
  200. package/dist/string/pretty-bytes.js.map +1 -0
  201. package/dist/telemetry/anonymous-meta.js +1 -1
  202. package/dist/telemetry/events/session-stopped.js +2 -2
  203. package/dist/telemetry/events/version.js +2 -2
  204. package/dist/typescript/diagnosticFormatter.js +240 -0
  205. package/dist/typescript/diagnosticFormatter.js.map +1 -0
  206. package/dist/typescript/getTypeScriptConfiguration.js +73 -0
  207. package/dist/typescript/getTypeScriptConfiguration.js.map +1 -0
  208. package/dist/typescript/getTypeScriptIntent.js +52 -0
  209. package/dist/typescript/getTypeScriptIntent.js.map +1 -0
  210. package/dist/typescript/missingDependencyError.js +27 -0
  211. package/dist/typescript/missingDependencyError.js.map +1 -0
  212. package/dist/typescript/runTypeCheck.js +95 -0
  213. package/dist/typescript/runTypeCheck.js.map +1 -0
  214. package/dist/typescript/writeAppTypeDeclarations.js +65 -0
  215. package/dist/typescript/writeAppTypeDeclarations.js.map +1 -0
  216. package/dist/typescript/writeConfigurationDefaults.js +403 -0
  217. package/dist/typescript/writeConfigurationDefaults.js.map +1 -0
  218. package/dist/validation/is-serializable-props.js +106 -0
  219. package/dist/validation/is-serializable-props.js.map +1 -0
  220. package/index.d.ts +2 -2
  221. package/package.json +2 -1
@@ -0,0 +1,403 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ 0 && (module.exports = {
6
+ getRequiredConfiguration: null,
7
+ writeConfigurationDefaults: null
8
+ });
9
+ function _export(target, all) {
10
+ for(var name in all)Object.defineProperty(target, name, {
11
+ enumerable: true,
12
+ get: all[name]
13
+ });
14
+ }
15
+ _export(exports, {
16
+ getRequiredConfiguration: function() {
17
+ return getRequiredConfiguration;
18
+ },
19
+ writeConfigurationDefaults: function() {
20
+ return writeConfigurationDefaults;
21
+ }
22
+ });
23
+ const _fs = require("fs");
24
+ const _picocolors = require("../lib/picocolors");
25
+ const _commentjson = /*#__PURE__*/ _interop_require_wildcard(require("next/dist/compiled/comment-json"));
26
+ const _semver = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/semver"));
27
+ const _os = /*#__PURE__*/ _interop_require_default(require("os"));
28
+ const _log = /*#__PURE__*/ _interop_require_wildcard(require("../build/output/log"));
29
+ function _interop_require_default(obj) {
30
+ return obj && obj.__esModule ? obj : {
31
+ default: obj
32
+ };
33
+ }
34
+ function _getRequireWildcardCache(nodeInterop) {
35
+ if (typeof WeakMap !== "function") return null;
36
+ var cacheBabelInterop = new WeakMap();
37
+ var cacheNodeInterop = new WeakMap();
38
+ return (_getRequireWildcardCache = function(nodeInterop) {
39
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
40
+ })(nodeInterop);
41
+ }
42
+ function _interop_require_wildcard(obj, nodeInterop) {
43
+ if (!nodeInterop && obj && obj.__esModule) {
44
+ return obj;
45
+ }
46
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
47
+ return {
48
+ default: obj
49
+ };
50
+ }
51
+ var cache = _getRequireWildcardCache(nodeInterop);
52
+ if (cache && cache.has(obj)) {
53
+ return cache.get(obj);
54
+ }
55
+ var newObj = {
56
+ __proto__: null
57
+ };
58
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
59
+ for(var key in obj){
60
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
61
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
62
+ if (desc && (desc.get || desc.set)) {
63
+ Object.defineProperty(newObj, key, desc);
64
+ } else {
65
+ newObj[key] = obj[key];
66
+ }
67
+ }
68
+ }
69
+ newObj.default = obj;
70
+ if (cache) {
71
+ cache.set(obj, newObj);
72
+ }
73
+ return newObj;
74
+ }
75
+ function getDesiredCompilerOptions(typescriptVersion, userTsConfig) {
76
+ var _userTsConfig_compilerOptions_module, _userTsConfig_compilerOptions, _userTsConfig_compilerOptions1;
77
+ // ModuleKind
78
+ const moduleKindESNext = 'esnext';
79
+ const moduleKindES2020 = 'es2020';
80
+ const moduleKindPreserve = 'preserve';
81
+ const moduleKindNodeNext = 'nodenext';
82
+ const moduleKindNode16 = 'node16';
83
+ const moduleKindCommonJS = 'commonjs';
84
+ const moduleKindAMD = 'amd';
85
+ // ModuleResolutionKind
86
+ const moduleResolutionKindBundler = 'bundler';
87
+ const moduleResolutionKindNode10 = 'node10';
88
+ const moduleResolutionKindNode12 = 'node12';
89
+ const moduleResolutionKindNodeJs = 'node';
90
+ // Jsx
91
+ const jsxEmitReactJSX = 'react-jsx';
92
+ return {
93
+ target: {
94
+ suggested: 'ES2017',
95
+ reason: 'For top-level `await`. Note: Next.js only polyfills for the esmodules target.'
96
+ },
97
+ // These are suggested values and will be set when not present in the
98
+ // tsconfig.json
99
+ lib: {
100
+ suggested: [
101
+ 'dom',
102
+ 'dom.iterable',
103
+ 'esnext'
104
+ ]
105
+ },
106
+ allowJs: {
107
+ suggested: true
108
+ },
109
+ skipLibCheck: {
110
+ suggested: true
111
+ },
112
+ strict: {
113
+ suggested: false
114
+ },
115
+ noEmit: {
116
+ suggested: true
117
+ },
118
+ incremental: {
119
+ suggested: true
120
+ },
121
+ // These values are required and cannot be changed by the user
122
+ // Keep this in sync with the webpack config
123
+ // 'parsedValue' matches the output value from ts.parseJsonConfigFileContent()
124
+ module: {
125
+ parsedValue: moduleKindESNext,
126
+ // All of these values work:
127
+ parsedValues: [
128
+ _semver.default.gte(typescriptVersion, '5.4.0') && moduleKindPreserve,
129
+ moduleKindES2020,
130
+ moduleKindESNext,
131
+ moduleKindCommonJS,
132
+ moduleKindAMD,
133
+ moduleKindNodeNext,
134
+ moduleKindNode16
135
+ ],
136
+ value: 'esnext',
137
+ reason: 'for dynamic import() support'
138
+ },
139
+ // TODO: Semver check not needed once Next.js repo uses 5.4.
140
+ ..._semver.default.gte(typescriptVersion, '5.4.0') && (userTsConfig == null ? void 0 : (_userTsConfig_compilerOptions = userTsConfig.compilerOptions) == null ? void 0 : (_userTsConfig_compilerOptions_module = _userTsConfig_compilerOptions.module) == null ? void 0 : _userTsConfig_compilerOptions_module.toLowerCase()) === moduleKindPreserve ? {
141
+ } : {
142
+ esModuleInterop: {
143
+ value: true,
144
+ reason: 'requirement for SWC / babel'
145
+ },
146
+ moduleResolution: {
147
+ // In TypeScript 5.0, `NodeJs` has renamed to `Node10`
148
+ parsedValue: moduleResolutionKindBundler,
149
+ // All of these values work:
150
+ parsedValues: [
151
+ moduleResolutionKindNode10,
152
+ moduleResolutionKindNodeJs,
153
+ // only newer TypeScript versions have this field, it
154
+ // will be filtered for new versions of TypeScript
155
+ moduleResolutionKindNode12,
156
+ moduleKindNode16,
157
+ moduleKindNodeNext,
158
+ moduleResolutionKindBundler
159
+ ].filter((val)=>typeof val !== 'undefined'),
160
+ value: 'node',
161
+ reason: 'to match webpack resolution'
162
+ },
163
+ resolveJsonModule: {
164
+ value: true,
165
+ reason: 'to match webpack resolution'
166
+ }
167
+ },
168
+ ...(userTsConfig == null ? void 0 : (_userTsConfig_compilerOptions1 = userTsConfig.compilerOptions) == null ? void 0 : _userTsConfig_compilerOptions1.verbatimModuleSyntax) === true ? undefined : {
169
+ isolatedModules: {
170
+ value: true,
171
+ reason: 'requirement for SWC / Babel'
172
+ }
173
+ },
174
+ jsx: {
175
+ parsedValue: jsxEmitReactJSX,
176
+ value: 'react-jsx',
177
+ reason: 'next.js uses the React automatic runtime'
178
+ }
179
+ };
180
+ }
181
+ function getRequiredConfiguration(typescript) {
182
+ const res = {};
183
+ const typescriptVersion = typescript.version;
184
+ const desiredCompilerOptions = getDesiredCompilerOptions(typescriptVersion);
185
+ for (const optionKey of Object.keys(desiredCompilerOptions)){
186
+ const ev = desiredCompilerOptions[optionKey];
187
+ if (!('value' in ev)) {
188
+ continue;
189
+ }
190
+ const value = ev.parsedValue ?? ev.value;
191
+ // Convert string values back to TypeScript enum values
192
+ if (optionKey === 'module' && typeof value === 'string') {
193
+ const moduleMap = {
194
+ esnext: typescript.ModuleKind.ESNext,
195
+ es2020: typescript.ModuleKind.ES2020,
196
+ ...typescript.ModuleKind.Preserve !== undefined ? {
197
+ preserve: typescript.ModuleKind.Preserve
198
+ } : {},
199
+ nodenext: typescript.ModuleKind.NodeNext,
200
+ node16: typescript.ModuleKind.Node16,
201
+ commonjs: typescript.ModuleKind.CommonJS,
202
+ amd: typescript.ModuleKind.AMD
203
+ };
204
+ res[optionKey] = moduleMap[value.toLowerCase()] ?? value;
205
+ } else if (optionKey === 'moduleResolution' && typeof value === 'string') {
206
+ const moduleResolutionMap = {
207
+ bundler: typescript.ModuleResolutionKind.Bundler,
208
+ node10: typescript.ModuleResolutionKind.Node10,
209
+ node12: typescript.ModuleResolutionKind.Node12,
210
+ node: typescript.ModuleResolutionKind.NodeJs
211
+ };
212
+ res[optionKey] = moduleResolutionMap[value.toLowerCase()] ?? value;
213
+ } else if (optionKey === 'jsx' && typeof value === 'string') {
214
+ const jsxMap = {
215
+ 'react-jsx': typescript.JsxEmit.ReactJSX
216
+ };
217
+ res[optionKey] = jsxMap[value.toLowerCase()] ?? value;
218
+ } else {
219
+ res[optionKey] = value;
220
+ }
221
+ }
222
+ return res;
223
+ }
224
+ const localDevTestFilesExcludeAction = 'NEXT_PRIVATE_LOCAL_DEV_TEST_FILES_EXCLUDE';
225
+ async function writeConfigurationDefaults(typescriptVersion, tsConfigPath, isFirstTimeSetup, hasAppDir, distDir, hasPagesDir, isolatedDevBuild) {
226
+ var _userTsConfig_compilerOptions;
227
+ if (isFirstTimeSetup) {
228
+ (0, _fs.writeFileSync)(tsConfigPath, '{}' + _os.default.EOL);
229
+ }
230
+ const userTsConfigContent = (0, _fs.readFileSync)(tsConfigPath, {
231
+ encoding: 'utf8'
232
+ });
233
+ const userTsConfig = _commentjson.parse(userTsConfigContent);
234
+ // Bail automatic setup when the user has extended or referenced another config
235
+ if ('extends' in userTsConfig || 'references' in userTsConfig) {
236
+ return;
237
+ }
238
+ if ((userTsConfig == null ? void 0 : userTsConfig.compilerOptions) == null) {
239
+ userTsConfig.compilerOptions = {};
240
+ isFirstTimeSetup = true;
241
+ }
242
+ const desiredCompilerOptions = getDesiredCompilerOptions(typescriptVersion, userTsConfig);
243
+ const suggestedActions = [];
244
+ const requiredActions = [];
245
+ for(const optionKey in desiredCompilerOptions){
246
+ const check = desiredCompilerOptions[optionKey];
247
+ if ('suggested' in check) {
248
+ if (!(optionKey in (userTsConfig == null ? void 0 : userTsConfig.compilerOptions))) {
249
+ userTsConfig.compilerOptions[optionKey] = check.suggested;
250
+ suggestedActions.push((0, _picocolors.cyan)(optionKey) + ' was set to ' + (0, _picocolors.bold)(check.suggested) + (check.reason ? ` (${check.reason})` : ''));
251
+ }
252
+ } else if ('value' in check) {
253
+ var _userTsConfig_compilerOptions1;
254
+ let existingValue = userTsConfig == null ? void 0 : (_userTsConfig_compilerOptions1 = userTsConfig.compilerOptions) == null ? void 0 : _userTsConfig_compilerOptions1[optionKey];
255
+ if (typeof existingValue === 'string') {
256
+ existingValue = existingValue.toLowerCase();
257
+ }
258
+ const shouldWriteRequiredValue = ()=>{
259
+ // Check if the option has multiple allowed values
260
+ if (check.parsedValues) {
261
+ return !check.parsedValues.includes(existingValue);
262
+ }
263
+ // Check if the option has a single parsed value
264
+ if (check.parsedValue) {
265
+ return check.parsedValue !== existingValue;
266
+ }
267
+ // Fall back to direct value comparison
268
+ return check.value !== existingValue;
269
+ };
270
+ if (shouldWriteRequiredValue()) {
271
+ if (!userTsConfig.compilerOptions) {
272
+ userTsConfig.compilerOptions = {};
273
+ }
274
+ userTsConfig.compilerOptions[optionKey] = check.value;
275
+ requiredActions.push((0, _picocolors.cyan)(optionKey) + ' was set to ' + (0, _picocolors.bold)(check.value) + ` (${check.reason})`);
276
+ }
277
+ } else {
278
+ const _ = check;
279
+ }
280
+ }
281
+ const nextAppTypes = [
282
+ `${distDir}/types/**/*.ts`
283
+ ];
284
+ // When isolatedDevBuild is enabled, Next.js uses different distDir paths:
285
+ // - Development: "{distDir}/dev"
286
+ // - Production: "{distDir}"
287
+ // To prevent tsconfig updates when switching between dev/build modes,
288
+ // we proactively include both type paths regardless of current environment.
289
+ if (isolatedDevBuild !== false) {
290
+ nextAppTypes.push(process.env.NODE_ENV === 'development' ? // Here we remove "/dev" at the end of distDir for consistency.
291
+ `${distDir.replace(/\/dev$/, '')}/types/**/*.ts` : // Here we add "/dev" at the end of distDir for consistency.
292
+ `${distDir}/dev/types/**/*.ts`);
293
+ // Sort the array to ensure consistent order.
294
+ nextAppTypes.sort((a, b)=>a.length - b.length);
295
+ }
296
+ if (!('include' in userTsConfig)) {
297
+ userTsConfig.include = hasAppDir ? [
298
+ 'next-env.d.ts',
299
+ ...nextAppTypes,
300
+ '**/*.mts',
301
+ '**/*.ts',
302
+ '**/*.tsx'
303
+ ] : [
304
+ 'next-env.d.ts',
305
+ '**/*.mts',
306
+ '**/*.ts',
307
+ '**/*.tsx'
308
+ ];
309
+ suggestedActions.push((0, _picocolors.cyan)('include') + ' was set to ' + (0, _picocolors.bold)(hasAppDir ? `['next-env.d.ts', ${nextAppTypes.map((type)=>`'${type}'`).join(', ')}, '**/*.mts', '**/*.ts', '**/*.tsx']` : `['next-env.d.ts', '**/*.mts', '**/*.ts', '**/*.tsx']`));
310
+ } else if (hasAppDir) {
311
+ const missingFromResolved = [];
312
+ for (const type of nextAppTypes){
313
+ if (!userTsConfig.include.includes(type)) {
314
+ missingFromResolved.push(type);
315
+ }
316
+ }
317
+ if (missingFromResolved.length > 0) {
318
+ if (!Array.isArray(userTsConfig.include)) {
319
+ userTsConfig.include = [];
320
+ }
321
+ missingFromResolved.forEach((item)=>{
322
+ userTsConfig.include.push(item);
323
+ suggestedActions.push((0, _picocolors.cyan)('include') + ' was updated to add ' + (0, _picocolors.bold)(`'${item}'`));
324
+ });
325
+ }
326
+ }
327
+ // Enable the Next.js typescript plugin.
328
+ if (hasAppDir) {
329
+ var _userTsConfig_compilerOptions2;
330
+ // Check if the config or the resolved config has the plugin already.
331
+ const plugins = [
332
+ ...Array.isArray(userTsConfig == null ? void 0 : userTsConfig.plugins) ? userTsConfig.plugins : [],
333
+ ...userTsConfig.compilerOptions && Array.isArray(userTsConfig.compilerOptions.plugins) ? userTsConfig.compilerOptions.plugins : []
334
+ ];
335
+ const hasNextPlugin = plugins.some(({ name })=>name === 'next');
336
+ // If the TS config extends on another config, we can't add the `plugin` field
337
+ // because that will override the parent config's plugins.
338
+ // Instead we have to show a message to the user to add the plugin manually.
339
+ if (!userTsConfig.compilerOptions || plugins.length && !hasNextPlugin && 'extends' in userTsConfig && (!userTsConfig.compilerOptions || !userTsConfig.compilerOptions.plugins)) {
340
+ _log.info(`\nYour ${(0, _picocolors.bold)('tsconfig.json')} extends another configuration, which means we cannot add the Next.js TypeScript plugin automatically. To improve your development experience, we recommend adding the Next.js plugin (\`${(0, _picocolors.cyan)('"plugins": [{ "name": "next" }]')}\`) manually to your TypeScript configuration. Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#the-typescript-plugin\n`);
341
+ } else if (!hasNextPlugin) {
342
+ if (!('plugins' in userTsConfig.compilerOptions)) {
343
+ userTsConfig.compilerOptions.plugins = [];
344
+ }
345
+ userTsConfig.compilerOptions.plugins.push({
346
+ name: 'next'
347
+ });
348
+ suggestedActions.push((0, _picocolors.cyan)('plugins') + ' was updated to add ' + (0, _picocolors.bold)(`{ name: 'next' }`));
349
+ }
350
+ // If `strict` is set to `false` and `strictNullChecks` is set to `false`,
351
+ // then set `strictNullChecks` to `true`.
352
+ if (hasPagesDir && hasAppDir && !(userTsConfig == null ? void 0 : (_userTsConfig_compilerOptions2 = userTsConfig.compilerOptions) == null ? void 0 : _userTsConfig_compilerOptions2.strict) && !('strictNullChecks' in (userTsConfig == null ? void 0 : userTsConfig.compilerOptions))) {
353
+ userTsConfig.compilerOptions.strictNullChecks = true;
354
+ suggestedActions.push((0, _picocolors.cyan)('strictNullChecks') + ' was set to ' + (0, _picocolors.bold)(`true`));
355
+ }
356
+ }
357
+ if (!('exclude' in userTsConfig)) {
358
+ userTsConfig.exclude = [
359
+ 'node_modules'
360
+ ];
361
+ suggestedActions.push((0, _picocolors.cyan)('exclude') + ' was set to ' + (0, _picocolors.bold)(`['node_modules']`));
362
+ }
363
+ // During local development inside Next.js repo, exclude the test files coverage by the local tsconfig
364
+ if (process.env.NEXT_PRIVATE_LOCAL_DEV && userTsConfig.exclude) {
365
+ const tsGlob = '**/*.test.ts';
366
+ const tsxGlob = '**/*.test.tsx';
367
+ let hasUpdates = false;
368
+ if (!userTsConfig.exclude.includes(tsGlob)) {
369
+ userTsConfig.exclude.push(tsGlob);
370
+ hasUpdates = true;
371
+ }
372
+ if (!userTsConfig.exclude.includes(tsxGlob)) {
373
+ userTsConfig.exclude.push(tsxGlob);
374
+ hasUpdates = true;
375
+ }
376
+ if (hasUpdates) {
377
+ requiredActions.push(localDevTestFilesExcludeAction);
378
+ }
379
+ }
380
+ if (suggestedActions.length < 1 && requiredActions.length < 1) {
381
+ return;
382
+ }
383
+ (0, _fs.writeFileSync)(tsConfigPath, _commentjson.stringify(userTsConfig, null, 2) + _os.default.EOL);
384
+ _log.info('');
385
+ if (isFirstTimeSetup) {
386
+ _log.info(`We detected TypeScript in your project and created a ${(0, _picocolors.cyan)('tsconfig.json')} file for you.`);
387
+ return;
388
+ }
389
+ _log.info(`We detected TypeScript in your project and reconfigured your ${(0, _picocolors.cyan)('tsconfig.json')} file for you.${((_userTsConfig_compilerOptions = userTsConfig.compilerOptions) == null ? void 0 : _userTsConfig_compilerOptions.strict) ? '' : ` Strict-mode is set to ${(0, _picocolors.cyan)('false')} by default.`}`);
390
+ if (suggestedActions.length) {
391
+ _log.info(`The following suggested values were added to your ${(0, _picocolors.cyan)('tsconfig.json')}. These values ${(0, _picocolors.cyan)('can be changed')} to fit your project's needs:\n`);
392
+ suggestedActions.forEach((action)=>_log.info(`\t- ${action}`));
393
+ _log.info('');
394
+ }
395
+ const requiredActionsToBeLogged = process.env.NEXT_PRIVATE_LOCAL_DEV ? requiredActions.filter((action)=>action !== localDevTestFilesExcludeAction) : requiredActions;
396
+ if (requiredActionsToBeLogged.length) {
397
+ _log.info(`The following ${(0, _picocolors.white)('mandatory changes')} were made to your ${(0, _picocolors.cyan)('tsconfig.json')}:\n`);
398
+ requiredActionsToBeLogged.forEach((action)=>_log.info(`\t- ${action}`));
399
+ _log.info('');
400
+ }
401
+ }
402
+
403
+ //# sourceMappingURL=writeConfigurationDefaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../typescript/writeConfigurationDefaults.ts"],"sourcesContent":["import { readFileSync, writeFileSync } from 'fs'\nimport { bold, cyan, white } from '../lib/picocolors'\nimport * as CommentJson from 'next/dist/compiled/comment-json'\nimport semver from 'next/dist/compiled/semver'\nimport os from 'os'\nimport type { CompilerOptions } from 'typescript'\nimport * as Log from '../build/output/log'\n\ntype DesiredCompilerOptionsShape = {\n [K in keyof CompilerOptions]:\n | { suggested: any; reason?: string }\n | {\n parsedValue?: any\n parsedValues?: Array<any>\n value: any\n reason: string\n }\n}\n\nfunction getDesiredCompilerOptions(\n typescriptVersion: string,\n userTsConfig?: Record<string, any>\n): DesiredCompilerOptionsShape {\n // ModuleKind\n const moduleKindESNext = 'esnext'\n const moduleKindES2020 = 'es2020'\n const moduleKindPreserve = 'preserve'\n const moduleKindNodeNext = 'nodenext'\n const moduleKindNode16 = 'node16'\n const moduleKindCommonJS = 'commonjs'\n const moduleKindAMD = 'amd'\n\n // ModuleResolutionKind\n const moduleResolutionKindBundler = 'bundler'\n const moduleResolutionKindNode10 = 'node10'\n const moduleResolutionKindNode12 = 'node12'\n const moduleResolutionKindNodeJs = 'node'\n\n // Jsx\n const jsxEmitReactJSX = 'react-jsx'\n\n return {\n target: {\n suggested: 'ES2017',\n reason:\n 'For top-level `await`. Note: Next.js only polyfills for the esmodules target.',\n },\n // These are suggested values and will be set when not present in the\n // tsconfig.json\n lib: { suggested: ['dom', 'dom.iterable', 'esnext'] },\n allowJs: { suggested: true },\n skipLibCheck: { suggested: true },\n strict: { suggested: false },\n noEmit: { suggested: true },\n incremental: { suggested: true },\n\n // These values are required and cannot be changed by the user\n // Keep this in sync with the webpack config\n // 'parsedValue' matches the output value from ts.parseJsonConfigFileContent()\n module: {\n parsedValue: moduleKindESNext,\n // All of these values work:\n parsedValues: [\n semver.gte(typescriptVersion, '5.4.0') && moduleKindPreserve,\n moduleKindES2020,\n moduleKindESNext,\n moduleKindCommonJS,\n moduleKindAMD,\n moduleKindNodeNext,\n moduleKindNode16,\n ],\n value: 'esnext',\n reason: 'for dynamic import() support',\n },\n // TODO: Semver check not needed once Next.js repo uses 5.4.\n ...(semver.gte(typescriptVersion, '5.4.0') &&\n userTsConfig?.compilerOptions?.module?.toLowerCase() === moduleKindPreserve\n ? {\n // TypeScript 5.4 introduced `Preserve`. Using `Preserve` implies\n // - `moduleResolution` is `Bundler`\n // - `esModuleInterop` is `true`\n // - `resolveJsonModule` is `true`\n // This means that if the user is using Preserve, they don't need these options\n }\n : {\n esModuleInterop: {\n value: true,\n reason: 'requirement for SWC / babel',\n },\n moduleResolution: {\n // In TypeScript 5.0, `NodeJs` has renamed to `Node10`\n parsedValue: moduleResolutionKindBundler,\n // All of these values work:\n parsedValues: [\n moduleResolutionKindNode10,\n moduleResolutionKindNodeJs,\n // only newer TypeScript versions have this field, it\n // will be filtered for new versions of TypeScript\n moduleResolutionKindNode12,\n moduleKindNode16,\n moduleKindNodeNext,\n moduleResolutionKindBundler,\n ].filter((val) => typeof val !== 'undefined'),\n value: 'node',\n reason: 'to match webpack resolution',\n },\n resolveJsonModule: {\n value: true,\n reason: 'to match webpack resolution',\n },\n }),\n ...(userTsConfig?.compilerOptions?.verbatimModuleSyntax === true\n ? undefined\n : {\n isolatedModules: {\n value: true,\n reason: 'requirement for SWC / Babel',\n },\n }),\n jsx: {\n parsedValue: jsxEmitReactJSX,\n value: 'react-jsx',\n reason: 'next.js uses the React automatic runtime',\n },\n } satisfies DesiredCompilerOptionsShape\n}\n\nexport function getRequiredConfiguration(\n typescript: typeof import('typescript')\n): Partial<import('typescript').CompilerOptions> {\n const res: Partial<import('typescript').CompilerOptions> = {}\n const typescriptVersion = typescript.version\n\n const desiredCompilerOptions = getDesiredCompilerOptions(typescriptVersion)\n for (const optionKey of Object.keys(desiredCompilerOptions)) {\n const ev = desiredCompilerOptions[optionKey]\n if (!('value' in ev)) {\n continue\n }\n\n const value = ev.parsedValue ?? ev.value\n\n // Convert string values back to TypeScript enum values\n if (optionKey === 'module' && typeof value === 'string') {\n const moduleMap: Record<string, import('typescript').ModuleKind> = {\n esnext: typescript.ModuleKind.ESNext,\n es2020: typescript.ModuleKind.ES2020,\n ...(typescript.ModuleKind.Preserve !== undefined\n ? { preserve: typescript.ModuleKind.Preserve }\n : {}),\n nodenext: typescript.ModuleKind.NodeNext,\n node16: typescript.ModuleKind.Node16,\n commonjs: typescript.ModuleKind.CommonJS,\n amd: typescript.ModuleKind.AMD,\n }\n res[optionKey] = moduleMap[value.toLowerCase()] ?? value\n } else if (optionKey === 'moduleResolution' && typeof value === 'string') {\n const moduleResolutionMap: Record<\n string,\n import('typescript').ModuleResolutionKind\n > = {\n bundler: typescript.ModuleResolutionKind.Bundler,\n node10: typescript.ModuleResolutionKind.Node10,\n node12: (typescript.ModuleResolutionKind as any).Node12,\n node: typescript.ModuleResolutionKind.NodeJs,\n }\n res[optionKey] = moduleResolutionMap[value.toLowerCase()] ?? value\n } else if (optionKey === 'jsx' && typeof value === 'string') {\n const jsxMap: Record<string, import('typescript').JsxEmit> = {\n 'react-jsx': typescript.JsxEmit.ReactJSX,\n }\n res[optionKey] = jsxMap[value.toLowerCase()] ?? value\n } else {\n res[optionKey] = value\n }\n }\n\n return res\n}\n\nconst localDevTestFilesExcludeAction =\n 'NEXT_PRIVATE_LOCAL_DEV_TEST_FILES_EXCLUDE'\n\nexport async function writeConfigurationDefaults(\n typescriptVersion: string,\n tsConfigPath: string,\n isFirstTimeSetup: boolean,\n hasAppDir: boolean,\n distDir: string,\n hasPagesDir: boolean,\n isolatedDevBuild: boolean | undefined\n): Promise<void> {\n if (isFirstTimeSetup) {\n writeFileSync(tsConfigPath, '{}' + os.EOL)\n }\n\n const userTsConfigContent = readFileSync(tsConfigPath, {\n encoding: 'utf8',\n })\n const userTsConfig = CommentJson.parse(userTsConfigContent)\n\n // Bail automatic setup when the user has extended or referenced another config\n if ('extends' in userTsConfig || 'references' in userTsConfig) {\n return\n }\n\n if (userTsConfig?.compilerOptions == null) {\n userTsConfig.compilerOptions = {}\n isFirstTimeSetup = true\n }\n\n const desiredCompilerOptions = getDesiredCompilerOptions(\n typescriptVersion,\n userTsConfig\n )\n\n const suggestedActions: string[] = []\n const requiredActions: string[] = []\n for (const optionKey in desiredCompilerOptions) {\n const check = desiredCompilerOptions[optionKey]\n if ('suggested' in check) {\n if (!(optionKey in userTsConfig?.compilerOptions)) {\n userTsConfig.compilerOptions[optionKey] = check.suggested\n suggestedActions.push(\n cyan(optionKey) +\n ' was set to ' +\n bold(check.suggested) +\n (check.reason ? ` (${check.reason})` : '')\n )\n }\n } else if ('value' in check) {\n let existingValue = userTsConfig?.compilerOptions?.[optionKey]\n\n if (typeof existingValue === 'string') {\n existingValue = existingValue.toLowerCase()\n }\n\n const shouldWriteRequiredValue = () => {\n // Check if the option has multiple allowed values\n if (check.parsedValues) {\n return !check.parsedValues.includes(existingValue)\n }\n\n // Check if the option has a single parsed value\n if (check.parsedValue) {\n return check.parsedValue !== existingValue\n }\n\n // Fall back to direct value comparison\n return check.value !== existingValue\n }\n\n if (shouldWriteRequiredValue()) {\n if (!userTsConfig.compilerOptions) {\n userTsConfig.compilerOptions = {}\n }\n userTsConfig.compilerOptions[optionKey] = check.value\n requiredActions.push(\n cyan(optionKey) +\n ' was set to ' +\n bold(check.value) +\n ` (${check.reason})`\n )\n }\n } else {\n const _: never = check\n }\n }\n\n const nextAppTypes: string[] = [`${distDir}/types/**/*.ts`]\n\n // When isolatedDevBuild is enabled, Next.js uses different distDir paths:\n // - Development: \"{distDir}/dev\"\n // - Production: \"{distDir}\"\n // To prevent tsconfig updates when switching between dev/build modes,\n // we proactively include both type paths regardless of current environment.\n if (isolatedDevBuild !== false) {\n nextAppTypes.push(\n process.env.NODE_ENV === 'development'\n ? // In dev, distDir is \"{distDir}/dev\", which is already in the array above, but we also need \"{distDir}/types\".\n // Here we remove \"/dev\" at the end of distDir for consistency.\n `${distDir.replace(/\\/dev$/, '')}/types/**/*.ts`\n : // In build, distDir is \"{distDir}\", which is already in the array above, but we also need \"{distDir}/dev/types\".\n // Here we add \"/dev\" at the end of distDir for consistency.\n `${distDir}/dev/types/**/*.ts`\n )\n // Sort the array to ensure consistent order.\n nextAppTypes.sort((a, b) => a.length - b.length)\n }\n\n if (!('include' in userTsConfig)) {\n userTsConfig.include = hasAppDir\n ? ['next-env.d.ts', ...nextAppTypes, '**/*.mts', '**/*.ts', '**/*.tsx']\n : ['next-env.d.ts', '**/*.mts', '**/*.ts', '**/*.tsx']\n suggestedActions.push(\n cyan('include') +\n ' was set to ' +\n bold(\n hasAppDir\n ? `['next-env.d.ts', ${nextAppTypes.map((type) => `'${type}'`).join(', ')}, '**/*.mts', '**/*.ts', '**/*.tsx']`\n : `['next-env.d.ts', '**/*.mts', '**/*.ts', '**/*.tsx']`\n )\n )\n } else if (hasAppDir) {\n const missingFromResolved = []\n for (const type of nextAppTypes) {\n if (!userTsConfig.include.includes(type)) {\n missingFromResolved.push(type)\n }\n }\n\n if (missingFromResolved.length > 0) {\n if (!Array.isArray(userTsConfig.include)) {\n userTsConfig.include = []\n }\n\n missingFromResolved.forEach((item) => {\n userTsConfig.include.push(item)\n suggestedActions.push(\n cyan('include') + ' was updated to add ' + bold(`'${item}'`)\n )\n })\n }\n }\n\n // Enable the Next.js typescript plugin.\n if (hasAppDir) {\n // Check if the config or the resolved config has the plugin already.\n const plugins = [\n ...(Array.isArray(userTsConfig?.plugins) ? userTsConfig.plugins : []),\n ...(userTsConfig.compilerOptions &&\n Array.isArray(userTsConfig.compilerOptions.plugins)\n ? userTsConfig.compilerOptions.plugins\n : []),\n ]\n const hasNextPlugin = plugins.some(\n ({ name }: { name: string }) => name === 'next'\n )\n\n // If the TS config extends on another config, we can't add the `plugin` field\n // because that will override the parent config's plugins.\n // Instead we have to show a message to the user to add the plugin manually.\n if (\n !userTsConfig.compilerOptions ||\n (plugins.length &&\n !hasNextPlugin &&\n 'extends' in userTsConfig &&\n (!userTsConfig.compilerOptions ||\n !userTsConfig.compilerOptions.plugins))\n ) {\n Log.info(\n `\\nYour ${bold(\n 'tsconfig.json'\n )} extends another configuration, which means we cannot add the Next.js TypeScript plugin automatically. To improve your development experience, we recommend adding the Next.js plugin (\\`${cyan(\n '\"plugins\": [{ \"name\": \"next\" }]'\n )}\\`) manually to your TypeScript configuration. Learn more: https://nextjs.org/docs/app/api-reference/config/typescript#the-typescript-plugin\\n`\n )\n } else if (!hasNextPlugin) {\n if (!('plugins' in userTsConfig.compilerOptions)) {\n userTsConfig.compilerOptions.plugins = []\n }\n userTsConfig.compilerOptions.plugins.push({ name: 'next' })\n suggestedActions.push(\n cyan('plugins') + ' was updated to add ' + bold(`{ name: 'next' }`)\n )\n }\n\n // If `strict` is set to `false` and `strictNullChecks` is set to `false`,\n // then set `strictNullChecks` to `true`.\n if (\n hasPagesDir &&\n hasAppDir &&\n !userTsConfig?.compilerOptions?.strict &&\n !('strictNullChecks' in userTsConfig?.compilerOptions)\n ) {\n userTsConfig.compilerOptions.strictNullChecks = true\n suggestedActions.push(\n cyan('strictNullChecks') + ' was set to ' + bold(`true`)\n )\n }\n }\n\n if (!('exclude' in userTsConfig)) {\n userTsConfig.exclude = ['node_modules']\n suggestedActions.push(\n cyan('exclude') + ' was set to ' + bold(`['node_modules']`)\n )\n }\n\n // During local development inside Next.js repo, exclude the test files coverage by the local tsconfig\n if (process.env.NEXT_PRIVATE_LOCAL_DEV && userTsConfig.exclude) {\n const tsGlob = '**/*.test.ts'\n const tsxGlob = '**/*.test.tsx'\n let hasUpdates = false\n if (!userTsConfig.exclude.includes(tsGlob)) {\n userTsConfig.exclude.push(tsGlob)\n hasUpdates = true\n }\n if (!userTsConfig.exclude.includes(tsxGlob)) {\n userTsConfig.exclude.push(tsxGlob)\n hasUpdates = true\n }\n\n if (hasUpdates) {\n requiredActions.push(localDevTestFilesExcludeAction)\n }\n }\n\n if (suggestedActions.length < 1 && requiredActions.length < 1) {\n return\n }\n\n writeFileSync(\n tsConfigPath,\n CommentJson.stringify(userTsConfig, null, 2) + os.EOL\n )\n\n Log.info('')\n if (isFirstTimeSetup) {\n Log.info(\n `We detected TypeScript in your project and created a ${cyan(\n 'tsconfig.json'\n )} file for you.`\n )\n return\n }\n\n Log.info(\n `We detected TypeScript in your project and reconfigured your ${cyan(\n 'tsconfig.json'\n )} file for you.${\n userTsConfig.compilerOptions?.strict\n ? ''\n : ` Strict-mode is set to ${cyan('false')} by default.`\n }`\n )\n\n if (suggestedActions.length) {\n Log.info(\n `The following suggested values were added to your ${cyan(\n 'tsconfig.json'\n )}. These values ${cyan('can be changed')} to fit your project's needs:\\n`\n )\n\n suggestedActions.forEach((action) => Log.info(`\\t- ${action}`))\n\n Log.info('')\n }\n\n const requiredActionsToBeLogged = process.env.NEXT_PRIVATE_LOCAL_DEV\n ? requiredActions.filter(\n (action) => action !== localDevTestFilesExcludeAction\n )\n : requiredActions\n\n if (requiredActionsToBeLogged.length) {\n Log.info(\n `The following ${white('mandatory changes')} were made to your ${cyan(\n 'tsconfig.json'\n )}:\\n`\n )\n\n requiredActionsToBeLogged.forEach((action) => Log.info(`\\t- ${action}`))\n\n Log.info('')\n }\n}\n"],"names":["getRequiredConfiguration","writeConfigurationDefaults","getDesiredCompilerOptions","typescriptVersion","userTsConfig","moduleKindESNext","moduleKindES2020","moduleKindPreserve","moduleKindNodeNext","moduleKindNode16","moduleKindCommonJS","moduleKindAMD","moduleResolutionKindBundler","moduleResolutionKindNode10","moduleResolutionKindNode12","moduleResolutionKindNodeJs","jsxEmitReactJSX","target","suggested","reason","lib","allowJs","skipLibCheck","strict","noEmit","incremental","module","parsedValue","parsedValues","semver","gte","value","compilerOptions","toLowerCase","esModuleInterop","moduleResolution","filter","val","resolveJsonModule","verbatimModuleSyntax","undefined","isolatedModules","jsx","typescript","res","version","desiredCompilerOptions","optionKey","Object","keys","ev","moduleMap","esnext","ModuleKind","ESNext","es2020","ES2020","Preserve","preserve","nodenext","NodeNext","node16","Node16","commonjs","CommonJS","amd","AMD","moduleResolutionMap","bundler","ModuleResolutionKind","Bundler","node10","Node10","node12","Node12","node","NodeJs","jsxMap","JsxEmit","ReactJSX","localDevTestFilesExcludeAction","tsConfigPath","isFirstTimeSetup","hasAppDir","distDir","hasPagesDir","isolatedDevBuild","writeFileSync","os","EOL","userTsConfigContent","readFileSync","encoding","CommentJson","parse","suggestedActions","requiredActions","check","push","cyan","bold","existingValue","shouldWriteRequiredValue","includes","_","nextAppTypes","process","env","NODE_ENV","replace","sort","a","b","length","include","map","type","join","missingFromResolved","Array","isArray","forEach","item","plugins","hasNextPlugin","some","name","Log","info","strictNullChecks","exclude","NEXT_PRIVATE_LOCAL_DEV","tsGlob","tsxGlob","hasUpdates","stringify","action","requiredActionsToBeLogged","white"],"mappings":";;;;;;;;;;;;;;;IA+HgBA,wBAAwB;eAAxBA;;IAwDMC,0BAA0B;eAA1BA;;;oBAvLsB;4BACV;qEACL;+DACV;2DACJ;6DAEM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAarB,SAASC,0BACPC,iBAAyB,EACzBC,YAAkC;QAuDhCA,sCAAAA,+BAmCIA;IAxFN,aAAa;IACb,MAAMC,mBAAmB;IACzB,MAAMC,mBAAmB;IACzB,MAAMC,qBAAqB;IAC3B,MAAMC,qBAAqB;IAC3B,MAAMC,mBAAmB;IACzB,MAAMC,qBAAqB;IAC3B,MAAMC,gBAAgB;IAEtB,uBAAuB;IACvB,MA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AAI9C,kBAAkB;QACpB6C,KAAIC,IAAI,CACN,CAAC,qDAAqD,EAAE7B,IAAAA,gBAAI,EAC1D,iBACA,cAAc,CAAC;QAEnB;IACF;IAEA4B,KAAIC,IAAI,CACN,CAAC,6DAA6D,EAAE7B,IAAAA,gBAAI,EAClE,iBACA,cAAc,EACd/F,EAAAA,gCAAAA,aAAa4B,eAAe,qBAA5B5B,8BAA8BmB,MAAM,IAChC,KACA,CAAC,uBAAuB,EAAE4E,IAAAA,gBAAI,EAAC,SAAS,YAAY,CAAC,EACzD;IAGJ,IAAIJ,iBAAiBkB,MAAM,EAAE;QAC3Bc,KAAIC,IAAI,CACN,CAAC,kDAAkD,EAAE7B,IAAAA,gBAAI,EACvD,iBACA,eAAe,EAAEA,IAAAA,gBAAI,EAAC,kBAAkB,+BAA+B,CAAC;QAG5EJ,iBAAiB0B,OAAO,CAAC,CAACe,SAAWT,KAAIC,IAAI,CAAC,CAAC,IAAI,EAAEQ,QAAQ;QAE7DT,KAAIC,IAAI,CAAC;IACX;IAEA,MAAMS,4BAA4B/B,QAAQC,GAAG,CAACwB,sBAAsB,GAChEnC,gBAAgB5D,MAAM,CACpB,CAACoG,SAAWA,WAAWxD,kCAEzBgB;IAEJ,IAAIyC,0BAA0BxB,MAAM,EAAE;QACpCc,KAAIC,IAAI,CACN,CAAC,cAAc,EAAEU,IAAAA,iBAAK,EAAC,qBAAqB,mBAAmB,EAAEvC,IAAAA,gBAAI,EACnE,iBACA,GAAG,CAAC;QAGRsC,0BAA0BhB,OAAO,CAAC,CAACe,SAAWT,KAAIC,IAAI,CAAC,CAAC,IAAI,EAAEQ,QAAQ;QAEtET,KAAIC,IAAI,CAAC;IACX;AACF","ignoreList":[0]}
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ 0 && (module.exports = {
6
+ SerializableError: null,
7
+ isSerializableProps: null
8
+ });
9
+ function _export(target, all) {
10
+ for(var name in all)Object.defineProperty(target, name, {
11
+ enumerable: true,
12
+ get: all[name]
13
+ });
14
+ }
15
+ _export(exports, {
16
+ SerializableError: function() {
17
+ return SerializableError;
18
+ },
19
+ isSerializableProps: function() {
20
+ return isSerializableProps;
21
+ }
22
+ });
23
+ const _isplainobject = require("../object/is-plain-object");
24
+ const regexpPlainIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
25
+ class SerializableError extends Error {
26
+ constructor(page, method, path, message){
27
+ super(path ? `Error serializing \`${path}\` returned from \`${method}\` in "${page}".\nReason: ${message}` : `Error serializing props returned from \`${method}\` in "${page}".\nReason: ${message}`);
28
+ }
29
+ }
30
+ function isSerializableProps(page, method, input) {
31
+ if (!(0, _isplainobject.isPlainObject)(input)) {
32
+ throw Object.defineProperty(new SerializableError(page, method, '', `Props must be returned as a plain object from ${method}: \`{ props: { ... } }\` (received: \`${(0, _isplainobject.getObjectClassLabel)(input)}\`).`), "__NEXT_ERROR_CODE", {
33
+ value: "E394",
34
+ enumerable: false,
35
+ configurable: true
36
+ });
37
+ }
38
+ function visit(visited, value, path) {
39
+ if (visited.has(value)) {
40
+ throw Object.defineProperty(new SerializableError(page, method, path, `Circular references cannot be expressed in JSON (references: \`${visited.get(value) || '(self)'}\`).`), "__NEXT_ERROR_CODE", {
41
+ value: "E394",
42
+ enumerable: false,
43
+ configurable: true
44
+ });
45
+ }
46
+ visited.set(value, path);
47
+ }
48
+ function isSerializable(refs, value, path) {
49
+ const type = typeof value;
50
+ if (// `null` can be serialized, but not `undefined`.
51
+ value === null || // n.b. `bigint`, `function`, `symbol`, and `undefined` cannot be
52
+ // serialized.
53
+ //
54
+ // `object` is special-cased below, as it may represent `null`, an Array,
55
+ // a plain object, a class, et al.
56
+ type === 'boolean' || type === 'number' || type === 'string') {
57
+ return true;
58
+ }
59
+ if (type === 'undefined') {
60
+ throw Object.defineProperty(new SerializableError(page, method, path, '`undefined` cannot be serialized as JSON. Please use `null` or omit this value.'), "__NEXT_ERROR_CODE", {
61
+ value: "E394",
62
+ enumerable: false,
63
+ configurable: true
64
+ });
65
+ }
66
+ if ((0, _isplainobject.isPlainObject)(value)) {
67
+ visit(refs, value, path);
68
+ if (Object.entries(value).every(([key, nestedValue])=>{
69
+ const nextPath = regexpPlainIdentifier.test(key) ? `${path}.${key}` : `${path}[${JSON.stringify(key)}]`;
70
+ const newRefs = new Map(refs);
71
+ return isSerializable(newRefs, key, nextPath) && isSerializable(newRefs, nestedValue, nextPath);
72
+ })) {
73
+ return true;
74
+ }
75
+ throw Object.defineProperty(new SerializableError(page, method, path, `invariant: Unknown error encountered in Object.`), "__NEXT_ERROR_CODE", {
76
+ value: "E394",
77
+ enumerable: false,
78
+ configurable: true
79
+ });
80
+ }
81
+ if (Array.isArray(value)) {
82
+ visit(refs, value, path);
83
+ if (value.every((nestedValue, index)=>{
84
+ const newRefs = new Map(refs);
85
+ return isSerializable(newRefs, nestedValue, `${path}[${index}]`);
86
+ })) {
87
+ return true;
88
+ }
89
+ throw Object.defineProperty(new SerializableError(page, method, path, `invariant: Unknown error encountered in Array.`), "__NEXT_ERROR_CODE", {
90
+ value: "E394",
91
+ enumerable: false,
92
+ configurable: true
93
+ });
94
+ }
95
+ // None of these can be expressed as JSON:
96
+ // const type: "bigint" | "symbol" | "object" | "function"
97
+ throw Object.defineProperty(new SerializableError(page, method, path, '`' + type + '`' + (type === 'object' ? ` ("${Object.prototype.toString.call(value)}")` : '') + ' cannot be serialized as JSON. Please only return JSON serializable data types.'), "__NEXT_ERROR_CODE", {
98
+ value: "E394",
99
+ enumerable: false,
100
+ configurable: true
101
+ });
102
+ }
103
+ return isSerializable(new Map(), input, '');
104
+ }
105
+
106
+ //# sourceMappingURL=is-serializable-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../validation/is-serializable-props.ts"],"sourcesContent":["import { isPlainObject, getObjectClassLabel } from '../object/is-plain-object'\n\nconst regexpPlainIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/\n\nexport class SerializableError extends Error {\n constructor(page: string, method: string, path: string, message: string) {\n super(\n path\n ? `Error serializing \\`${path}\\` returned from \\`${method}\\` in \"${page}\".\\nReason: ${message}`\n : `Error serializing props returned from \\`${method}\\` in \"${page}\".\\nReason: ${message}`\n )\n }\n}\n\nexport function isSerializableProps(\n page: string,\n method: string,\n input: any\n): true {\n if (!isPlainObject(input)) {\n throw new SerializableError(\n page,\n method,\n '',\n `Props must be returned as a plain object from ${method}: \\`{ props: { ... } }\\` (received: \\`${getObjectClassLabel(\n input\n )}\\`).`\n )\n }\n\n function visit(visited: Map<any, string>, value: any, path: string) {\n if (visited.has(value)) {\n throw new SerializableError(\n page,\n method,\n path,\n `Circular references cannot be expressed in JSON (references: \\`${\n visited.get(value) || '(self)'\n }\\`).`\n )\n }\n\n visited.set(value, path)\n }\n\n function isSerializable(\n refs: Map<any, string>,\n value: any,\n path: string\n ): true {\n const type = typeof value\n if (\n // `null` can be serialized, but not `undefined`.\n value === null ||\n // n.b. `bigint`, `function`, `symbol`, and `undefined` cannot be\n // serialized.\n //\n // `object` is special-cased below, as it may represent `null`, an Array,\n // a plain object, a class, et al.\n type === 'boolean' ||\n type === 'number' ||\n type === 'string'\n ) {\n return true\n }\n\n if (type === 'undefined') {\n throw new SerializableError(\n page,\n method,\n path,\n '`undefined` cannot be serialized as JSON. Please use `null` or omit this value.'\n )\n }\n\n if (isPlainObject(value)) {\n visit(refs, value, path)\n\n if (\n Object.entries(value).every(([key, nestedValue]) => {\n const nextPath = regexpPlainIdentifier.test(key)\n ? `${path}.${key}`\n : `${path}[${JSON.stringify(key)}]`\n\n const newRefs = new Map(refs)\n return (\n isSerializable(newRefs, key, nextPath) &&\n isSerializable(newRefs, nestedValue, nextPath)\n )\n })\n ) {\n return true\n }\n\n throw new SerializableError(\n page,\n method,\n path,\n `invariant: Unknown error encountered in Object.`\n )\n }\n\n if (Array.isArray(value)) {\n visit(refs, value, path)\n\n if (\n value.every((nestedValue, index) => {\n const newRefs = new Map(refs)\n return isSerializable(newRefs, nestedValue, `${path}[${index}]`)\n })\n ) {\n return true\n }\n\n throw new SerializableError(\n page,\n method,\n path,\n `invariant: Unknown error encountered in Array.`\n )\n }\n\n // None of these can be expressed as JSON:\n // const type: \"bigint\" | \"symbol\" | \"object\" | \"function\"\n throw new SerializableError(\n page,\n method,\n path,\n '`' +\n type +\n '`' +\n (type === 'object'\n ? ` (\"${Object.prototype.toString.call(value)}\")`\n : '') +\n ' cannot be serialized as JSON. Please only return JSON serializable data types.'\n )\n }\n\n return isSerializable(new Map(), input, '')\n}\n"],"names":["SerializableError","isSerializableProps","regexpPlainIdentifier","Error","constructor","page","method","path","message","input","isPlainObject","getObjectClassLabel","visit","visited","value","has","get","set","isSerializable","refs","type","Object","entries","every","key","nestedValue","nextPath","test","JSON","stringify","newRefs","Map","Array","isArray","index","prototype","toString","call"],"mappings":";;;;;;;;;;;;;;;IAIaA,iBAAiB;eAAjBA;;IAUGC,mBAAmB;eAAnBA;;;+BAdmC;AAEnD,MAAMC,wBAAwB;AAEvB,MAAMF,0BAA0BG;IACrCC,YAAYC,IAAY,EAAEC,MAAc,EAAEC,IAAY,EAAEC,OAAe,CAAE;QACvE,KAAK,CACHD,OACI,CAAC,oBAAoB,EAAEA,KAAK,mBAAmB,EAAED,OAAO,OAAO,EAAED,KAAK,YAAY,EAAEG,SAAS,GAC7F,CAAC,wCAAwC,EAAEF,OAAO,OAAO,EAAED,KAAK,YAAY,EAAEG,SAAS;IAE/F;AACF;AAEO,SAASP,oBACdI,IAAY,EACZC,MAAc,EACdG,KAAU;IAEV,IAAI,CAACC,IAAAA,4BAAa,EAACD,QAAQ;QACzB,MAAM,qBAOL,CAPK,IAAIT,kBACRK,MACAC,QACA,IACA,CAAC,8CAA8C,EAAEA,OAAO,sCAAsC,EAAEK,IAAAA,kCAAmB,EACjHF,OACA,IAAI,CAAC,GANH,qBAAA;mBAAA;wBAAA;0BAAA;QAON;IACF;IAEA,SAASG,MAAMC,OAAyB,EAAEC,KAAU,E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ML,OAAOP;YAEnB,IACEO,MAAMS,KAAK,CAAC,CAACE,aAAaS;gBACxB,MAAMJ,UAAU,IAAIC,IAAIZ;gBACxB,OAAOD,eAAeY,SAASL,aAAa,GAAGlB,KAAK,CAAC,EAAE2B,MAAM,CAAC,CAAC;YACjE,IACA;gBACA,OAAO;YACT;YAEA,MAAM,qBAKL,CALK,IAAIlC,kBACRK,MACAC,QACAC,MACA,CAAC,8CAA8C,CAAC,GAJ5C,qBAAA;uBAAA;4BAAA;8BAAA;YAKN;QACF;QAEA,0CAA0C;QAC1C,0DAA0D;QAC1D,MAAM,qBAWL,CAXK,IAAIP,kBACRK,MACAC,QACAC,MACA,MACEa,OACA,MACCA,CAAAA,SAAS,WACN,CAAC,GAAG,EAAEC,OAAOc,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACvB,OAAO,EAAE,CAAC,GAC/C,EAAC,IACL,oFAVE,qBAAA;mBAAA;wBAAA;0BAAA;QAWN;IACF;IAEA,OAAOI,eAAe,IAAIa,OAAOtB,OAAO;AAC1C","ignoreList":[0]}
package/index.d.ts CHANGED
@@ -15,5 +15,5 @@
15
15
  /// <reference path="./script.d.ts" />
16
16
  /// <reference path="./server.d.ts" />
17
17
 
18
- export { default } from './types'
19
- export * from './types'
18
+ export { default } from './dist/types'
19
+ export * from './dist/types'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openuiai/next",
3
- "version": "16.2.0",
3
+ "version": "16.3.0",
4
4
  "description": "OpenNext.js - A development-focused fork of Next.js with Bun support",
5
5
  "main": "./dist/server/next.js",
6
6
  "license": "MIT",
@@ -132,6 +132,7 @@
132
132
  "devDependencies": {
133
133
  "@babel/code-frame": "7.26.2",
134
134
  "@babel/core": "7.26.10",
135
+ "@babel/eslint-parser": "7.23.10",
135
136
  "@babel/generator": "7.27.0",
136
137
  "@babel/plugin-syntax-bigint": "7.8.3",
137
138
  "@babel/plugin-syntax-dynamic-import": "7.8.3",