@mlut/plugins 1.0.2 → 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/README.md +4 -4
- package/dist/index.js +18 -2
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# mlut plugins #
|
|
2
2
|
|
|
3
|
-
<img alt="Logo" src="https://github.com/
|
|
3
|
+
<img alt="Logo" src="https://github.com/mlutcss/mlut/raw/master/docs/img/logo-full.png" width="350"/>
|
|
4
4
|
|
|
5
|
-
The [mlut](https://github.com/
|
|
5
|
+
The [mlut](https://github.com/mlutcss/mlut) plugins for Rollup, Vite and Webpack. Based on [unplugin](https://unplugin.unjs.io/).
|
|
6
6
|
|
|
7
7
|
## Installation ##
|
|
8
8
|
|
|
@@ -16,7 +16,7 @@ This allows you to control the versions of all your dependencies, and to choose
|
|
|
16
16
|
|
|
17
17
|
## Usage ##
|
|
18
18
|
|
|
19
|
-
Import the plugin for the appropriate bundler from the `@mlut/plugins` package as in one of the examples below. You can find more detailed examples using dev-server and livereload in the plugin tests [directory](https://github.com/
|
|
19
|
+
Import the plugin for the appropriate bundler from the `@mlut/plugins` package as in one of the examples below. You can find more detailed examples using dev-server and livereload in the plugin tests [directory](https://github.com/mlutcss/mlut/tree/master/test/plugins)
|
|
20
20
|
|
|
21
21
|
### Rollup ###
|
|
22
22
|
|
|
@@ -103,7 +103,7 @@ You can add the options in your input Sass file too. Options must be a **valid J
|
|
|
103
103
|
```
|
|
104
104
|
|
|
105
105
|
## Documentation ##
|
|
106
|
-
Full documentation available [here](https://
|
|
106
|
+
Full documentation available [here](https://docs.mlut.style/section-start.html#kssref-start-integrations)
|
|
107
107
|
|
|
108
108
|
## License ##
|
|
109
109
|
MIT
|
package/dist/index.js
CHANGED
|
@@ -14,10 +14,12 @@ export const unplugin = createUnplugin((options, meta) => {
|
|
|
14
14
|
const cwd = process.cwd();
|
|
15
15
|
const pluginName = 'unplugin-mlut';
|
|
16
16
|
const finalOptions = { output: '' };
|
|
17
|
-
|
|
17
|
+
let inputPath = options.input && path.resolve(cwd, options.input);
|
|
18
18
|
let outputPath = '';
|
|
19
|
+
let viteWatchOutputPath = '';
|
|
19
20
|
let lastCompiledCss = '';
|
|
20
21
|
const isWebpack = meta.framework === 'webpack';
|
|
22
|
+
const isWindows = process.platform === 'win32';
|
|
21
23
|
let isVite = false;
|
|
22
24
|
let isViteWatch = false;
|
|
23
25
|
const writeCssFile = async () => {
|
|
@@ -57,6 +59,13 @@ export const unplugin = createUnplugin((options, meta) => {
|
|
|
57
59
|
await jitEngine.init([inputPath, inputContent]);
|
|
58
60
|
outputPath = path.resolve(cwd, finalOptions.output);
|
|
59
61
|
if (isViteWatch) {
|
|
62
|
+
if (isWindows) {
|
|
63
|
+
viteWatchOutputPath = path.isAbsolute(finalOptions.output) ?
|
|
64
|
+
finalOptions.output.replace(cwd, '') : finalOptions.output;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
viteWatchOutputPath = outputPath;
|
|
68
|
+
}
|
|
60
69
|
await fs.outputFile(outputPath, '').catch(() => undefined);
|
|
61
70
|
}
|
|
62
71
|
};
|
|
@@ -64,10 +73,14 @@ export const unplugin = createUnplugin((options, meta) => {
|
|
|
64
73
|
name: pluginName,
|
|
65
74
|
async config(_config, { command }) {
|
|
66
75
|
isVite = true;
|
|
76
|
+
inputPath = inputPath?.replaceAll('\\', '/');
|
|
67
77
|
if (command === 'serve') {
|
|
68
78
|
isViteWatch = true;
|
|
69
79
|
}
|
|
70
80
|
await initPlugin();
|
|
81
|
+
if (isWindows) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
71
84
|
return {
|
|
72
85
|
server: {
|
|
73
86
|
watch: {
|
|
@@ -100,6 +113,9 @@ export const unplugin = createUnplugin((options, meta) => {
|
|
|
100
113
|
},
|
|
101
114
|
transform(code, id) {
|
|
102
115
|
jitEngine.putContent(id, code);
|
|
116
|
+
if (isViteWatch) {
|
|
117
|
+
debouncedWriteCssFile();
|
|
118
|
+
}
|
|
103
119
|
return null;
|
|
104
120
|
},
|
|
105
121
|
async transformIndexHtml(html, ctx) {
|
|
@@ -111,7 +127,7 @@ export const unplugin = createUnplugin((options, meta) => {
|
|
|
111
127
|
tags: [
|
|
112
128
|
{
|
|
113
129
|
tag: 'link',
|
|
114
|
-
attrs: { rel: 'stylesheet', href:
|
|
130
|
+
attrs: { rel: 'stylesheet', href: viteWatchOutputPath },
|
|
115
131
|
},
|
|
116
132
|
],
|
|
117
133
|
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mlut/plugins",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "mlut plugins for Rollup, Vite and Webpack",
|
|
5
5
|
"author": "mr150",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"homepage": "https://
|
|
8
|
+
"homepage": "https://mlut.style/",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
10
10
|
"keywords": [
|
|
11
11
|
"mlut",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
23
|
"directory": "packages/plugins",
|
|
24
|
-
"url": "https://github.com/
|
|
24
|
+
"url": "https://github.com/mlutcss/mlut.git"
|
|
25
25
|
},
|
|
26
26
|
"bugs": {
|
|
27
|
-
"url": "https://github.com/
|
|
27
|
+
"url": "https://github.com/mlutcss/mlut/issues"
|
|
28
28
|
},
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"browserslist": "^4.23.1",
|
|
46
46
|
"clean-css": "^5.3.3",
|
|
47
47
|
"csso": "^5.0.5",
|
|
48
|
-
"esbuild": "^0.
|
|
48
|
+
"esbuild": "^0.25.0",
|
|
49
49
|
"lightningcss": "^1.25.1",
|
|
50
50
|
"postcss": "^8.4.38",
|
|
51
|
-
"typescript": "^
|
|
51
|
+
"typescript": "^5.8.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@mlut/core": "^2.
|
|
55
|
-
"fs-extra": "
|
|
56
|
-
"unplugin": "
|
|
54
|
+
"@mlut/core": "^2.5.0",
|
|
55
|
+
"fs-extra": "11.2.0",
|
|
56
|
+
"unplugin": "2.3.10"
|
|
57
57
|
}
|
|
58
58
|
}
|