@tdh-ui/unplugin-tdh-ui 1.0.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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/dist/esbuild.cjs +11 -0
  3. package/dist/esbuild.d.cts +24 -0
  4. package/dist/esbuild.d.mts +24 -0
  5. package/dist/esbuild.d.ts +24 -0
  6. package/dist/esbuild.mjs +9 -0
  7. package/dist/index.cjs +181 -0
  8. package/dist/index.d.cts +8 -0
  9. package/dist/index.d.mts +6 -0
  10. package/dist/index.d.ts +8 -0
  11. package/dist/index.mjs +175 -0
  12. package/dist/nuxt.cjs +24 -0
  13. package/dist/nuxt.d.cts +7 -0
  14. package/dist/nuxt.d.mts +7 -0
  15. package/dist/nuxt.d.ts +7 -0
  16. package/dist/nuxt.mjs +22 -0
  17. package/dist/rolldown.cjs +11 -0
  18. package/dist/rolldown.d.cts +26 -0
  19. package/dist/rolldown.d.mts +26 -0
  20. package/dist/rolldown.d.ts +26 -0
  21. package/dist/rolldown.mjs +9 -0
  22. package/dist/rollup.cjs +11 -0
  23. package/dist/rollup.d.cts +26 -0
  24. package/dist/rollup.d.mts +26 -0
  25. package/dist/rollup.d.ts +26 -0
  26. package/dist/rollup.mjs +9 -0
  27. package/dist/rspack.cjs +11 -0
  28. package/dist/rspack.d.cts +26 -0
  29. package/dist/rspack.d.mts +26 -0
  30. package/dist/rspack.d.ts +26 -0
  31. package/dist/rspack.mjs +9 -0
  32. package/dist/shared/unplugin-tdh-ui.DOTqVKKO.d.cts +27 -0
  33. package/dist/shared/unplugin-tdh-ui.DOTqVKKO.d.mts +27 -0
  34. package/dist/shared/unplugin-tdh-ui.DOTqVKKO.d.ts +27 -0
  35. package/dist/vite.cjs +11 -0
  36. package/dist/vite.d.cts +26 -0
  37. package/dist/vite.d.mts +26 -0
  38. package/dist/vite.d.ts +26 -0
  39. package/dist/vite.mjs +9 -0
  40. package/dist/webpack.cjs +11 -0
  41. package/dist/webpack.d.cts +26 -0
  42. package/dist/webpack.d.mts +26 -0
  43. package/dist/webpack.d.ts +26 -0
  44. package/dist/webpack.mjs +9 -0
  45. package/package.json +75 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020-PRESENT TDH Element Plus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index.cjs');
