|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
-
-
-
-
-
-
-
- var _chunk4PQK4PHQjs = require('./chunk-4PQK4PHQ.js');
-
- // src/index.ts
- var _unplugin = require('unplugin');
-
-
-
-
-
-
-
- var _common = require('@vue-macros/common');
- function resolveOption(options) {
- const root = options.root || process.cwd();
- const version = options.version || _common.detectVueVersion.call(void 0, root);
- return {
- include: [_common.REGEX_SRC_FILE],
- exclude: [_common.REGEX_SETUP_SFC, _common.REGEX_VUE_SUB, _common.REGEX_NODE_MODULES],
- ...options,
- root,
- version
- };
- }
- var name = "unplugin-vue-setup-component";
- var PrePlugin = _unplugin.createUnplugin.call(void 0,
- (userOptions = {}, meta) => {
- const options = resolveOption(userOptions);
- const filter = _common.createFilter.call(void 0, options);
- const setupComponentContext = {};
- return {
- name: `${name}-pre`,
- enforce: "pre",
- resolveId(id, importer) {
- if (_chunk4PQK4PHQjs.SETUP_COMPONENT_ID_REGEX.test(id))
- return id;
- if (["rollup", "vite"].includes(meta.framework) && importer && _chunk4PQK4PHQjs.isSubModule.call(void 0, importer)) {
- const mainModule = _chunk4PQK4PHQjs.getMainModule.call(void 0, importer, options.root);
- return this.resolve(id, mainModule, {
- skipSelf: true
- });
- }
- },
- loadInclude(id) {
- return _chunk4PQK4PHQjs.SETUP_COMPONENT_ID_REGEX.test(id);
- },
- load(id) {
- return _chunk4PQK4PHQjs.loadSetupComponent.call(void 0, id, setupComponentContext, options.root);
- },
- transformInclude(id) {
- return filter(id);
- },
- transform(code, id) {
- return _chunk4PQK4PHQjs.transformSetupComponent.call(void 0, code, id, setupComponentContext);
- },
- vite: {
- configResolved(config) {
- options.root = config.root;
- },
- handleHotUpdate: (ctx) => {
- if (filter(ctx.file)) {
- return _chunk4PQK4PHQjs.hotUpdateSetupComponent.call(void 0, ctx, setupComponentContext);
- }
- }
- }
- };
- }
- );
- var PostPlugin = _unplugin.createUnplugin.call(void 0, () => {
- return {
- name: `${name}-post`,
- enforce: "post",
- transformInclude(id) {
- return _chunk4PQK4PHQjs.isSubModule.call(void 0, id);
- },
- transform(code, id) {
- return _chunk4PQK4PHQjs.transformPost.call(void 0, code, id);
- },
- rollup: {
- transform: {
- order: "post",
- handler(code, id) {
- if (!_chunk4PQK4PHQjs.isSubModule.call(void 0, id))
- return;
- return _chunk4PQK4PHQjs.transformPost.call(void 0, code, id);
- }
- }
- }
- };
- });
- var plugin = _unplugin.createUnplugin.call(void 0,
- (options = {}, meta) => {
- return [PrePlugin.raw(options, meta), PostPlugin.raw(options, meta)];
- }
- );
- var src_default = plugin;
-
-
-
- exports.src_default = src_default;
|