@platformatic/next 3.78.0 → 3.80.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.
- package/lib/loader-next-15.cjs +8 -5
- package/lib/loader.js +7 -4
- package/package.json +10 -10
- package/schema.json +1 -1
package/lib/loader-next-15.cjs
CHANGED
|
@@ -17,6 +17,9 @@ const {
|
|
|
17
17
|
const { transformSync } = require('amaro')
|
|
18
18
|
const { getConfig, getRoot } = require('@platformatic/globals')
|
|
19
19
|
|
|
20
|
+
const babelGenerate = generate.default ?? generate
|
|
21
|
+
const babelTraverse = traverse.default ?? traverse
|
|
22
|
+
|
|
20
23
|
const originalReadFile = fsPromises.readFile
|
|
21
24
|
const originalReadFileSync = fs.readFileSync
|
|
22
25
|
const targetFile = resolve(fileURLToPath(getRoot()), 'next.config.ts')
|
|
@@ -45,7 +48,7 @@ function createEvaluatorWrapperFunction (original) {
|
|
|
45
48
|
function transformCJS (source) {
|
|
46
49
|
const ast = parse(source.toString(), { sourceType: 'module' })
|
|
47
50
|
|
|
48
|
-
|
|
51
|
+
babelTraverse(ast, {
|
|
49
52
|
AssignmentExpression (path) {
|
|
50
53
|
const { left, right } = path.node
|
|
51
54
|
|
|
@@ -56,13 +59,13 @@ function transformCJS (source) {
|
|
|
56
59
|
}
|
|
57
60
|
})
|
|
58
61
|
|
|
59
|
-
return
|
|
62
|
+
return babelGenerate(ast).code
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
function transformESM (source) {
|
|
63
66
|
const ast = parse(source.toString(), { sourceType: 'module' })
|
|
64
67
|
|
|
65
|
-
|
|
68
|
+
babelTraverse(ast, {
|
|
66
69
|
ExportDefaultDeclaration (path) {
|
|
67
70
|
const declaration = path.node.declaration
|
|
68
71
|
|
|
@@ -84,7 +87,7 @@ function transformESM (source) {
|
|
|
84
87
|
}
|
|
85
88
|
})
|
|
86
89
|
|
|
87
|
-
return
|
|
90
|
+
return babelGenerate(ast).code
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
function detectFormat (code) {
|
|
@@ -93,7 +96,7 @@ function detectFormat (code) {
|
|
|
93
96
|
const ast = parse(code, { sourceType: 'module' })
|
|
94
97
|
|
|
95
98
|
// Manipulate the AST
|
|
96
|
-
|
|
99
|
+
babelTraverse(ast, {
|
|
97
100
|
AssignmentExpression (path) {
|
|
98
101
|
const { left } = path.node
|
|
99
102
|
|
package/lib/loader.js
CHANGED
|
@@ -14,6 +14,9 @@ import { readFileSync, realpathSync } from 'node:fs'
|
|
|
14
14
|
import { readFile, realpath } from 'node:fs/promises'
|
|
15
15
|
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
16
16
|
|
|
17
|
+
const babelGenerate = generate.default ?? generate
|
|
18
|
+
const babelTraverse = traverse.default ?? traverse
|
|
19
|
+
|
|
17
20
|
const originalId = '__pltEnhanceNextConfig'
|
|
18
21
|
// Keep in sync with https://github.com/vercel/next.js/blob/main/packages/next/src/shared/lib/constants.ts
|
|
19
22
|
let candidates = ['next.config.js', 'next.config.mjs']
|
|
@@ -41,7 +44,7 @@ export function transformCJS (source) {
|
|
|
41
44
|
const ast = parse(source.toString(), { sourceType: 'module' })
|
|
42
45
|
|
|
43
46
|
// Manipulate the AST
|
|
44
|
-
|
|
47
|
+
babelTraverse(ast, {
|
|
45
48
|
AssignmentExpression (path) {
|
|
46
49
|
const { left, right } = path.node
|
|
47
50
|
|
|
@@ -53,14 +56,14 @@ export function transformCJS (source) {
|
|
|
53
56
|
}
|
|
54
57
|
})
|
|
55
58
|
|
|
56
|
-
return
|
|
59
|
+
return babelGenerate(ast).code
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
export function transformESM (source) {
|
|
60
63
|
const ast = parse(source.toString(), { sourceType: 'module' })
|
|
61
64
|
|
|
62
65
|
// Manipulate the AST
|
|
63
|
-
|
|
66
|
+
babelTraverse(ast, {
|
|
64
67
|
ExportDefaultDeclaration (path) {
|
|
65
68
|
const declaration = path.node.declaration
|
|
66
69
|
|
|
@@ -84,7 +87,7 @@ export function transformESM (source) {
|
|
|
84
87
|
}
|
|
85
88
|
})
|
|
86
89
|
|
|
87
|
-
return
|
|
90
|
+
return babelGenerate(ast).code
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
function initializeCandidates (data, realRootPath) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/next",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.80.0",
|
|
4
4
|
"description": "Platformatic Next.js Capability",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
},
|
|
16
16
|
"homepage": "https://github.com/platformatic/platformatic#readme",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@babel/generator": "^
|
|
19
|
-
"@babel/parser": "^
|
|
20
|
-
"@babel/traverse": "^
|
|
21
|
-
"@babel/types": "^
|
|
22
|
-
"@platformatic/basic": "3.
|
|
23
|
-
"@platformatic/foundation": "3.
|
|
24
|
-
"@platformatic/globals": "3.
|
|
18
|
+
"@babel/generator": "^8.0.0",
|
|
19
|
+
"@babel/parser": "^8.0.0",
|
|
20
|
+
"@babel/traverse": "^8.0.0",
|
|
21
|
+
"@babel/types": "^8.0.0",
|
|
22
|
+
"@platformatic/basic": "3.80.0",
|
|
23
|
+
"@platformatic/foundation": "3.80.0",
|
|
24
|
+
"@platformatic/globals": "3.80.0",
|
|
25
25
|
"@platformatic/image-optimizer": "^0.2.1",
|
|
26
26
|
"amaro": "^1.0.0",
|
|
27
27
|
"iovalkey": "^0.4.0",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@fastify/reply-from": "^12.0.0",
|
|
34
|
-
"@platformatic/gateway": "3.
|
|
35
|
-
"@platformatic/service": "3.
|
|
34
|
+
"@platformatic/gateway": "3.80.0",
|
|
35
|
+
"@platformatic/service": "3.80.0",
|
|
36
36
|
"@types/node": "^22.5.0",
|
|
37
37
|
"@types/react": "^19.1.11",
|
|
38
38
|
"@types/react-dom": "^19.1.7",
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/next/3.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/next/3.80.0.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Next.js Config",
|
|
5
5
|
"type": "object",
|