@sleetch/next 1.0.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/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/lib/plugin.d.ts +5 -0
- package/dist/lib/plugin.js +15 -0
- package/dist/lib/wepack-plugin.d.ts +8 -0
- package/dist/lib/wepack-plugin.js +17 -0
- package/package.json +31 -0
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { sleetch_webpack_plugin } from "./wepack-plugin.js";
|
|
2
|
+
//#region src/lib/plugin.ts
|
|
3
|
+
function with_sleetch_plugin(next_config = {}) {
|
|
4
|
+
console.dir(next_config, { depth: null });
|
|
5
|
+
return {
|
|
6
|
+
...next_config,
|
|
7
|
+
webpack(webpack_config, options) {
|
|
8
|
+
webpack_config.plugins ??= [];
|
|
9
|
+
webpack_config.plugins.push(new sleetch_webpack_plugin());
|
|
10
|
+
return next_config.webpack ? next_config.webpack(webpack_config, options) : webpack_config;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { with_sleetch_plugin };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { sleetch_runtime } from "@sleetch/core/compiler";
|
|
2
|
+
//#region src/lib/wepack-plugin.ts
|
|
3
|
+
const runtime = new sleetch_runtime();
|
|
4
|
+
var sleetch_webpack_plugin = class {
|
|
5
|
+
constructor() {}
|
|
6
|
+
apply(compiler) {
|
|
7
|
+
compiler.hooks.beforeCompile.tapPromise("SleetchWebpackPlugin", async () => {
|
|
8
|
+
if (!runtime.sources.loaded()) {
|
|
9
|
+
await runtime.sources.load();
|
|
10
|
+
await runtime.builder.build();
|
|
11
|
+
}
|
|
12
|
+
if (compiler.options.mode === "development" && !runtime.sources.loaded()) await runtime.sources.watch();
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { sleetch_webpack_plugin };
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sleetch/next",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsdown",
|
|
13
|
+
"dev": "tsdown --watch"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": "./dist/index.js",
|
|
17
|
+
"./lib/plugin": "./dist/lib/plugin.js",
|
|
18
|
+
"./lib/wepack-plugin": "./dist/lib/wepack-plugin.js",
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@sleetch/core": "1.0.4"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"next": "^16.0.0",
|
|
26
|
+
"@types/webpack": "^5.28.5"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"next": "^16.2.12"
|
|
30
|
+
}
|
|
31
|
+
}
|