4
+ require('rolldown-string');
5
+ require('unplugin');
6
+ require('escape-string-regexp');
7
+ require('es-module-lexer');
8
+
9
+ const esbuild = index.esbuild;
10
+
11
+ module.exports = esbuild;
@@ -0,0 +1,24 @@
1
+ import unplugin from './index.cjs';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.cjs';
4
+
5
+ /**
6
+ * This entry file is for esbuild plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Esbuild plugin
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * import { build } from 'esbuild'
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/esbuild'
18
+ *
19
+ * build({ plugins: [TdhElementPlus()] })
20
+ ```
21
+ */
22
+ declare const esbuild: typeof unplugin.esbuild;
23
+
24
+ export = esbuild;
@@ -0,0 +1,24 @@
1
+ import unplugin from './index.mjs';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.mjs';
4
+
5
+ /**
6
+ * This entry file is for esbuild plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Esbuild plugin
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * import { build } from 'esbuild'
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/esbuild'
18
+ *
19
+ * build({ plugins: [TdhElementPlus()] })
20
+ ```
21
+ */
22
+ declare const esbuild: typeof unplugin.esbuild;
23
+
24
+ export { esbuild as default };
@@ -0,0 +1,24 @@
1
+ import unplugin from './index.js';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.js';
4
+
5
+ /**
6
+ * This entry file is for esbuild plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Esbuild plugin
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * import { build } from 'esbuild'
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/esbuild'
18
+ *
19
+ * build({ plugins: [TdhElementPlus()] })
20
+ ```
21
+ */
22
+ declare const esbuild: typeof unplugin.esbuild;
23
+
24
+ export = esbuild;
@@ -0,0 +1,9 @@
1
+ import unplugin from './index.mjs';
2
+ import 'rolldown-string';
3
+ import 'unplugin';
4
+ import 'escape-string-regexp';
5
+ import 'es-module-lexer';
6
+
7
+ const esbuild = unplugin.esbuild;
8
+
9
+ export { esbuild as default };
package/dist/index.cjs ADDED
@@ -0,0 +1,181 @@
1
+ 'use strict';
2
+
3
+ const rolldownString = require('rolldown-string');
4
+ const unplugin$1 = require('unplugin');
5
+ const escapeStringRegexp = require('escape-string-regexp');
6
+ const esModuleLexer = require('es-module-lexer');
7
+
8
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
9
+
10
+ const escapeStringRegexp__default = /*#__PURE__*/_interopDefaultCompat(escapeStringRegexp);
11
+
12
+ function getLocaleRE(options) {
13
+ return new RegExp(
14
+ `${escapeStringRegexp__default(`${options.lib}/`)}(es|lib)${escapeStringRegexp__default(
15
+ "/hooks/use-locale/index"
16
+ )}`
17
+ );
18
+ }
19
+ function transformDefaultLocale(source, id, options) {
20
+ if (!getLocaleRE(options).test(id)) return;
21
+ source.replaceAll("locale/lang/zh-cn", `locale/lang/${options.defaultLocale}`);
22
+ }
23
+ function getViteDepPlugin(options) {
24
+ const localeImporterRE = new RegExp(
25
+ `${escapeStringRegexp__default(
26
+ `node_modules/${options.lib}/`
27
+ )}(es|lib)${escapeStringRegexp__default("/hooks/use-locale/index")}`
28
+ );
29
+ const localePath = "/locale/lang/zh-cn";
30
+ const localePathFixed = `/locale/lang/${options.defaultLocale}`;
31
+ return {
32
+ name: "unplugin-tdh-ui:default-locale",
33
+ setup(build) {
34
+ build.onResolve(
35
+ {
36
+ filter: new RegExp(escapeStringRegexp__default(localePath)),
37
+ namespace: "file"
38
+ },
39
+ ({ path, importer, kind, resolveDir }) => {
40
+ if (localeImporterRE.test(importer))
41
+ return build.resolve(path.replace(localePath, localePathFixed), {
42
+ importer,
43
+ kind,
44
+ resolveDir
45
+ });
46
+ }
47
+ );
48
+ }
49
+ };
50
+ }
51
+
52
+ const hyphenateRE = /\B([A-Z])/g;
53
+ const hyphenate = (str) => str.replaceAll(hyphenateRE, "-$1").toLowerCase();
54
+ const formatMap = {
55
+ cjs: "lib",
56
+ esm: "es"
57
+ };
58
+ const multilineCommentsRE = /\/\*\s(.|[\n\r])*?\*\//g;
59
+ const singlelineCommentsRE = /\/\/\s.*/g;
60
+ function stripeComments(code) {
61
+ return code.replaceAll(multilineCommentsRE, "").replaceAll(singlelineCommentsRE, "");
62
+ }
63
+ function transformImportStyle(specifier, source, useSource = false, options) {
64
+ const { prefix, lib, format, ignoreComponents } = options;
65
+ const statement = stripeComments(source.slice(specifier.ss, specifier.se));
66
+ const leftBracket = statement.indexOf("{");
67
+ if (leftBracket !== -1) {
68
+ const identifiers = statement.slice(leftBracket + 1, statement.indexOf("}"));
69
+ const components = identifiers.split(",");
70
+ const styleImports = [];
71
+ components.forEach((c) => {
72
+ const trimmed = c.replace(/\sas\s.+/, "").trim();
73
+ if (trimmed.startsWith(prefix)) {
74
+ const component = trimmed.slice(prefix.length);
75
+ if (ignoreComponents.includes(component)) return;
76
+ if (useSource) {
77
+ styleImports.push(
78
+ `import '${lib}/${formatMap[format]}/components/${hyphenate(
79
+ component
80
+ )}/style/index'`
81
+ );
82
+ } else {
83
+ styleImports.push(
84
+ `import '${lib}/${formatMap[format]}/components/${hyphenate(
85
+ component
86
+ )}/style/css'`
87
+ );
88
+ }
89
+ }
90
+ });
91
+ return styleImports.join("\n");
92
+ }
93
+ }
94
+ async function transformStyle(s, options) {
95
+ const { useSource, lib, prefix, format, ignoreComponents } = options;
96
+ const source = s.toString();
97
+ if (!source) return;
98
+ await esModuleLexer.init;
99
+ const specifiers = esModuleLexer.parse(source)[0].filter(({ n }) => {
100
+ return n === lib || n === `${lib}/es/components` || n === `${lib}/lib/components`;
101
+ });
102
+ if (specifiers.length === 0) return;
103
+ const styleImports = specifiers.map((s2) => {
104
+ const ret = transformImportStyle(s2, source, useSource, {
105
+ lib,
106
+ prefix,
107
+ format,
108
+ ignoreComponents
109
+ });
110
+ return ret;
111
+ }).filter(Boolean).join("\n");
112
+ const lastSpecifier = specifiers.at(-1);
113
+ s.appendLeft(lastSpecifier.se + 1, `
114
+ ${styleImports}
115
+ `);
116
+ }
117
+
118
+ const defaultOptions = {
119
+ include: [
120
+ "**/*.vue",
121
+ "**/*.ts",
122
+ "**/*.js",
123
+ "**/*.tsx",
124
+ "**/*.jsx",
125
+ "**/*.vue?vue&type=script*",
126
+ /\.vue\.[tj]sx?\?vue/
127
+ ],
128
+ exclude: [/[/\\]node_modules[/\\]/, /[/\\]\.git[/\\]/, /[/\\]\.nuxt[/\\]/],
129
+ lib: "@tdh-ui/base",
130
+ ignoreComponents: [],
131
+ useSource: false,
132
+ defaultLocale: "",
133
+ format: "esm",
134
+ prefix: "El",
135
+ sourceMap: false
136
+ };
137
+ function toArray(thing) {
138
+ if (thing == null) return [];
139
+ return Array.isArray(thing) ? thing : [thing];
140
+ }
141
+ const unplugin = unplugin$1.createUnplugin(
142
+ (userOptions = {}) => {
143
+ const options = {
144
+ ...defaultOptions,
145
+ ...userOptions
146
+ };
147
+ return {
148
+ name: "unplugin-tdh-ui",
149
+ enforce: "post",
150
+ transform: {
151
+ filter: {
152
+ id: {
153
+ include: [getLocaleRE(options), ...toArray(options.include)],
154
+ exclude: options.exclude
155
+ }
156
+ },
157
+ handler: rolldownString.withMagicString((s, id) => {
158
+ if (options.defaultLocale) {
159
+ return transformDefaultLocale(s, id, options);
160
+ }
161
+ return transformStyle(s, options);
162
+ })
163
+ },
164
+ vite: {
165
+ config() {
166
+ if (options.defaultLocale) {
167
+ return {
168
+ optimizeDeps: {
169
+ esbuildOptions: {
170
+ plugins: [getViteDepPlugin(options)]
171
+ }
172
+ }
173
+ };
174
+ }
175
+ }
176
+ }
177
+ };
178
+ }
179
+ );
180
+
181
+ module.exports = unplugin;
@@ -0,0 +1,8 @@
1
+ import { UnpluginInstance } from 'unplugin';
2
+ import { O as Options } from './shared/unplugin-tdh-ui.DOTqVKKO.cjs';
3
+
4
+ declare const unplugin: UnpluginInstance<Partial<Options>, false>;
5
+
6
+ // @ts-ignore
7
+ export = unplugin;
8
+ export { Options };
@@ -0,0 +1,6 @@
1
+ import { UnpluginInstance } from 'unplugin';
2
+ import { O as Options } from './shared/unplugin-tdh-ui.DOTqVKKO.mjs';
3
+
4
+ declare const unplugin: UnpluginInstance<Partial<Options>, false>;
5
+
6
+ export { Options, unplugin as default };
@@ -0,0 +1,8 @@
1
+ import { UnpluginInstance } from 'unplugin';
2
+ import { O as Options } from './shared/unplugin-tdh-ui.DOTqVKKO.js';
3
+
4
+ declare const unplugin: UnpluginInstance<Partial<Options>, false>;
5
+
6
+ // @ts-ignore
7
+ export = unplugin;
8
+ export { Options };
package/dist/index.mjs ADDED
@@ -0,0 +1,175 @@
1
+ import { withMagicString } from 'rolldown-string';
2
+ import { createUnplugin } from 'unplugin';
3
+ import escapeStringRegexp from 'escape-string-regexp';
4
+ import { init, parse } from 'es-module-lexer';
5
+
6
+ function getLocaleRE(options) {
7
+ return new RegExp(
8
+ `${escapeStringRegexp(`${options.lib}/`)}(es|lib)${escapeStringRegexp(
9
+ "/hooks/use-locale/index"
10
+ )}`
11
+ );
12
+ }
13
+ function transformDefaultLocale(source, id, options) {
14
+ if (!getLocaleRE(options).test(id)) return;
15
+ source.replaceAll("locale/lang/zh-cn", `locale/lang/${options.defaultLocale}`);
16
+ }
17
+ function getViteDepPlugin(options) {
18
+ const localeImporterRE = new RegExp(
19
+ `${escapeStringRegexp(
20
+ `node_modules/${options.lib}/`
21
+ )}(es|lib)${escapeStringRegexp("/hooks/use-locale/index")}`
22
+ );
23
+ const localePath = "/locale/lang/zh-cn";
24
+ const localePathFixed = `/locale/lang/${options.defaultLocale}`;
25
+ return {
26
+ name: "unplugin-tdh-ui:default-locale",
27
+ setup(build) {
28
+ build.onResolve(
29
+ {
30
+ filter: new RegExp(escapeStringRegexp(localePath)),
31
+ namespace: "file"
32
+ },
33
+ ({ path, importer, kind, resolveDir }) => {
34
+ if (localeImporterRE.test(importer))
35
+ return build.resolve(path.replace(localePath, localePathFixed), {
36
+ importer,
37
+ kind,
38
+ resolveDir
39
+ });
40
+ }
41
+ );
42
+ }
43
+ };
44
+ }
45
+
46
+ const hyphenateRE = /\B([A-Z])/g;
47
+ const hyphenate = (str) => str.replaceAll(hyphenateRE, "-$1").toLowerCase();
48
+ const formatMap = {
49
+ cjs: "lib",
50
+ esm: "es"
51
+ };
52
+ const multilineCommentsRE = /\/\*\s(.|[\n\r])*?\*\//g;
53
+ const singlelineCommentsRE = /\/\/\s.*/g;
54
+ function stripeComments(code) {
55
+ return code.replaceAll(multilineCommentsRE, "").replaceAll(singlelineCommentsRE, "");
56
+ }
57
+ function transformImportStyle(specifier, source, useSource = false, options) {
58
+ const { prefix, lib, format, ignoreComponents } = options;
59
+ const statement = stripeComments(source.slice(specifier.ss, specifier.se));
60
+ const leftBracket = statement.indexOf("{");
61
+ if (leftBracket !== -1) {
62
+ const identifiers = statement.slice(leftBracket + 1, statement.indexOf("}"));
63
+ const components = identifiers.split(",");
64
+ const styleImports = [];
65
+ components.forEach((c) => {
66
+ const trimmed = c.replace(/\sas\s.+/, "").trim();
67
+ if (trimmed.startsWith(prefix)) {
68
+ const component = trimmed.slice(prefix.length);
69
+ if (ignoreComponents.includes(component)) return;
70
+ if (useSource) {
71
+ styleImports.push(
72
+ `import '${lib}/${formatMap[format]}/components/${hyphenate(
73
+ component
74
+ )}/style/index'`
75
+ );
76
+ } else {
77
+ styleImports.push(
78
+ `import '${lib}/${formatMap[format]}/components/${hyphenate(
79
+ component
80
+ )}/style/css'`
81
+ );
82
+ }
83
+ }
84
+ });
85
+ return styleImports.join("\n");
86
+ }
87
+ }
88
+ async function transformStyle(s, options) {
89
+ const { useSource, lib, prefix, format, ignoreComponents } = options;
90
+ const source = s.toString();
91
+ if (!source) return;
92
+ await init;
93
+ const specifiers = parse(source)[0].filter(({ n }) => {
94
+ return n === lib || n === `${lib}/es/components` || n === `${lib}/lib/components`;
95
+ });
96
+ if (specifiers.length === 0) return;
97
+ const styleImports = specifiers.map((s2) => {
98
+ const ret = transformImportStyle(s2, source, useSource, {
99
+ lib,
100
+ prefix,
101
+ format,
102
+ ignoreComponents
103
+ });
104
+ return ret;
105
+ }).filter(Boolean).join("\n");
106
+ const lastSpecifier = specifiers.at(-1);
107
+ s.appendLeft(lastSpecifier.se + 1, `
108
+ ${styleImports}
109
+ `);
110
+ }
111
+
112
+ const defaultOptions = {
113
+ include: [
114
+ "**/*.vue",
115
+ "**/*.ts",
116
+ "**/*.js",
117
+ "**/*.tsx",
118
+ "**/*.jsx",
119
+ "**/*.vue?vue&type=script*",
120
+ /\.vue\.[tj]sx?\?vue/
121
+ ],
122
+ exclude: [/[/\\]node_modules[/\\]/, /[/\\]\.git[/\\]/, /[/\\]\.nuxt[/\\]/],
123
+ lib: "@tdh-ui/base",
124
+ ignoreComponents: [],
125
+ useSource: false,
126
+ defaultLocale: "",
127
+ format: "esm",
128
+ prefix: "El",
129
+ sourceMap: false
130
+ };
131
+ function toArray(thing) {
132
+ if (thing == null) return [];
133
+ return Array.isArray(thing) ? thing : [thing];
134
+ }
135
+ const unplugin = createUnplugin(
136
+ (userOptions = {}) => {
137
+ const options = {
138
+ ...defaultOptions,
139
+ ...userOptions
140
+ };
141
+ return {
142
+ name: "unplugin-tdh-ui",
143
+ enforce: "post",
144
+ transform: {
145
+ filter: {
146
+ id: {
147
+ include: [getLocaleRE(options), ...toArray(options.include)],
148
+ exclude: options.exclude
149
+ }
150
+ },
151
+ handler: withMagicString((s, id) => {
152
+ if (options.defaultLocale) {
153
+ return transformDefaultLocale(s, id, options);
154
+ }
155
+ return transformStyle(s, options);
156
+ })
157
+ },
158
+ vite: {
159
+ config() {
160
+ if (options.defaultLocale) {
161
+ return {
162
+ optimizeDeps: {
163
+ esbuildOptions: {
164
+ plugins: [getViteDepPlugin(options)]
165
+ }
166
+ }
167
+ };
168
+ }
169
+ }
170
+ }
171
+ };
172
+ }
173
+ );
174
+
175
+ export { unplugin as default };
package/dist/nuxt.cjs ADDED
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ const kit = require('@nuxt/kit');
4
+ const index = require('./index.cjs');
5
+ require('rolldown-string');
6
+ require('unplugin');
7
+ require('escape-string-regexp');
8
+ require('es-module-lexer');
9
+
10
+ const module$1 = kit.defineNuxtModule({
11
+ meta: {
12
+ name: "unplugin-tdh-ui",
13
+ configKey: "elementPlus"
14
+ },
15
+ setup(options) {
16
+ kit.addBuildPlugin({
17
+ vite: () => index.vite(options),
18
+ webpack: () => index.webpack(options),
19
+ rspack: () => index.rspack(options)
20
+ });
21
+ }
22
+ });
23
+
24
+ module.exports = module$1;
@@ -0,0 +1,7 @@
1
+ import { O as Options } from './shared/unplugin-tdh-ui.DOTqVKKO.cjs';
2
+ import { NuxtModule } from '@nuxt/schema';
3
+ import 'unplugin';
4
+
5
+ declare const module$1: NuxtModule<Options, Options, false>;
6
+
7
+ export = module$1;
@@ -0,0 +1,7 @@
1
+ import { O as Options } from './shared/unplugin-tdh-ui.DOTqVKKO.mjs';
2
+ import { NuxtModule } from '@nuxt/schema';
3
+ import 'unplugin';
4
+
5
+ declare const module$1: NuxtModule<Options, Options, false>;
6
+
7
+ export { module$1 as default };
package/dist/nuxt.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { O as Options } from './shared/unplugin-tdh-ui.DOTqVKKO.js';
2
+ import { NuxtModule } from '@nuxt/schema';
3
+ import 'unplugin';
4
+
5
+ declare const module$1: NuxtModule<Options, Options, false>;
6
+
7
+ export = module$1;
package/dist/nuxt.mjs ADDED
@@ -0,0 +1,22 @@
1
+ import { defineNuxtModule, addBuildPlugin } from '@nuxt/kit';
2
+ import unplugin from './index.mjs';
3
+ import 'rolldown-string';
4
+ import 'unplugin';
5
+ import 'escape-string-regexp';
6
+ import 'es-module-lexer';
7
+
8
+ const module$1 = defineNuxtModule({
9
+ meta: {
10
+ name: "unplugin-tdh-ui",
11
+ configKey: "elementPlus"
12
+ },
13
+ setup(options) {
14
+ addBuildPlugin({
15
+ vite: () => unplugin.vite(options),
16
+ webpack: () => unplugin.webpack(options),
17
+ rspack: () => unplugin.rspack(options)
18
+ });
19
+ }
20
+ });
21
+
22
+ export { module$1 as default };
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index.cjs');
4
+ require('rolldown-string');
5
+ require('unplugin');
6
+ require('escape-string-regexp');
7
+ require('es-module-lexer');
8
+
9
+ const rolldown = index.rolldown;
10
+
11
+ module.exports = rolldown;
@@ -0,0 +1,26 @@
1
+ import unplugin from './index.cjs';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.cjs';
4
+
5
+ /**
6
+ * This entry file is for Rolldown plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Rolldown plugin
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // rolldown.config.js
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/rolldown'
18
+ *
19
+ * export default {
20
+ * plugins: [TdhElementPlus()],
21
+ * }
22
+ * ```
23
+ */
24
+ declare const rolldown: typeof unplugin.rolldown;
25
+
26
+ export = rolldown;
@@ -0,0 +1,26 @@
1
+ import unplugin from './index.mjs';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.mjs';
4
+
5
+ /**
6
+ * This entry file is for Rolldown plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Rolldown plugin
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // rolldown.config.js
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/rolldown'
18
+ *
19
+ * export default {
20
+ * plugins: [TdhElementPlus()],
21
+ * }
22
+ * ```
23
+ */
24
+ declare const rolldown: typeof unplugin.rolldown;
25
+
26
+ export { rolldown as default };
@@ -0,0 +1,26 @@
1
+ import unplugin from './index.js';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.js';
4
+
5
+ /**
6
+ * This entry file is for Rolldown plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Rolldown plugin
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // rolldown.config.js
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/rolldown'
18
+ *
19
+ * export default {
20
+ * plugins: [TdhElementPlus()],
21
+ * }
22
+ * ```
23
+ */
24
+ declare const rolldown: typeof unplugin.rolldown;
25
+
26
+ export = rolldown;
@@ -0,0 +1,9 @@
1
+ import unplugin from './index.mjs';
2
+ import 'rolldown-string';
3
+ import 'unplugin';
4
+ import 'escape-string-regexp';
5
+ import 'es-module-lexer';
6
+
7
+ const rolldown = unplugin.rolldown;
8
+
9
+ export { rolldown as default };
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index.cjs');
4
+ require('rolldown-string');
5
+ require('unplugin');
6
+ require('escape-string-regexp');
7
+ require('es-module-lexer');
8
+
9
+ const rollup = index.rollup;
10
+
11
+ module.exports = rollup;
@@ -0,0 +1,26 @@
1
+ import unplugin from './index.cjs';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.cjs';
4
+
5
+ /**
6
+ * This entry file is for Rollup plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Rollup plugin
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // rollup.config.js
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/rollup'
18
+ *
19
+ * export default {
20
+ * plugins: [TdhElementPlus()],
21
+ * }
22
+ * ```
23
+ */
24
+ declare const rollup: typeof unplugin.rollup;
25
+
26
+ export = rollup;
@@ -0,0 +1,26 @@
1
+ import unplugin from './index.mjs';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.mjs';
4
+
5
+ /**
6
+ * This entry file is for Rollup plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Rollup plugin
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // rollup.config.js
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/rollup'
18
+ *
19
+ * export default {
20
+ * plugins: [TdhElementPlus()],
21
+ * }
22
+ * ```
23
+ */
24
+ declare const rollup: typeof unplugin.rollup;
25
+
26
+ export { rollup as default };
@@ -0,0 +1,26 @@
1
+ import unplugin from './index.js';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.js';
4
+
5
+ /**
6
+ * This entry file is for Rollup plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Rollup plugin
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // rollup.config.js
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/rollup'
18
+ *
19
+ * export default {
20
+ * plugins: [TdhElementPlus()],
21
+ * }
22
+ * ```
23
+ */
24
+ declare const rollup: typeof unplugin.rollup;
25
+
26
+ export = rollup;
@@ -0,0 +1,9 @@
1
+ import unplugin from './index.mjs';
2
+ import 'rolldown-string';
3
+ import 'unplugin';
4
+ import 'escape-string-regexp';
5
+ import 'es-module-lexer';
6
+
7
+ const rollup = unplugin.rollup;
8
+
9
+ export { rollup as default };
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index.cjs');
4
+ require('rolldown-string');
5
+ require('unplugin');
6
+ require('escape-string-regexp');
7
+ require('es-module-lexer');
8
+
9
+ const rspack = index.rspack;
10
+
11
+ module.exports = rspack;
@@ -0,0 +1,26 @@
1
+ import unplugin from './index.cjs';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.cjs';
4
+
5
+ /**
6
+ * This entry file is for Rspack plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Rspack plugin
13
+ *
14
+ * @example
15
+ * ```js
16
+ * // rspack.config.js
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/rspack'
18
+ *
19
+ * default export {
20
+ * plugins: [TdhElementPlus()],
21
+ * }
22
+ * ```
23
+ */
24
+ declare const rspack: typeof unplugin.rspack;
25
+
26
+ export = rspack;
@@ -0,0 +1,26 @@
1
+ import unplugin from './index.mjs';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.mjs';
4
+
5
+ /**
6
+ * This entry file is for Rspack plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Rspack plugin
13
+ *
14
+ * @example
15
+ * ```js
16
+ * // rspack.config.js
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/rspack'
18
+ *
19
+ * default export {
20
+ * plugins: [TdhElementPlus()],
21
+ * }
22
+ * ```
23
+ */
24
+ declare const rspack: typeof unplugin.rspack;
25
+
26
+ export { rspack as default };
@@ -0,0 +1,26 @@
1
+ import unplugin from './index.js';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.js';
4
+
5
+ /**
6
+ * This entry file is for Rspack plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Rspack plugin
13
+ *
14
+ * @example
15
+ * ```js
16
+ * // rspack.config.js
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/rspack'
18
+ *
19
+ * default export {
20
+ * plugins: [TdhElementPlus()],
21
+ * }
22
+ * ```
23
+ */
24
+ declare const rspack: typeof unplugin.rspack;
25
+
26
+ export = rspack;
@@ -0,0 +1,9 @@
1
+ import unplugin from './index.mjs';
2
+ import 'rolldown-string';
3
+ import 'unplugin';
4
+ import 'escape-string-regexp';
5
+ import 'es-module-lexer';
6
+
7
+ const rspack = unplugin.rspack;
8
+
9
+ export { rspack as default };
@@ -0,0 +1,27 @@
1
+ import { FilterPattern } from 'unplugin';
2
+
3
+ type Options = {
4
+ /**
5
+ * RegExp or glob to match files to be transformed
6
+ */
7
+ include: FilterPattern;
8
+ /**
9
+ * RegExp or glob to match files to NOT be transformed
10
+ */
11
+ exclude: FilterPattern;
12
+ useSource: boolean;
13
+ /** replace default locale */
14
+ defaultLocale: string;
15
+ /**
16
+ * Array of component names that will not be transformed.
17
+ * Can be useful for components that do not have an associated style file.
18
+ * Do not include the prefix in the name.
19
+ */
20
+ ignoreComponents: string[];
21
+ lib: string;
22
+ prefix: string;
23
+ format: 'cjs' | 'esm';
24
+ sourceMap: boolean;
25
+ };
26
+
27
+ export type { Options as O };
@@ -0,0 +1,27 @@
1
+ import { FilterPattern } from 'unplugin';
2
+
3
+ type Options = {
4
+ /**
5
+ * RegExp or glob to match files to be transformed
6
+ */
7
+ include: FilterPattern;
8
+ /**
9
+ * RegExp or glob to match files to NOT be transformed
10
+ */
11
+ exclude: FilterPattern;
12
+ useSource: boolean;
13
+ /** replace default locale */
14
+ defaultLocale: string;
15
+ /**
16
+ * Array of component names that will not be transformed.
17
+ * Can be useful for components that do not have an associated style file.
18
+ * Do not include the prefix in the name.
19
+ */
20
+ ignoreComponents: string[];
21
+ lib: string;
22
+ prefix: string;
23
+ format: 'cjs' | 'esm';
24
+ sourceMap: boolean;
25
+ };
26
+
27
+ export type { Options as O };
@@ -0,0 +1,27 @@
1
+ import { FilterPattern } from 'unplugin';
2
+
3
+ type Options = {
4
+ /**
5
+ * RegExp or glob to match files to be transformed
6
+ */
7
+ include: FilterPattern;
8
+ /**
9
+ * RegExp or glob to match files to NOT be transformed
10
+ */
11
+ exclude: FilterPattern;
12
+ useSource: boolean;
13
+ /** replace default locale */
14
+ defaultLocale: string;
15
+ /**
16
+ * Array of component names that will not be transformed.
17
+ * Can be useful for components that do not have an associated style file.
18
+ * Do not include the prefix in the name.
19
+ */
20
+ ignoreComponents: string[];
21
+ lib: string;
22
+ prefix: string;
23
+ format: 'cjs' | 'esm';
24
+ sourceMap: boolean;
25
+ };
26
+
27
+ export type { Options as O };
package/dist/vite.cjs ADDED
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index.cjs');
4
+ require('rolldown-string');
5
+ require('unplugin');
6
+ require('escape-string-regexp');
7
+ require('es-module-lexer');
8
+
9
+ const vite = index.vite;
10
+
11
+ module.exports = vite;
@@ -0,0 +1,26 @@
1
+ import unplugin from './index.cjs';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.cjs';
4
+
5
+ /**
6
+ * This entry file is for Vite plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Vite plugin
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // vite.config.ts
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/vite'
18
+ *
19
+ * export default defineConfig({
20
+ * plugins: [TdhElementPlus()],
21
+ * })
22
+ * ```
23
+ */
24
+ declare const vite: typeof unplugin.vite;
25
+
26
+ export = vite;
@@ -0,0 +1,26 @@
1
+ import unplugin from './index.mjs';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.mjs';
4
+
5
+ /**
6
+ * This entry file is for Vite plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Vite plugin
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // vite.config.ts
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/vite'
18
+ *
19
+ * export default defineConfig({
20
+ * plugins: [TdhElementPlus()],
21
+ * })
22
+ * ```
23
+ */
24
+ declare const vite: typeof unplugin.vite;
25
+
26
+ export { vite as default };
package/dist/vite.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ import unplugin from './index.js';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.js';
4
+
5
+ /**
6
+ * This entry file is for Vite plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Vite plugin
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // vite.config.ts
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/vite'
18
+ *
19
+ * export default defineConfig({
20
+ * plugins: [TdhElementPlus()],
21
+ * })
22
+ * ```
23
+ */
24
+ declare const vite: typeof unplugin.vite;
25
+
26
+ export = vite;
package/dist/vite.mjs ADDED
@@ -0,0 +1,9 @@
1
+ import unplugin from './index.mjs';
2
+ import 'rolldown-string';
3
+ import 'unplugin';
4
+ import 'escape-string-regexp';
5
+ import 'es-module-lexer';
6
+
7
+ const vite = unplugin.vite;
8
+
9
+ export { vite as default };
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index.cjs');
4
+ require('rolldown-string');
5
+ require('unplugin');
6
+ require('escape-string-regexp');
7
+ require('es-module-lexer');
8
+
9
+ const webpack = index.webpack;
10
+
11
+ module.exports = webpack;
@@ -0,0 +1,26 @@
1
+ import unplugin from './index.cjs';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.cjs';
4
+
5
+ /**
6
+ * This entry file is for webpack plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Webpack plugin
13
+ *
14
+ * @example
15
+ * ```js
16
+ * // webpack.config.js
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/webpack'
18
+ *
19
+ * module.exports = {
20
+ * plugins: [TdhElementPlus()],
21
+ * }
22
+ * ```
23
+ */
24
+ declare const webpack: typeof unplugin.webpack;
25
+
26
+ export = webpack;
@@ -0,0 +1,26 @@
1
+ import unplugin from './index.mjs';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.mjs';
4
+
5
+ /**
6
+ * This entry file is for webpack plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Webpack plugin
13
+ *
14
+ * @example
15
+ * ```js
16
+ * // webpack.config.js
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/webpack'
18
+ *
19
+ * module.exports = {
20
+ * plugins: [TdhElementPlus()],
21
+ * }
22
+ * ```
23
+ */
24
+ declare const webpack: typeof unplugin.webpack;
25
+
26
+ export { webpack as default };
@@ -0,0 +1,26 @@
1
+ import unplugin from './index.js';
2
+ import 'unplugin';
3
+ import './shared/unplugin-tdh-ui.DOTqVKKO.js';
4
+
5
+ /**
6
+ * This entry file is for webpack plugin.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Webpack plugin
13
+ *
14
+ * @example
15
+ * ```js
16
+ * // webpack.config.js
17
+ * import TdhElementPlus from 'unplugin-tdh-ui/webpack'
18
+ *
19
+ * module.exports = {
20
+ * plugins: [TdhElementPlus()],
21
+ * }
22
+ * ```
23
+ */
24
+ declare const webpack: typeof unplugin.webpack;
25
+
26
+ export = webpack;
@@ -0,0 +1,9 @@
1
+ import unplugin from './index.mjs';
2
+ import 'rolldown-string';
3
+ import 'unplugin';
4
+ import 'escape-string-regexp';
5
+ import 'es-module-lexer';
6
+
7
+ const webpack = unplugin.webpack;
8
+
9
+ export { webpack as default };
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@tdh-ui/unplugin-tdh-ui",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "description": "Import Element Plus on demand. Support Vite, Webpack, Vue CLI, Rollup and esbuild.",
6
+ "license": "MIT",
7
+ "homepage": "",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": ""
11
+ },
12
+ "bugs": {
13
+ "url": ""
14
+ },
15
+ "keywords": [
16
+ "element-plus",
17
+ "unplugin",
18
+ "vite",
19
+ "webpack",
20
+ "rollup",
21
+ "esbuild",
22
+ "plugin"
23
+ ],
24
+ "main": "./dist/index.cjs",
25
+ "module": "./dist/index.mjs",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": "./dist/index.mjs",
29
+ "./esbuild": "./dist/esbuild.mjs",
30
+ "./nuxt": "./dist/nuxt.mjs",
31
+ "./rolldown": "./dist/rolldown.mjs",
32
+ "./rollup": "./dist/rollup.mjs",
33
+ "./rspack": "./dist/rspack.mjs",
34
+ "./vite": "./dist/vite.mjs",
35
+ "./webpack": "./dist/webpack.mjs",
36
+ "./package.json": "./package.json"
37
+ },
38
+ "typesVersions": {
39
+ "*": {
40
+ "*": [
41
+ "./dist/*",
42
+ "./*"
43
+ ]
44
+ }
45
+ },
46
+ "files": [
47
+ "dist"
48
+ ],
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "engines": {
53
+ "node": ">=20.19.0"
54
+ },
55
+ "dependencies": {
56
+ "@nuxt/kit": "^4.2.2",
57
+ "es-module-lexer": "^2.0.0",
58
+ "escape-string-regexp": "^5.0.0",
59
+ "rolldown-string": "^0.2.1",
60
+ "unplugin": "^3.0.0"
61
+ },
62
+ "devDependencies": {
63
+ "@nuxt/schema": "^4.2.2",
64
+ "@types/node": "^25.0.9",
65
+ "esbuild": "~0.27.2",
66
+ "unbuild": "^3.0.0",
67
+ "vite": "^8.0.0"
68
+ },
69
+ "scripts": {
70
+ "build": "unbuild",
71
+ "stub": "unbuild --stub",
72
+ "typecheck": "tsc --noEmit",
73
+ "clean:modules": "rimraf node_modules"
74
+ }
75
+ }