@next/codemod 16.5.0-canary.2 → 16.5.0-canary.4
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/package.json
CHANGED
|
@@ -19,8 +19,10 @@ const utils_1 = require("../lib/utils");
|
|
|
19
19
|
* a server segment that accepts route segment config like the other two.
|
|
20
20
|
*/
|
|
21
21
|
function transformer(file, _api) {
|
|
22
|
+
const isRouteSegment = /(^|[/\\])app[/\\](?:.*[/\\])?(page|layout|default)\.[^/\\]+$/.test(file.path);
|
|
23
|
+
const isColocatedTestOrStory = /\.(?:test|spec|story|stories)\.[^/\\]+$/.test(file.path);
|
|
22
24
|
if (process.env.NODE_ENV !== 'test' &&
|
|
23
|
-
|
|
25
|
+
(!isRouteSegment || isColocatedTestOrStory)) {
|
|
24
26
|
return file.source;
|
|
25
27
|
}
|
|
26
28
|
const j = (0, parser_1.createParserFromPath)(file.path);
|