@plumeria/next-plugin 11.0.0 → 11.0.1
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/index.d.ts +1 -1
- package/dist/index.js +52 -3
- package/package.json +3 -7
- package/dist/turbopack.d.ts +0 -2
- package/dist/turbopack.js +0 -29
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { NextConfig } from 'next';
|
|
2
|
-
export declare function withPlumeria(nextConfig
|
|
2
|
+
export declare function withPlumeria(nextConfig?: NextConfig): NextConfig;
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withPlumeria = withPlumeria;
|
|
4
|
-
|
|
4
|
+
const isRuleConfigItem = (rule) => !Array.isArray(rule) && typeof rule === 'object' && rule !== null;
|
|
5
|
+
function withPlumeria(nextConfig = {}) {
|
|
5
6
|
const originalWebpack = nextConfig.webpack;
|
|
7
|
+
const turbopackLoaders = [
|
|
8
|
+
{ loader: '@plumeria/turbopack-loader', options: {} },
|
|
9
|
+
];
|
|
10
|
+
const plumeriaRules = {
|
|
11
|
+
'*.ts': { loaders: turbopackLoaders },
|
|
12
|
+
'*.tsx': { loaders: turbopackLoaders },
|
|
13
|
+
'*.js': { loaders: turbopackLoaders },
|
|
14
|
+
'*.jsx': { loaders: turbopackLoaders },
|
|
15
|
+
};
|
|
16
|
+
const mergeTurbopackRules = (existingRules = {}, newRules) => {
|
|
17
|
+
const mergedRules = { ...existingRules };
|
|
18
|
+
for (const [key, newRule] of Object.entries(newRules)) {
|
|
19
|
+
const existing = mergedRules[key];
|
|
20
|
+
if (existing && isRuleConfigItem(existing) && isRuleConfigItem(newRule)) {
|
|
21
|
+
const newLoaders = newRule.loaders || [];
|
|
22
|
+
const existingLoaders = Array.isArray(existing.loaders)
|
|
23
|
+
? existing.loaders
|
|
24
|
+
: existing.loaders
|
|
25
|
+
? [existing.loaders]
|
|
26
|
+
: [];
|
|
27
|
+
mergedRules[key] = {
|
|
28
|
+
...existing,
|
|
29
|
+
loaders: [...newLoaders, ...existingLoaders],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
mergedRules[key] = newRule;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return mergedRules;
|
|
37
|
+
};
|
|
6
38
|
return {
|
|
7
39
|
...nextConfig,
|
|
40
|
+
turbopack: {
|
|
41
|
+
...nextConfig?.turbopack,
|
|
42
|
+
rules: mergeTurbopackRules(nextConfig?.turbopack?.rules, plumeriaRules),
|
|
43
|
+
},
|
|
8
44
|
webpack(config, context) {
|
|
9
45
|
if (typeof originalWebpack === 'function') {
|
|
10
46
|
config = originalWebpack(config, context);
|
|
11
47
|
}
|
|
48
|
+
const existingIgnored = config.watchOptions?.ignored;
|
|
49
|
+
const plumeriaIgnored = ['node_modules', '.next', '.git'];
|
|
50
|
+
const mergedIgnored = existingIgnored instanceof RegExp
|
|
51
|
+
? existingIgnored
|
|
52
|
+
: Array.from(new Set([
|
|
53
|
+
...(Array.isArray(existingIgnored)
|
|
54
|
+
? existingIgnored
|
|
55
|
+
: existingIgnored
|
|
56
|
+
? [existingIgnored]
|
|
57
|
+
: []),
|
|
58
|
+
...plumeriaIgnored,
|
|
59
|
+
]));
|
|
12
60
|
config.watchOptions = {
|
|
13
|
-
|
|
61
|
+
...config.watchOptions,
|
|
62
|
+
ignored: mergedIgnored,
|
|
14
63
|
};
|
|
15
64
|
config.module?.rules?.unshift({
|
|
16
65
|
enforce: 'pre',
|
|
17
66
|
test: /\.(tsx|ts|jsx|js)$/,
|
|
18
67
|
exclude: [/node_modules/, /\.next/, /\.git/],
|
|
19
|
-
use:
|
|
68
|
+
use: '@plumeria/turbopack-loader',
|
|
20
69
|
});
|
|
21
70
|
return config;
|
|
22
71
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/next-plugin",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.1",
|
|
4
4
|
"description": "Plumeria Next.js plugin",
|
|
5
5
|
"author": "Refirst 11",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,20 +20,16 @@
|
|
|
20
20
|
"types": "./dist/index.d.ts",
|
|
21
21
|
"import": "./dist/index.js",
|
|
22
22
|
"default": "./dist/index.js"
|
|
23
|
-
},
|
|
24
|
-
"./turbopack": {
|
|
25
|
-
"types": "./dist/turbopack.d.ts",
|
|
26
|
-
"import": "./dist/turbopack.js",
|
|
27
|
-
"default": "./dist/turbopack.js"
|
|
28
23
|
}
|
|
29
24
|
},
|
|
30
25
|
"main": "dist/index.js",
|
|
26
|
+
"module": "dist/index.js",
|
|
31
27
|
"types": "dist/index.d.ts",
|
|
32
28
|
"files": [
|
|
33
29
|
"dist/"
|
|
34
30
|
],
|
|
35
31
|
"dependencies": {
|
|
36
|
-
"@plumeria/turbopack-loader": "^11.0.
|
|
32
|
+
"@plumeria/turbopack-loader": "^11.0.1"
|
|
37
33
|
},
|
|
38
34
|
"devDependencies": {
|
|
39
35
|
"next": "^16.2.3",
|
package/dist/turbopack.d.ts
DELETED
package/dist/turbopack.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withPlumeria = void 0;
|
|
4
|
-
const withPlumeria = (nextConfig = {}) => {
|
|
5
|
-
const reactLoaders = [
|
|
6
|
-
{ loader: '@plumeria/turbopack-loader', options: {} },
|
|
7
|
-
];
|
|
8
|
-
return {
|
|
9
|
-
...nextConfig,
|
|
10
|
-
turbopack: {
|
|
11
|
-
...nextConfig?.turbopack,
|
|
12
|
-
rules: {
|
|
13
|
-
'*.ts': {
|
|
14
|
-
loaders: reactLoaders,
|
|
15
|
-
},
|
|
16
|
-
'*.tsx': {
|
|
17
|
-
loaders: reactLoaders,
|
|
18
|
-
},
|
|
19
|
-
'*.js': {
|
|
20
|
-
loaders: reactLoaders,
|
|
21
|
-
},
|
|
22
|
-
'*.jsx': {
|
|
23
|
-
loaders: reactLoaders,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
exports.withPlumeria = withPlumeria;
|