@plumeria/unplugin 10.5.3
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/LICENSE +21 -0
- package/README.md +159 -0
- package/dist/bun.d.ts +3 -0
- package/dist/bun.js +5 -0
- package/dist/bun.mjs +3 -0
- package/dist/core.d.ts +9 -0
- package/dist/core.js +1298 -0
- package/dist/core.mjs +1261 -0
- package/dist/disk-css.d.ts +4 -0
- package/dist/disk-css.js +104 -0
- package/dist/disk-css.mjs +65 -0
- package/dist/esbuild.d.ts +3 -0
- package/dist/esbuild.js +5 -0
- package/dist/esbuild.mjs +3 -0
- package/dist/farm.d.ts +3 -0
- package/dist/farm.js +111 -0
- package/dist/farm.mjs +76 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +38 -0
- package/dist/index.mjs +24 -0
- package/dist/rolldown.d.ts +3 -0
- package/dist/rolldown.js +5 -0
- package/dist/rolldown.mjs +3 -0
- package/dist/rollup.d.ts +3 -0
- package/dist/rollup.js +5 -0
- package/dist/rollup.mjs +3 -0
- package/dist/rspack.d.ts +3 -0
- package/dist/rspack.js +8 -0
- package/dist/rspack.mjs +6 -0
- package/dist/unloader.d.ts +3 -0
- package/dist/unloader.js +5 -0
- package/dist/unloader.mjs +3 -0
- package/dist/vite.d.ts +7 -0
- package/dist/vite.js +143 -0
- package/dist/vite.mjs +108 -0
- package/dist/webpack.d.ts +4 -0
- package/dist/webpack.js +167 -0
- package/dist/webpack.mjs +131 -0
- package/package.json +105 -0
- package/zero-virtual.css +1 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function resolveVirtualCssPath(): string;
|
|
2
|
+
export declare function ensureVirtualCssFile(virtualCssPath: string): void;
|
|
3
|
+
export declare function writeCssBlock(virtualCssPath: string, filePathKey: string, cssContent: string): void;
|
|
4
|
+
export declare function rewriteImportPath(sourceFilePath: string, virtualCssPath: string): string;
|
package/dist/disk-css.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.resolveVirtualCssPath = resolveVirtualCssPath;
|
|
37
|
+
exports.ensureVirtualCssFile = ensureVirtualCssFile;
|
|
38
|
+
exports.writeCssBlock = writeCssBlock;
|
|
39
|
+
exports.rewriteImportPath = rewriteImportPath;
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
const module_1 = require("module");
|
|
43
|
+
const VIRTUAL_CSS_FILENAME = 'zero-virtual.css';
|
|
44
|
+
let _cachedVirtualCssPath = null;
|
|
45
|
+
function resolveVirtualCssPath() {
|
|
46
|
+
if (_cachedVirtualCssPath)
|
|
47
|
+
return _cachedVirtualCssPath;
|
|
48
|
+
let packageRoot;
|
|
49
|
+
if (typeof __dirname !== 'undefined') {
|
|
50
|
+
packageRoot = path.resolve(__dirname, '..');
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
try {
|
|
54
|
+
const req = (0, module_1.createRequire)(process.cwd() + '/');
|
|
55
|
+
const entryPath = req.resolve('@plumeria/unplugin');
|
|
56
|
+
packageRoot = path.resolve(path.dirname(entryPath), '..');
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
packageRoot = process.cwd();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
_cachedVirtualCssPath = path.resolve(packageRoot, VIRTUAL_CSS_FILENAME);
|
|
63
|
+
return _cachedVirtualCssPath;
|
|
64
|
+
}
|
|
65
|
+
function ensureVirtualCssFile(virtualCssPath) {
|
|
66
|
+
if (!fs.existsSync(virtualCssPath)) {
|
|
67
|
+
fs.writeFileSync(virtualCssPath, '/** Placeholder file */\n', 'utf-8');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function writeCssBlock(virtualCssPath, filePathKey, cssContent) {
|
|
71
|
+
const startMarker = `/* ---start:${filePathKey} */`;
|
|
72
|
+
const endMarker = `/* ---end:${filePathKey} */`;
|
|
73
|
+
let currentCss = '';
|
|
74
|
+
try {
|
|
75
|
+
currentCss = fs.readFileSync(virtualCssPath, 'utf-8');
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
}
|
|
79
|
+
const cleanCss = cssContent.trim();
|
|
80
|
+
const newBlock = cleanCss ? `${startMarker}\n${cleanCss}\n${endMarker}` : '';
|
|
81
|
+
let nextCss = currentCss;
|
|
82
|
+
const startIndex = currentCss.indexOf(startMarker);
|
|
83
|
+
const endIndex = currentCss.indexOf(endMarker);
|
|
84
|
+
if (startIndex !== -1 && endIndex !== -1 && endIndex > startIndex) {
|
|
85
|
+
const before = currentCss.substring(0, startIndex);
|
|
86
|
+
const after = currentCss.substring(endIndex + endMarker.length);
|
|
87
|
+
nextCss = before + newBlock + after;
|
|
88
|
+
}
|
|
89
|
+
else if (newBlock) {
|
|
90
|
+
nextCss = currentCss + (currentCss.trim() ? '\n\n' : '') + newBlock;
|
|
91
|
+
}
|
|
92
|
+
nextCss = nextCss.replace(/\n{3,}/g, '\n\n').trim() + '\n';
|
|
93
|
+
if (currentCss !== nextCss) {
|
|
94
|
+
fs.writeFileSync(virtualCssPath, nextCss, 'utf-8');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function rewriteImportPath(sourceFilePath, virtualCssPath) {
|
|
98
|
+
let relativeImportPath = path.relative(path.dirname(sourceFilePath), virtualCssPath);
|
|
99
|
+
relativeImportPath = relativeImportPath.replace(/\\/g, '/');
|
|
100
|
+
if (!relativeImportPath.startsWith('.')) {
|
|
101
|
+
relativeImportPath = './' + relativeImportPath;
|
|
102
|
+
}
|
|
103
|
+
return relativeImportPath;
|
|
104
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { createRequire } from 'module';
|
|
4
|
+
const VIRTUAL_CSS_FILENAME = 'zero-virtual.css';
|
|
5
|
+
let _cachedVirtualCssPath = null;
|
|
6
|
+
export function resolveVirtualCssPath() {
|
|
7
|
+
if (_cachedVirtualCssPath)
|
|
8
|
+
return _cachedVirtualCssPath;
|
|
9
|
+
let packageRoot;
|
|
10
|
+
if (typeof __dirname !== 'undefined') {
|
|
11
|
+
packageRoot = path.resolve(__dirname, '..');
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
try {
|
|
15
|
+
const req = createRequire(process.cwd() + '/');
|
|
16
|
+
const entryPath = req.resolve('@plumeria/unplugin');
|
|
17
|
+
packageRoot = path.resolve(path.dirname(entryPath), '..');
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
packageRoot = process.cwd();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
_cachedVirtualCssPath = path.resolve(packageRoot, VIRTUAL_CSS_FILENAME);
|
|
24
|
+
return _cachedVirtualCssPath;
|
|
25
|
+
}
|
|
26
|
+
export function ensureVirtualCssFile(virtualCssPath) {
|
|
27
|
+
if (!fs.existsSync(virtualCssPath)) {
|
|
28
|
+
fs.writeFileSync(virtualCssPath, '/** Placeholder file */\n', 'utf-8');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function writeCssBlock(virtualCssPath, filePathKey, cssContent) {
|
|
32
|
+
const startMarker = `/* ---start:${filePathKey} */`;
|
|
33
|
+
const endMarker = `/* ---end:${filePathKey} */`;
|
|
34
|
+
let currentCss = '';
|
|
35
|
+
try {
|
|
36
|
+
currentCss = fs.readFileSync(virtualCssPath, 'utf-8');
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
}
|
|
40
|
+
const cleanCss = cssContent.trim();
|
|
41
|
+
const newBlock = cleanCss ? `${startMarker}\n${cleanCss}\n${endMarker}` : '';
|
|
42
|
+
let nextCss = currentCss;
|
|
43
|
+
const startIndex = currentCss.indexOf(startMarker);
|
|
44
|
+
const endIndex = currentCss.indexOf(endMarker);
|
|
45
|
+
if (startIndex !== -1 && endIndex !== -1 && endIndex > startIndex) {
|
|
46
|
+
const before = currentCss.substring(0, startIndex);
|
|
47
|
+
const after = currentCss.substring(endIndex + endMarker.length);
|
|
48
|
+
nextCss = before + newBlock + after;
|
|
49
|
+
}
|
|
50
|
+
else if (newBlock) {
|
|
51
|
+
nextCss = currentCss + (currentCss.trim() ? '\n\n' : '') + newBlock;
|
|
52
|
+
}
|
|
53
|
+
nextCss = nextCss.replace(/\n{3,}/g, '\n\n').trim() + '\n';
|
|
54
|
+
if (currentCss !== nextCss) {
|
|
55
|
+
fs.writeFileSync(virtualCssPath, nextCss, 'utf-8');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export function rewriteImportPath(sourceFilePath, virtualCssPath) {
|
|
59
|
+
let relativeImportPath = path.relative(path.dirname(sourceFilePath), virtualCssPath);
|
|
60
|
+
relativeImportPath = relativeImportPath.replace(/\\/g, '/');
|
|
61
|
+
if (!relativeImportPath.startsWith('.')) {
|
|
62
|
+
relativeImportPath = './' + relativeImportPath;
|
|
63
|
+
}
|
|
64
|
+
return relativeImportPath;
|
|
65
|
+
}
|
package/dist/esbuild.js
ADDED
package/dist/esbuild.mjs
ADDED
package/dist/farm.d.ts
ADDED
package/dist/farm.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const unplugin_1 = require("unplugin");
|
|
37
|
+
const core_1 = require("./core");
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const disk_css_1 = require("./disk-css");
|
|
40
|
+
function attachFarmHooks(plugin) {
|
|
41
|
+
const { targets } = plugin.__plumeriaInternal;
|
|
42
|
+
let isDev = false;
|
|
43
|
+
let farmRoot = process.cwd();
|
|
44
|
+
const virtualCssPath = (0, disk_css_1.resolveVirtualCssPath)();
|
|
45
|
+
const baseTransform = plugin.transform;
|
|
46
|
+
plugin.transform = async function (code, id) {
|
|
47
|
+
const result = await baseTransform.call(this, code, id);
|
|
48
|
+
if (isDev && result && typeof result === 'object' && result.code) {
|
|
49
|
+
const { cssLookup, cssFileLookup } = plugin.__plumeriaInternal;
|
|
50
|
+
result.code = result.code.replace(/import\s+["'](\/[^"']+\.zero\.css)["'];/g, (_match, cssPath) => {
|
|
51
|
+
const absolutePath = cssFileLookup.get(cssPath);
|
|
52
|
+
if (!absolutePath)
|
|
53
|
+
return _match;
|
|
54
|
+
const cssContent = cssLookup.get(absolutePath);
|
|
55
|
+
if (cssContent == null)
|
|
56
|
+
return _match;
|
|
57
|
+
(0, disk_css_1.ensureVirtualCssFile)(virtualCssPath);
|
|
58
|
+
const filePathKey = path
|
|
59
|
+
.relative(farmRoot, absolutePath)
|
|
60
|
+
.replace(/\\/g, '/');
|
|
61
|
+
(0, disk_css_1.writeCssBlock)(virtualCssPath, filePathKey, cssContent);
|
|
62
|
+
const importPath = (0, disk_css_1.rewriteImportPath)(id, virtualCssPath);
|
|
63
|
+
return `import "${importPath}";`;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
};
|
|
68
|
+
plugin.farm = {
|
|
69
|
+
config(config) {
|
|
70
|
+
if (plugin.__plumeriaInternal) {
|
|
71
|
+
if (config?.root) {
|
|
72
|
+
farmRoot = config.root;
|
|
73
|
+
plugin.__plumeriaInternal.setRoot(config.root);
|
|
74
|
+
}
|
|
75
|
+
isDev = config?.compilation?.mode !== 'production';
|
|
76
|
+
plugin.__plumeriaInternal.setDev(isDev);
|
|
77
|
+
}
|
|
78
|
+
return config;
|
|
79
|
+
},
|
|
80
|
+
configureCompiler(compiler) {
|
|
81
|
+
if (plugin.__plumeriaInternal) {
|
|
82
|
+
isDev = compiler.config?.compilation?.mode !== 'production';
|
|
83
|
+
plugin.__plumeriaInternal.setDev(isDev);
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
updateModules: {
|
|
87
|
+
executor(param) {
|
|
88
|
+
const modules = [];
|
|
89
|
+
for (const [file] of param.paths) {
|
|
90
|
+
if (!modules.includes(file)) {
|
|
91
|
+
modules.push(file);
|
|
92
|
+
}
|
|
93
|
+
if (!file.includes('node_modules') && core_1.EXTENSION_PATTERN.test(file)) {
|
|
94
|
+
for (const target of targets) {
|
|
95
|
+
if (target.id !== file && !modules.includes(target.id)) {
|
|
96
|
+
modules.push(target.id);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return modules;
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
return {
|
|
106
|
+
...plugin,
|
|
107
|
+
name: '@plumeria/unplugin:farm',
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
const farmPlugin = (0, unplugin_1.createFarmPlugin)((options, metaOptions) => attachFarmHooks((0, core_1.unpluginFactory)(options, metaOptions)));
|
|
111
|
+
exports.default = farmPlugin;
|
package/dist/farm.mjs
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { createFarmPlugin } from 'unplugin';
|
|
2
|
+
import { unpluginFactory, EXTENSION_PATTERN } from './core.mjs';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
import { resolveVirtualCssPath, ensureVirtualCssFile, writeCssBlock, rewriteImportPath, } from './disk-css.mjs';
|
|
5
|
+
function attachFarmHooks(plugin) {
|
|
6
|
+
const { targets } = plugin.__plumeriaInternal;
|
|
7
|
+
let isDev = false;
|
|
8
|
+
let farmRoot = process.cwd();
|
|
9
|
+
const virtualCssPath = resolveVirtualCssPath();
|
|
10
|
+
const baseTransform = plugin.transform;
|
|
11
|
+
plugin.transform = async function (code, id) {
|
|
12
|
+
const result = await baseTransform.call(this, code, id);
|
|
13
|
+
if (isDev && result && typeof result === 'object' && result.code) {
|
|
14
|
+
const { cssLookup, cssFileLookup } = plugin.__plumeriaInternal;
|
|
15
|
+
result.code = result.code.replace(/import\s+["'](\/[^"']+\.zero\.css)["'];/g, (_match, cssPath) => {
|
|
16
|
+
const absolutePath = cssFileLookup.get(cssPath);
|
|
17
|
+
if (!absolutePath)
|
|
18
|
+
return _match;
|
|
19
|
+
const cssContent = cssLookup.get(absolutePath);
|
|
20
|
+
if (cssContent == null)
|
|
21
|
+
return _match;
|
|
22
|
+
ensureVirtualCssFile(virtualCssPath);
|
|
23
|
+
const filePathKey = path
|
|
24
|
+
.relative(farmRoot, absolutePath)
|
|
25
|
+
.replace(/\\/g, '/');
|
|
26
|
+
writeCssBlock(virtualCssPath, filePathKey, cssContent);
|
|
27
|
+
const importPath = rewriteImportPath(id, virtualCssPath);
|
|
28
|
+
return `import "${importPath}";`;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
plugin.farm = {
|
|
34
|
+
config(config) {
|
|
35
|
+
if (plugin.__plumeriaInternal) {
|
|
36
|
+
if (config?.root) {
|
|
37
|
+
farmRoot = config.root;
|
|
38
|
+
plugin.__plumeriaInternal.setRoot(config.root);
|
|
39
|
+
}
|
|
40
|
+
isDev = config?.compilation?.mode !== 'production';
|
|
41
|
+
plugin.__plumeriaInternal.setDev(isDev);
|
|
42
|
+
}
|
|
43
|
+
return config;
|
|
44
|
+
},
|
|
45
|
+
configureCompiler(compiler) {
|
|
46
|
+
if (plugin.__plumeriaInternal) {
|
|
47
|
+
isDev = compiler.config?.compilation?.mode !== 'production';
|
|
48
|
+
plugin.__plumeriaInternal.setDev(isDev);
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
updateModules: {
|
|
52
|
+
executor(param) {
|
|
53
|
+
const modules = [];
|
|
54
|
+
for (const [file] of param.paths) {
|
|
55
|
+
if (!modules.includes(file)) {
|
|
56
|
+
modules.push(file);
|
|
57
|
+
}
|
|
58
|
+
if (!file.includes('node_modules') && EXTENSION_PATTERN.test(file)) {
|
|
59
|
+
for (const target of targets) {
|
|
60
|
+
if (target.id !== file && !modules.includes(target.id)) {
|
|
61
|
+
modules.push(target.id);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return modules;
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
...plugin,
|
|
72
|
+
name: '@plumeria/unplugin:farm',
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const farmPlugin = createFarmPlugin((options, metaOptions) => attachFarmHooks(unpluginFactory(options, metaOptions)));
|
|
76
|
+
export default farmPlugin;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import bun from './bun';
|
|
2
|
+
import esbuild from './esbuild';
|
|
3
|
+
import farm from './farm';
|
|
4
|
+
import rolldown from './rolldown';
|
|
5
|
+
import rollup from './rollup';
|
|
6
|
+
import rspack from './rspack';
|
|
7
|
+
import vite from './vite';
|
|
8
|
+
import webpack from './webpack';
|
|
9
|
+
import unloader from './unloader';
|
|
10
|
+
declare const plumeria: {
|
|
11
|
+
bun: (options?: import("./core").PluginOptions | undefined) => BunPlugin;
|
|
12
|
+
esbuild: (options?: import("./core").PluginOptions | undefined) => import("unplugin").EsbuildPlugin;
|
|
13
|
+
farm: (options?: import("./core").PluginOptions) => any;
|
|
14
|
+
rolldown: (options?: import("./core").PluginOptions | undefined) => import("unplugin").RolldownPlugin<any> | import("unplugin").RolldownPlugin<any>[];
|
|
15
|
+
rollup: (options?: import("./core").PluginOptions | undefined) => import("rollup").Plugin<any> | import("rollup").Plugin<any>[];
|
|
16
|
+
rspack: (options?: import("./core").PluginOptions | undefined) => import("unplugin").RspackPluginInstance;
|
|
17
|
+
unloader: (options?: import("./core").PluginOptions | undefined) => any;
|
|
18
|
+
vite: (options?: import("./vite").VitePluginOptions) => import("vite").Plugin;
|
|
19
|
+
webpack: (options?: import("./core").PluginOptions | undefined) => import("unplugin").WebpackPluginInstance;
|
|
20
|
+
raw: import("unplugin").UnpluginFactory<import("./core").PluginOptions | undefined>;
|
|
21
|
+
};
|
|
22
|
+
export { bun, esbuild, farm, rolldown, rollup, rspack, unloader, vite, webpack, };
|
|
23
|
+
export default plumeria;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.webpack = exports.vite = exports.unloader = exports.rspack = exports.rollup = exports.rolldown = exports.farm = exports.esbuild = exports.bun = void 0;
|
|
7
|
+
const core_1 = require("./core");
|
|
8
|
+
const bun_1 = __importDefault(require("./bun"));
|
|
9
|
+
exports.bun = bun_1.default;
|
|
10
|
+
const esbuild_1 = __importDefault(require("./esbuild"));
|
|
11
|
+
exports.esbuild = esbuild_1.default;
|
|
12
|
+
const farm_1 = __importDefault(require("./farm"));
|
|
13
|
+
exports.farm = farm_1.default;
|
|
14
|
+
const rolldown_1 = __importDefault(require("./rolldown"));
|
|
15
|
+
exports.rolldown = rolldown_1.default;
|
|
16
|
+
const rollup_1 = __importDefault(require("./rollup"));
|
|
17
|
+
exports.rollup = rollup_1.default;
|
|
18
|
+
const rspack_1 = __importDefault(require("./rspack"));
|
|
19
|
+
exports.rspack = rspack_1.default;
|
|
20
|
+
const vite_1 = __importDefault(require("./vite"));
|
|
21
|
+
exports.vite = vite_1.default;
|
|
22
|
+
const webpack_1 = __importDefault(require("./webpack"));
|
|
23
|
+
exports.webpack = webpack_1.default;
|
|
24
|
+
const unloader_1 = __importDefault(require("./unloader"));
|
|
25
|
+
exports.unloader = unloader_1.default;
|
|
26
|
+
const plumeria = {
|
|
27
|
+
bun: bun_1.default,
|
|
28
|
+
esbuild: esbuild_1.default,
|
|
29
|
+
farm: farm_1.default,
|
|
30
|
+
rolldown: rolldown_1.default,
|
|
31
|
+
rollup: rollup_1.default,
|
|
32
|
+
rspack: rspack_1.default,
|
|
33
|
+
unloader: unloader_1.default,
|
|
34
|
+
vite: vite_1.default,
|
|
35
|
+
webpack: webpack_1.default,
|
|
36
|
+
raw: core_1.unpluginFactory,
|
|
37
|
+
};
|
|
38
|
+
exports.default = plumeria;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { unpluginFactory } from './core.mjs';
|
|
2
|
+
import bun from './bun.mjs';
|
|
3
|
+
import esbuild from './esbuild.mjs';
|
|
4
|
+
import farm from './farm.mjs';
|
|
5
|
+
import rolldown from './rolldown.mjs';
|
|
6
|
+
import rollup from './rollup.mjs';
|
|
7
|
+
import rspack from './rspack.mjs';
|
|
8
|
+
import vite from './vite.mjs';
|
|
9
|
+
import webpack from './webpack.mjs';
|
|
10
|
+
import unloader from './unloader.mjs';
|
|
11
|
+
const plumeria = {
|
|
12
|
+
bun,
|
|
13
|
+
esbuild,
|
|
14
|
+
farm,
|
|
15
|
+
rolldown,
|
|
16
|
+
rollup,
|
|
17
|
+
rspack,
|
|
18
|
+
unloader,
|
|
19
|
+
vite,
|
|
20
|
+
webpack,
|
|
21
|
+
raw: unpluginFactory,
|
|
22
|
+
};
|
|
23
|
+
export { bun, esbuild, farm, rolldown, rollup, rspack, unloader, vite, webpack, };
|
|
24
|
+
export default plumeria;
|
package/dist/rolldown.js
ADDED
package/dist/rollup.d.ts
ADDED
package/dist/rollup.js
ADDED
package/dist/rollup.mjs
ADDED
package/dist/rspack.d.ts
ADDED
package/dist/rspack.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const unplugin_1 = require("unplugin");
|
|
4
|
+
const core_1 = require("./core");
|
|
5
|
+
const webpack_1 = require("./webpack");
|
|
6
|
+
exports.default = (0, unplugin_1.createRspackPlugin)((options, meta) => {
|
|
7
|
+
return (0, webpack_1.attachWebpackHooks)((0, core_1.unpluginFactory)(options, meta));
|
|
8
|
+
});
|
package/dist/rspack.mjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRspackPlugin } from 'unplugin';
|
|
2
|
+
import { unpluginFactory } from './core.mjs';
|
|
3
|
+
import { attachWebpackHooks } from './webpack.mjs';
|
|
4
|
+
export default createRspackPlugin((options, meta) => {
|
|
5
|
+
return attachWebpackHooks(unpluginFactory(options, meta));
|
|
6
|
+
});
|
package/dist/unloader.js
ADDED
package/dist/vite.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PluginOptions } from './core';
|
|
2
|
+
import type { Plugin } from 'vite';
|
|
3
|
+
export type VitePluginOptions = {
|
|
4
|
+
[K in keyof PluginOptions]: PluginOptions[K];
|
|
5
|
+
} & {};
|
|
6
|
+
declare const _default: (options?: VitePluginOptions) => Plugin;
|
|
7
|
+
export default _default;
|