@intlify/unplugin-vue-i18n 5.0.0-beta.3 → 5.0.0-beta.5
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 +47 -0
- package/lib/index.cjs +25 -8
- package/lib/index.d.cts +4 -3
- package/lib/index.d.mts +4 -3
- package/lib/index.d.ts +4 -3
- package/lib/index.mjs +25 -9
- package/lib/types.d.cts +1 -0
- package/lib/types.d.mts +1 -0
- package/lib/types.d.ts +1 -0
- package/lib/vite.cjs +2 -2
- package/lib/vite.d.cts +3 -3
- package/lib/vite.d.mts +3 -3
- package/lib/vite.d.ts +3 -3
- package/lib/vite.mjs +3 -3
- package/lib/webpack.cjs +2 -2
- package/lib/webpack.d.cts +3 -3
- package/lib/webpack.d.mts +3 -3
- package/lib/webpack.d.ts +3 -3
- package/lib/webpack.mjs +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -583,6 +583,53 @@ If do you will use this option, you need to enable `jitCompilation` option.
|
|
|
583
583
|
> [!WARNING]
|
|
584
584
|
About for manually signature, see the details [vue-i18n-extensions API docs](https://github.com/intlify/vue-i18n-extensions/blob/next/docs/%40intlify/vue-i18n-extensions-api.md#translationsignatures) and [usecase from vue-i18n-extensions PR](https://github.com/intlify/vue-i18n-extensions/pull/217/files#diff-3fb9543f91e011d4b0dc9beff44082fe1a99c9eab70c1afab23c3c34352b7c38R121-R200)
|
|
585
585
|
|
|
586
|
+
### `transformI18nBlock`
|
|
587
|
+
|
|
588
|
+
- **Type**: `function`
|
|
589
|
+
- **Default:** `undefined`
|
|
590
|
+
|
|
591
|
+
This hook allows a user to modify the `<i18n>` block before the plugin generates the translations. The hook is passed the source of the `<ii8n>` block as a `string` after the SFC is read from disk.
|
|
592
|
+
|
|
593
|
+
**Plugin**
|
|
594
|
+
```javascript
|
|
595
|
+
function transformI18nBlock(source) {
|
|
596
|
+
// transformation logic
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
// Plugin
|
|
600
|
+
vueI18n({
|
|
601
|
+
transformI18nBlock
|
|
602
|
+
})
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
**Before**
|
|
606
|
+
```html
|
|
607
|
+
<i18n>
|
|
608
|
+
[
|
|
609
|
+
'slug-one',
|
|
610
|
+
'slug-two'
|
|
611
|
+
]
|
|
612
|
+
<i18n>
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
**After**
|
|
616
|
+
```html
|
|
617
|
+
<i18n>
|
|
618
|
+
{
|
|
619
|
+
'en': {
|
|
620
|
+
'slug-one': 'foo',
|
|
621
|
+
'slug-two': 'bar'
|
|
622
|
+
},
|
|
623
|
+
ja: {
|
|
624
|
+
'slug-one': 'foo',
|
|
625
|
+
'slug-two': 'bar'
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
</i18n>
|
|
629
|
+
```
|
|
630
|
+
> [!IMPORTANT]
|
|
631
|
+
The function **must** return a string or the build will fail.
|
|
632
|
+
|
|
586
633
|
## 📜 Changelog
|
|
587
634
|
|
|
588
635
|
Details changes for each release are documented in the [CHANGELOG.md](https://github.com/intlify/bundle-tools/blob/main/packages/unplugin-vue-i18n/CHANGELOG.md)
|
package/lib/index.cjs
CHANGED
|
@@ -182,6 +182,7 @@ function resolveOptions(options, installedPkgInfo) {
|
|
|
182
182
|
const escapeHtml = !!options.escapeHtml;
|
|
183
183
|
const optimizeTranslationDirective = shared.isString(options.optimizeTranslationDirective) || shared.isArray(options.optimizeTranslationDirective) ? options.optimizeTranslationDirective : !!options.optimizeTranslationDirective;
|
|
184
184
|
const translationIdentifiers = /* @__PURE__ */ new Map();
|
|
185
|
+
const transformI18nBlock = typeof options.transformI18nBlock === "function" ? options.transformI18nBlock : null;
|
|
185
186
|
return {
|
|
186
187
|
include,
|
|
187
188
|
exclude,
|
|
@@ -198,7 +199,8 @@ function resolveOptions(options, installedPkgInfo) {
|
|
|
198
199
|
strictMessage,
|
|
199
200
|
escapeHtml,
|
|
200
201
|
optimizeTranslationDirective,
|
|
201
|
-
translationIdentifiers
|
|
202
|
+
translationIdentifiers,
|
|
203
|
+
transformI18nBlock
|
|
202
204
|
};
|
|
203
205
|
}
|
|
204
206
|
|
|
@@ -284,7 +286,8 @@ function resourcePlugin({
|
|
|
284
286
|
ssrBuild,
|
|
285
287
|
strictMessage,
|
|
286
288
|
allowDynamic,
|
|
287
|
-
escapeHtml
|
|
289
|
+
escapeHtml,
|
|
290
|
+
transformI18nBlock
|
|
288
291
|
}, meta, installedPkgInfo) {
|
|
289
292
|
const filter = pluginutils.createFilter(include, exclude);
|
|
290
293
|
const getVueI18nAliasPath = ({ ssr = false, runtimeOnly: runtimeOnly2 = false }) => {
|
|
@@ -566,7 +569,7 @@ function resourcePlugin({
|
|
|
566
569
|
}
|
|
567
570
|
);
|
|
568
571
|
debug$2("parseOptions", parseOptions);
|
|
569
|
-
|
|
572
|
+
let source = await getCode(
|
|
570
573
|
code,
|
|
571
574
|
filename,
|
|
572
575
|
sourceMap,
|
|
@@ -574,6 +577,14 @@ function resourcePlugin({
|
|
|
574
577
|
getSfcParser(),
|
|
575
578
|
meta.framework
|
|
576
579
|
);
|
|
580
|
+
if (typeof transformI18nBlock === "function") {
|
|
581
|
+
const modifiedSource = transformI18nBlock(source);
|
|
582
|
+
if (modifiedSource && typeof modifiedSource === "string") {
|
|
583
|
+
source = modifiedSource;
|
|
584
|
+
} else {
|
|
585
|
+
warn("transformI18nBlock should return a string");
|
|
586
|
+
}
|
|
587
|
+
}
|
|
577
588
|
const { code: generatedCode, map } = generate(source, parseOptions);
|
|
578
589
|
debug$2("generated code", generatedCode);
|
|
579
590
|
debug$2("sourcemap", map, sourceMap);
|
|
@@ -627,7 +638,8 @@ async function generateBundleResources(resources, isProduction, {
|
|
|
627
638
|
onlyLocales = [],
|
|
628
639
|
strictMessage = true,
|
|
629
640
|
escapeHtml = false,
|
|
630
|
-
jit = true
|
|
641
|
+
jit = true,
|
|
642
|
+
transformI18nBlock = void 0
|
|
631
643
|
}) {
|
|
632
644
|
const codes = [];
|
|
633
645
|
for (const res of resources) {
|
|
@@ -642,7 +654,8 @@ async function generateBundleResources(resources, isProduction, {
|
|
|
642
654
|
onlyLocales,
|
|
643
655
|
strictMessage,
|
|
644
656
|
escapeHtml,
|
|
645
|
-
forceStringify
|
|
657
|
+
forceStringify,
|
|
658
|
+
transformI18nBlock
|
|
646
659
|
});
|
|
647
660
|
parseOptions.type = "bare";
|
|
648
661
|
const { code } = generate(source, parseOptions);
|
|
@@ -714,7 +727,8 @@ function getOptions(filename, isProduction, query, sourceMap, {
|
|
|
714
727
|
allowDynamic = false,
|
|
715
728
|
strictMessage = true,
|
|
716
729
|
escapeHtml = false,
|
|
717
|
-
jit = true
|
|
730
|
+
jit = true,
|
|
731
|
+
transformI18nBlock = null
|
|
718
732
|
}) {
|
|
719
733
|
const mode = isProduction ? "production" : "development";
|
|
720
734
|
const baseOptions = {
|
|
@@ -728,6 +742,7 @@ function getOptions(filename, isProduction, query, sourceMap, {
|
|
|
728
742
|
jit,
|
|
729
743
|
onlyLocales,
|
|
730
744
|
env: mode,
|
|
745
|
+
transformI18nBlock,
|
|
731
746
|
onWarn: (msg) => {
|
|
732
747
|
warn(`${filename} ${msg}`);
|
|
733
748
|
},
|
|
@@ -1039,7 +1054,7 @@ function resolveIdentifier(localVariables, returnVariable) {
|
|
|
1039
1054
|
|
|
1040
1055
|
const debug = createDebug__default(resolveNamespace("root"));
|
|
1041
1056
|
const installedPkgInfo = checkInstallPackage(debug);
|
|
1042
|
-
const
|
|
1057
|
+
const unpluginFactory = (options = {}, meta) => {
|
|
1043
1058
|
debug("meta framework", meta.framework);
|
|
1044
1059
|
if (!["vite", "webpack"].includes(meta.framework)) {
|
|
1045
1060
|
raiseError(`This plugin is supported 'vite' and 'webpack' only`);
|
|
@@ -1058,7 +1073,9 @@ We are waiting for your Pull Request \u{1F642}.`
|
|
|
1058
1073
|
plugins.push(directivePlugin(resolvedOptions));
|
|
1059
1074
|
}
|
|
1060
1075
|
return plugins;
|
|
1061
|
-
}
|
|
1076
|
+
};
|
|
1077
|
+
const unplugin = /* @__PURE__ */ unplugin$1.createUnplugin(unpluginFactory);
|
|
1062
1078
|
|
|
1063
1079
|
exports.default = unplugin;
|
|
1064
1080
|
exports.unplugin = unplugin;
|
|
1081
|
+
exports.unpluginFactory = unpluginFactory;
|
package/lib/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { UnpluginFactory, UnpluginInstance } from 'unplugin';
|
|
2
2
|
import { PluginOptions } from './types.cjs';
|
|
3
3
|
export { SFCLangFormat } from './types.cjs';
|
|
4
4
|
|
|
5
|
-
declare const
|
|
5
|
+
declare const unpluginFactory: UnpluginFactory<PluginOptions | undefined>;
|
|
6
|
+
declare const unplugin: UnpluginInstance<PluginOptions | undefined, boolean>;
|
|
6
7
|
|
|
7
|
-
export { PluginOptions, unplugin as default, unplugin };
|
|
8
|
+
export { PluginOptions, unplugin as default, unplugin, unpluginFactory };
|
package/lib/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { UnpluginFactory, UnpluginInstance } from 'unplugin';
|
|
2
2
|
import { PluginOptions } from './types.mjs';
|
|
3
3
|
export { SFCLangFormat } from './types.mjs';
|
|
4
4
|
|
|
5
|
-
declare const
|
|
5
|
+
declare const unpluginFactory: UnpluginFactory<PluginOptions | undefined>;
|
|
6
|
+
declare const unplugin: UnpluginInstance<PluginOptions | undefined, boolean>;
|
|
6
7
|
|
|
7
|
-
export { PluginOptions, unplugin as default, unplugin };
|
|
8
|
+
export { PluginOptions, unplugin as default, unplugin, unpluginFactory };
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { UnpluginFactory, UnpluginInstance } from 'unplugin';
|
|
2
2
|
import { PluginOptions } from './types.js';
|
|
3
3
|
export { SFCLangFormat } from './types.js';
|
|
4
4
|
|
|
5
|
-
declare const
|
|
5
|
+
declare const unpluginFactory: UnpluginFactory<PluginOptions | undefined>;
|
|
6
|
+
declare const unplugin: UnpluginInstance<PluginOptions | undefined, boolean>;
|
|
6
7
|
|
|
7
|
-
export { PluginOptions, unplugin as default, unplugin };
|
|
8
|
+
export { PluginOptions, unplugin as default, unplugin, unpluginFactory };
|
package/lib/index.mjs
CHANGED
|
@@ -167,6 +167,7 @@ function resolveOptions(options, installedPkgInfo) {
|
|
|
167
167
|
const escapeHtml = !!options.escapeHtml;
|
|
168
168
|
const optimizeTranslationDirective = isString(options.optimizeTranslationDirective) || isArray(options.optimizeTranslationDirective) ? options.optimizeTranslationDirective : !!options.optimizeTranslationDirective;
|
|
169
169
|
const translationIdentifiers = /* @__PURE__ */ new Map();
|
|
170
|
+
const transformI18nBlock = typeof options.transformI18nBlock === "function" ? options.transformI18nBlock : null;
|
|
170
171
|
return {
|
|
171
172
|
include,
|
|
172
173
|
exclude,
|
|
@@ -183,7 +184,8 @@ function resolveOptions(options, installedPkgInfo) {
|
|
|
183
184
|
strictMessage,
|
|
184
185
|
escapeHtml,
|
|
185
186
|
optimizeTranslationDirective,
|
|
186
|
-
translationIdentifiers
|
|
187
|
+
translationIdentifiers,
|
|
188
|
+
transformI18nBlock
|
|
187
189
|
};
|
|
188
190
|
}
|
|
189
191
|
|
|
@@ -269,7 +271,8 @@ function resourcePlugin({
|
|
|
269
271
|
ssrBuild,
|
|
270
272
|
strictMessage,
|
|
271
273
|
allowDynamic,
|
|
272
|
-
escapeHtml
|
|
274
|
+
escapeHtml,
|
|
275
|
+
transformI18nBlock
|
|
273
276
|
}, meta, installedPkgInfo) {
|
|
274
277
|
const filter = createFilter(include, exclude);
|
|
275
278
|
const getVueI18nAliasPath = ({ ssr = false, runtimeOnly: runtimeOnly2 = false }) => {
|
|
@@ -551,7 +554,7 @@ function resourcePlugin({
|
|
|
551
554
|
}
|
|
552
555
|
);
|
|
553
556
|
debug$2("parseOptions", parseOptions);
|
|
554
|
-
|
|
557
|
+
let source = await getCode(
|
|
555
558
|
code,
|
|
556
559
|
filename,
|
|
557
560
|
sourceMap,
|
|
@@ -559,6 +562,14 @@ function resourcePlugin({
|
|
|
559
562
|
getSfcParser(),
|
|
560
563
|
meta.framework
|
|
561
564
|
);
|
|
565
|
+
if (typeof transformI18nBlock === "function") {
|
|
566
|
+
const modifiedSource = transformI18nBlock(source);
|
|
567
|
+
if (modifiedSource && typeof modifiedSource === "string") {
|
|
568
|
+
source = modifiedSource;
|
|
569
|
+
} else {
|
|
570
|
+
warn("transformI18nBlock should return a string");
|
|
571
|
+
}
|
|
572
|
+
}
|
|
562
573
|
const { code: generatedCode, map } = generate(source, parseOptions);
|
|
563
574
|
debug$2("generated code", generatedCode);
|
|
564
575
|
debug$2("sourcemap", map, sourceMap);
|
|
@@ -612,7 +623,8 @@ async function generateBundleResources(resources, isProduction, {
|
|
|
612
623
|
onlyLocales = [],
|
|
613
624
|
strictMessage = true,
|
|
614
625
|
escapeHtml = false,
|
|
615
|
-
jit = true
|
|
626
|
+
jit = true,
|
|
627
|
+
transformI18nBlock = void 0
|
|
616
628
|
}) {
|
|
617
629
|
const codes = [];
|
|
618
630
|
for (const res of resources) {
|
|
@@ -627,7 +639,8 @@ async function generateBundleResources(resources, isProduction, {
|
|
|
627
639
|
onlyLocales,
|
|
628
640
|
strictMessage,
|
|
629
641
|
escapeHtml,
|
|
630
|
-
forceStringify
|
|
642
|
+
forceStringify,
|
|
643
|
+
transformI18nBlock
|
|
631
644
|
});
|
|
632
645
|
parseOptions.type = "bare";
|
|
633
646
|
const { code } = generate(source, parseOptions);
|
|
@@ -699,7 +712,8 @@ function getOptions(filename, isProduction, query, sourceMap, {
|
|
|
699
712
|
allowDynamic = false,
|
|
700
713
|
strictMessage = true,
|
|
701
714
|
escapeHtml = false,
|
|
702
|
-
jit = true
|
|
715
|
+
jit = true,
|
|
716
|
+
transformI18nBlock = null
|
|
703
717
|
}) {
|
|
704
718
|
const mode = isProduction ? "production" : "development";
|
|
705
719
|
const baseOptions = {
|
|
@@ -713,6 +727,7 @@ function getOptions(filename, isProduction, query, sourceMap, {
|
|
|
713
727
|
jit,
|
|
714
728
|
onlyLocales,
|
|
715
729
|
env: mode,
|
|
730
|
+
transformI18nBlock,
|
|
716
731
|
onWarn: (msg) => {
|
|
717
732
|
warn(`${filename} ${msg}`);
|
|
718
733
|
},
|
|
@@ -1024,7 +1039,7 @@ function resolveIdentifier(localVariables, returnVariable) {
|
|
|
1024
1039
|
|
|
1025
1040
|
const debug = createDebug(resolveNamespace("root"));
|
|
1026
1041
|
const installedPkgInfo = checkInstallPackage(debug);
|
|
1027
|
-
const
|
|
1042
|
+
const unpluginFactory = (options = {}, meta) => {
|
|
1028
1043
|
debug("meta framework", meta.framework);
|
|
1029
1044
|
if (!["vite", "webpack"].includes(meta.framework)) {
|
|
1030
1045
|
raiseError(`This plugin is supported 'vite' and 'webpack' only`);
|
|
@@ -1043,6 +1058,7 @@ We are waiting for your Pull Request \u{1F642}.`
|
|
|
1043
1058
|
plugins.push(directivePlugin(resolvedOptions));
|
|
1044
1059
|
}
|
|
1045
1060
|
return plugins;
|
|
1046
|
-
}
|
|
1061
|
+
};
|
|
1062
|
+
const unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
|
|
1047
1063
|
|
|
1048
|
-
export { unplugin as default, unplugin };
|
|
1064
|
+
export { unplugin as default, unplugin, unpluginFactory };
|
package/lib/types.d.cts
CHANGED
package/lib/types.d.mts
CHANGED
package/lib/types.d.ts
CHANGED
package/lib/vite.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const unplugin = require('unplugin');
|
|
3
4
|
const index = require('./index.cjs');
|
|
4
|
-
require('unplugin');
|
|
5
5
|
require('debug');
|
|
6
6
|
require('picocolors');
|
|
7
7
|
require('node:path');
|
|
@@ -19,6 +19,6 @@ require('@typescript-eslint/scope-manager');
|
|
|
19
19
|
require('@typescript-eslint/typescript-estree');
|
|
20
20
|
require('@eslint-community/eslint-utils');
|
|
21
21
|
|
|
22
|
-
const vite = index.
|
|
22
|
+
const vite = unplugin.createVitePlugin(index.unpluginFactory);
|
|
23
23
|
|
|
24
24
|
module.exports = vite;
|
package/lib/vite.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { UnpluginInstance } from 'unplugin';
|
|
2
2
|
import { PluginOptions } from './types.cjs';
|
|
3
3
|
|
|
4
|
-
declare const
|
|
4
|
+
declare const vite: UnpluginInstance<PluginOptions | undefined, boolean>['vite'];
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { vite as default };
|
package/lib/vite.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { UnpluginInstance } from 'unplugin';
|
|
2
2
|
import { PluginOptions } from './types.mjs';
|
|
3
3
|
|
|
4
|
-
declare const
|
|
4
|
+
declare const vite: UnpluginInstance<PluginOptions | undefined, boolean>['vite'];
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { vite as default };
|
package/lib/vite.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { UnpluginInstance } from 'unplugin';
|
|
2
2
|
import { PluginOptions } from './types.js';
|
|
3
3
|
|
|
4
|
-
declare const
|
|
4
|
+
declare const vite: UnpluginInstance<PluginOptions | undefined, boolean>['vite'];
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { vite as default };
|
package/lib/vite.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '
|
|
1
|
+
import { createVitePlugin } from 'unplugin';
|
|
2
|
+
import { unpluginFactory } from './index.mjs';
|
|
3
3
|
import 'debug';
|
|
4
4
|
import 'picocolors';
|
|
5
5
|
import 'node:path';
|
|
@@ -17,6 +17,6 @@ import '@typescript-eslint/scope-manager';
|
|
|
17
17
|
import '@typescript-eslint/typescript-estree';
|
|
18
18
|
import '@eslint-community/eslint-utils';
|
|
19
19
|
|
|
20
|
-
const vite =
|
|
20
|
+
const vite = createVitePlugin(unpluginFactory);
|
|
21
21
|
|
|
22
22
|
export { vite as default };
|
package/lib/webpack.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const unplugin = require('unplugin');
|
|
3
4
|
const index = require('./index.cjs');
|
|
4
|
-
require('unplugin');
|
|
5
5
|
require('debug');
|
|
6
6
|
require('picocolors');
|
|
7
7
|
require('node:path');
|
|
@@ -19,6 +19,6 @@ require('@typescript-eslint/scope-manager');
|
|
|
19
19
|
require('@typescript-eslint/typescript-estree');
|
|
20
20
|
require('@eslint-community/eslint-utils');
|
|
21
21
|
|
|
22
|
-
const webpack = index.
|
|
22
|
+
const webpack = unplugin.createWebpackPlugin(index.unpluginFactory);
|
|
23
23
|
|
|
24
24
|
module.exports = webpack;
|
package/lib/webpack.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { UnpluginInstance } from 'unplugin';
|
|
2
2
|
import { PluginOptions } from './types.cjs';
|
|
3
3
|
|
|
4
|
-
declare const
|
|
4
|
+
declare const webpack: UnpluginInstance<PluginOptions | undefined, boolean>['webpack'];
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { webpack as default };
|
package/lib/webpack.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { UnpluginInstance } from 'unplugin';
|
|
2
2
|
import { PluginOptions } from './types.mjs';
|
|
3
3
|
|
|
4
|
-
declare const
|
|
4
|
+
declare const webpack: UnpluginInstance<PluginOptions | undefined, boolean>['webpack'];
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { webpack as default };
|
package/lib/webpack.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { UnpluginInstance } from 'unplugin';
|
|
2
2
|
import { PluginOptions } from './types.js';
|
|
3
3
|
|
|
4
|
-
declare const
|
|
4
|
+
declare const webpack: UnpluginInstance<PluginOptions | undefined, boolean>['webpack'];
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { webpack as default };
|
package/lib/webpack.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '
|
|
1
|
+
import { createWebpackPlugin } from 'unplugin';
|
|
2
|
+
import { unpluginFactory } from './index.mjs';
|
|
3
3
|
import 'debug';
|
|
4
4
|
import 'picocolors';
|
|
5
5
|
import 'node:path';
|
|
@@ -17,6 +17,6 @@ import '@typescript-eslint/scope-manager';
|
|
|
17
17
|
import '@typescript-eslint/typescript-estree';
|
|
18
18
|
import '@eslint-community/eslint-utils';
|
|
19
19
|
|
|
20
|
-
const webpack =
|
|
20
|
+
const webpack = createWebpackPlugin(unpluginFactory);
|
|
21
21
|
|
|
22
22
|
export { webpack as default };
|