├── .gitignore
├── CHANGELOG.md
├── README.md
├── README.zh-CN.md
├── build.mjs
├── index.ts
├── package.json
├── presets
├── .gitignore
├── ant-design-vue-v1.js
├── ant-design-vue-v3.js
├── ant-design-vue-v4.js
├── antd-v4.js
├── axios-v0.js
├── axios-v1.js
├── element-plus-v2.js
├── element-ui-v2.js
├── index.d.ts
├── index.js
├── index.js.snap
├── pinia-v2.js
├── react-dom-v17.js
├── react-dom-v18.js
├── react-router-dom-v5.js
├── react-router-dom-v6.js
├── react-router-v5.js
├── react-router-v6.js
├── react-v17.js
├── react-v18.js
├── redux-v5.js
├── vue-composition-api-v1.js
├── vue-demi-v2.7.js
├── vue-demi-v2.js
├── vue-demi-v3.js
├── vue-router-v3.js
├── vue-router-v4.js
├── vue-v2.js
├── vue-v2_7.js
├── vue-v3.js
├── vuex-v3.js
└── vuex-v4.js
├── test
├── -.js
├── .gitignore
└── index.mjs
├── tsconfig.json
└── vite.config.ts
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | lerna-debug.log*
8 |
9 | # Diagnostic reports (https://nodejs.org/api/report.html)
10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11 |
12 | # Runtime data
13 | pids
14 | *.pid
15 | *.seed
16 | *.pid.lock
17 |
18 | # Directory for instrumented libs generated by jscoverage/JSCover
19 | lib-cov
20 |
21 | # Coverage directory used by tools like istanbul
22 | coverage
23 | *.lcov
24 |
25 | # nyc test coverage
26 | .nyc_output
27 |
28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29 | .grunt
30 |
31 | # Bower dependency directory (https://bower.io/)
32 | bower_components
33 |
34 | # node-waf configuration
35 | .lock-wscript
36 |
37 | # Compiled binary addons (https://nodejs.org/api/addons.html)
38 | build/Release
39 |
40 | # Dependency directories
41 | node_modules/
42 | jspm_packages/
43 |
44 | # TypeScript v1 declaration files
45 | typings/
46 |
47 | # TypeScript cache
48 | *.tsbuildinfo
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Microbundle cache
57 | .rpt2_cache/
58 | .rts2_cache_cjs/
59 | .rts2_cache_es/
60 | .rts2_cache_umd/
61 |
62 | # Optional REPL history
63 | .node_repl_history
64 |
65 | # Output of 'npm pack'
66 | *.tgz
67 |
68 | # Yarn Integrity file
69 | .yarn-integrity
70 |
71 | # dotenv environment variables file
72 | .env
73 | .env.test
74 |
75 | # parcel-bundler cache (https://parceljs.org/)
76 | .cache
77 |
78 | # Next.js build output
79 | .next
80 |
81 | # Nuxt.js build / generate output
82 | .nuxt
83 | dist
84 |
85 | # Gatsby files
86 | .cache/
87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js
88 | # https://nextjs.org/blog/next-9-1#public-directory-support
89 | # public
90 |
91 | # vuepress build output
92 | .vuepress/dist
93 |
94 | # Serverless directories
95 | .serverless/
96 |
97 | # FuseBox cache
98 | .fusebox/
99 |
100 | # DynamoDB Local files
101 | .dynamodb/
102 |
103 | # TernJS port file
104 | .tern-port
105 |
106 | .DS_Store
107 |
108 | package-lock.json
109 | pnpm-lock.yaml
110 | yarn.lock
111 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 2.5.2 (2024-07-22)
2 |
3 | - fa800da fix: export `vue.v2_7`
4 | - dc286e6 feat(presets): add axios-v0, vue-router-v3
5 |
6 | ## 2.5.1 (2023-10-15)
7 |
8 | - 07d1aa5 feat: support . version
9 | - b537af7 feat(presets): add vue-demi
10 | - e976aaa feat(presets): add axios
11 | - 7652297 chore: bump lib-esm from 0.3.0 to 0.4.1
12 | - ffb3e46 chore: cleanup
13 | - 64a7ab8 Merge pull request #13 from shiqifriend/refactor/jsToTs
14 | - 9dac95d fix: Fix typescript's type issue
15 | - 8fb9189 fix: Fix the issue with package.json
16 | - 7dd3076 fix: Fix the issue with package.json
17 | - 1f65ab8 Merge branch 'main' into refactor/jsToTs
18 | - 22cc053 refactor: Revoking modifications to presets
19 |
20 | ## 2.4.1 (2023-09-07)
21 |
22 | - 42cd576 feat: add vue@2.7
23 | - 640eccd chore: format
24 | - aee0c9a fix: antd-design-vue-v3
25 |
26 | ## 2.4.0 (2023-08-21)
27 |
28 | - d28bff8 chore: cleanup types
29 | - 547aba1 fix(preset): export `lib.members`
30 | - b6012eb typo: Correct spelling mistakes
31 | - f55207d typo: Correct spelling mistakes
32 | - b463f79 fix: Supplement the 'peerDependencies' field in package.json
33 | - d778ffc docs: update
34 |
35 | ## 2.3.0 (2022-10-19)
36 |
37 | - 6a3e7d7 v2.3.0
38 | - 5c06383 docs: v2.3.0
39 | - eed477d feat(test): improve test 🌱
40 | - 6d3ff68 chore(deps): bump lib-esm to 0.3.0
41 | - fa0313f refactor(2.3.0): remove `lib2esm()`
42 |
43 | ## 2.2.2 (2022-10-18)
44 |
45 | - ca4ab26 v2.2.2
46 | - e007d1b docs: v2.2.2
47 | - 3ef04a8 feat: better type define 🌱
48 | - 29f6370 refactor: use lib-esm@0.2.0
49 | - d193b61 chore: bump lib-esm to 0.2.0
50 |
51 | ## 2.2.1 (2022-10-15)
52 |
53 | - 6bfc750 v2.2.1
54 | - 62cf993 `lib-esm-snippet` -> `lib-esm`
55 |
56 | ## 2.2.0 (2022-10-15)
57 |
58 | - 8537ff7 v0.2.0
59 | - ebb0fd3 feat: add test/__snapshots__
60 | - dca3cb9 refactor: use lib-esm-snippet
61 | - 852fff0 chore(deps): add lib-esm-snippet
62 |
63 | ## 2.1.4-2.1.7 (2022-10-14)
64 |
65 | 🐞 fix `npm publish` missing files
66 |
67 | - 3455c70 v2.1.4-v2.1.7
68 | - e8b8f65 chore: format
69 | - 0ad609f chore: update type
70 |
71 | ## 2.1.3 (2022-10-14)
72 |
73 | - 5c46403 v2.1.3
74 | - 03543b4 feat: support `type: "module"` 🌱
75 | - 1f2e209 feat: build `.mjs` 🚀
76 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # vite-plugin-resolve
2 |
3 | Custom resolve module content
4 |
5 | [](https://npmjs.org/package/vite-plugin-resolve)
6 | [](https://npmjs.org/package/vite-plugin-resolve)
7 | [](https://github.com/vitejs/awesome-vite)
8 |
9 | **English | [简体中文](https://github.com/vite-plugin/vite-plugin-resolve/blob/main/README.zh-CN.md)**
10 |
11 | - 🤔 You can think of this as the implementation of the official tutorial 👉 [Virtual Modules Convention](https://vitejs.dev/guide/api-plugin.html#virtual-modules-convention)
12 | - 🌱 What you see is what you get
13 | - 📦 Out of the box (builtin Vue, React, Antd, Element and others)
14 | - 🚀 Browser, Node.js, Electron
15 |
16 | ## Install
17 |
18 | ```bash
19 | npm i vite-plugin-resolve -D
20 | ```
21 |
22 | ## Usage
23 |
24 | You can load any code snippets you want **(ESM format)**
25 |
26 | ```ts
27 | import resolve from 'vite-plugin-resolve'
28 |
29 | export default {
30 | plugins: [
31 | resolve({
32 | // Browser
33 | vue: `
34 | const vue = window.Vue;
35 | const version = vue.version;
36 | export {
37 | vue as default,
38 | version,
39 | }
40 | `,
41 | // Node.js, Electron
42 | electron: `
43 | const { ipcRenderer, shell } = require('electron');
44 | export {
45 | ipcRenderer,
46 | shell,
47 | }
48 | `,
49 | }),
50 | ]
51 | }
52 |
53 | // Use in your app
54 | import Vue, { version } from 'vue'
55 | import { ipcRenderer, shell } from 'electron'
56 |
57 | // Make sure that index.html has introduced the CDN file.
58 | // e.g.
59 | //
60 | ```
61 |
62 | Use with [lib-esm](https://www.npmjs.com/package/lib-esm)
63 |
64 | ```sh
65 | npm i lib-esm
66 | ```
67 |
68 | ```js
69 | import resolve from 'vite-plugin-resolve'
70 | import libEsm from 'lib-esm'
71 |
72 | export default {
73 | plugins: [
74 | resolve({
75 | // Let's use lodash as an example
76 | lodash: () => {
77 | const snippets = libEsm({
78 | // lodash iife name
79 | window: '_',
80 | // export memebers
81 | exports: [
82 | 'chunk',
83 | 'curry',
84 | 'debounce',
85 | 'throttle',
86 | ],
87 | })
88 | return `${snippets.window}\n${snippets.exports}`
89 | },
90 | }),
91 | ],
92 | }
93 |
94 | // Use in your app
95 | import _, { chunk, curry, debounce, throttle } from 'lodash'
96 | ```
97 |
98 | **Use in Electron** 👉 [electron-vite-vue](https://github.com/electron-vite/electron-vite-vue/blob/main/packages/renderer/vite.config.ts)
99 |
100 | ## Builtin modules
101 |
102 | This like Vite external plugin
103 |
104 | ```js
105 | import resolve from 'vite-plugin-resolve'
106 | import {
107 | ant_design_vue,
108 | antd,
109 | axios,
110 | element_plus,
111 | element_ui,
112 | pinia,
113 | react_dom,
114 | react_router_dom,
115 | react_router,
116 | react,
117 | redux,
118 | vue_composition_api,
119 | vue_demi,
120 | vue_router,
121 | vue,
122 | vuex,
123 | } from 'vite-plugin-resolve/presets'
124 |
125 | export default {
126 | plugins: [
127 | resolve({
128 | // e.g.
129 | // external-lib: lib-name.version
130 | vue: vue.v3,
131 | react: react.v18,
132 | }),
133 | ]
134 | }
135 |
136 | // Use in your app
137 | import Vue, { ref, reactive, computed, watch } from 'vue'
138 | import React, { useState, useEffect } from 'react'
139 | ```
140 |
141 | ## API (Define)
142 |
143 | `resolve(entries)`
144 |
145 | ```ts
146 | function resolve(entries: {
147 | [moduleId: string]:
148 | | import('rollup').LoadResult
149 | | import('vite').Plugin['load'];
150 | }): import('vite').Plugin[];
151 | ```
152 |
153 | *You can see the return value type definition here [rollup/types.d.ts#L272](https://github.com/rollup/rollup/blob/b8315e03f9790d610a413316fbf6d565f9340cab/src/rollup/types.d.ts#L272)*
154 |
155 | ## What's different from the official Demo?
156 |
157 | There are two main differences
158 |
159 | 1. Bypass the builtin `vite:resolve` plugin
160 | 2. Reasonably avoid [Pre-Bundling](https://vitejs.dev/guide/dep-pre-bundling.html)
161 |
--------------------------------------------------------------------------------
/README.zh-CN.md:
--------------------------------------------------------------------------------
1 | # vite-plugin-resolve
2 |
3 | 自定义加载模块内容
4 |
5 | [](https://npmjs.org/package/vite-plugin-resolve)
6 | [](https://npmjs.org/package/vite-plugin-resolve)
7 | [](https://github.com/vitejs/awesome-vite)
8 |
9 | **[English](https://github.com/vite-plugin/vite-plugin-resolve#readme) | 简体中文**
10 |
11 | - 🤔 你可以认为它是官方教程的一个实现 👉 [Virtual Modules Convention](https://vitejs.dev/guide/api-plugin.html#virtual-modules-convention)
12 | - 🌱 所见即所得
13 | - 📦 开箱即用 (内置 Vue, React, Antd, Element 等等)
14 | - 🚀 Browser, Node.js, Electron
15 |
16 | ## 安装
17 |
18 | ```bash
19 | npm i vite-plugin-resolve -D
20 | ```
21 |
22 | ## 使用
23 |
24 | 你可以加载任何你想要的代码段 **(ESM 格式)**
25 |
26 | ```ts
27 | import resolve from 'vite-plugin-resolve'
28 |
29 | export default {
30 | plugins: [
31 | resolve({
32 | // Browser
33 | vue: `
34 | const vue = window.Vue;
35 | const version = vue.version;
36 | export {
37 | vue as default,
38 | version,
39 | }
40 | `,
41 | // Node.js, Electron
42 | electron: `
43 | const { ipcRenderer, shell } = require('electron');
44 | export {
45 | ipcRenderer,
46 | shell,
47 | }
48 | `,
49 | }),
50 | ]
51 | }
52 |
53 | // 使用
54 | import Vue, { version } from 'vue'
55 | import { ipcRenderer, shell } from 'electron'
56 |
57 | // 确保你的 index.html 已经包含了 CDN 文件.
58 | // 🌰
59 | //
60 | ```
61 |
62 | 配合 [lib-esm](https://www.npmjs.com/package/lib-esm) 使用
63 |
64 | ```sh
65 | npm i lib-esm
66 | ```
67 |
68 | ```js
69 | import resolve from 'vite-plugin-resolve'
70 | import libEsm from 'lib-esm'
71 |
72 | export default {
73 | plugins: [
74 | resolve({
75 | // 用 lodash 举个 🌰
76 | lodash: () => {
77 | const snippets = libEsm({
78 | // lodash 全局名称
79 | window: '_',
80 | // export memebers
81 | exports: [
82 | 'chunk',
83 | 'curry',
84 | 'debounce',
85 | 'throttle',
86 | ],
87 | })
88 | return `${snippets.window}\n${snippets.exports}`
89 | },
90 | }),
91 | ],
92 | }
93 |
94 | // 使用
95 | import _, { chunk, curry, debounce, throttle } from 'lodash'
96 | ```
97 |
98 | **在 Electron 中使用** 👉 [electron-vite-vue](https://github.com/electron-vite/electron-vite-vue/blob/main/packages/renderer/vite.config.ts)
99 |
100 | ## 内置模块
101 |
102 | 这个场景就是 Vite external plugin
103 |
104 | ```js
105 | import resolve from 'vite-plugin-resolve'
106 | import {
107 | ant_design_vue,
108 | antd,
109 | axios,
110 | element_plus,
111 | element_ui,
112 | pinia,
113 | react_dom,
114 | react_router_dom,
115 | react_router,
116 | react,
117 | redux,
118 | vue_composition_api,
119 | vue_demi,
120 | vue_router,
121 | vue,
122 | vuex,
123 | } from 'vite-plugin-resolve/presets'
124 |
125 | export default {
126 | plugins: [
127 | resolve({
128 | // e.g.
129 | // external-lib: lib-name.version
130 | vue: vue.v3,
131 | react: react.v18,
132 | }),
133 | ]
134 | }
135 |
136 | // 使用
137 | import Vue, { ref, reactive, computed, watch } from 'vue'
138 | import React, { useState, useEffect } from 'react'
139 | ```
140 |
141 | ## API (Define)
142 |
143 | `resolve(entries)`
144 |
145 | ```ts
146 | function resolve(entries: {
147 | [moduleId: string]:
148 | | import('rollup').LoadResult
149 | | import('vite').Plugin['load'];
150 | }): import('vite').Plugin[];
151 | ```
152 |
153 | *你可以在此处看到返回值类型定义 [rollup/types.d.ts#L272](https://github.com/rollup/rollup/blob/b8315e03f9790d610a413316fbf6d565f9340cab/src/rollup/types.d.ts#L272)*
154 |
155 | ## 这与官方的 Demo 有何异同?
156 |
157 | 主要有两点不一样
158 |
159 | 1. 绕过内置的 `vite:resolve` 插件
160 | 2. 合理的避开 [Pre-Bundling](https://vitejs.dev/guide/dep-pre-bundling.html)
161 |
--------------------------------------------------------------------------------
/build.mjs:
--------------------------------------------------------------------------------
1 | import fs from 'node:fs';
2 | import path from 'node:path';
3 | import { createRequire } from 'node:module';
4 | import { fileURLToPath } from 'node:url';
5 | import libEsm from 'lib-esm';
6 |
7 | // const iswatch = process.argv.slice(2).includes('--watch');
8 | const CJS = {
9 | __filename: fileURLToPath(import.meta.url),
10 | __dirname: path.dirname(fileURLToPath(import.meta.url)),
11 | require: createRequire(import.meta.url),
12 | };
13 |
14 | /**
15 | * @see https://stackoverflow.com/questions/9781218/how-to-change-node-jss-console-font-color
16 | * @see https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
17 | */
18 | const colours = {
19 | $_$: c => str => `\x1b[${c}m` + str + '\x1b[0m',
20 | gary: str => colours.$_$(90)(str),
21 | cyan: str => colours.$_$(36)(str),
22 | yellow: str => colours.$_$(33)(str),
23 | green: str => colours.$_$(32)(str),
24 | red: str => colours.$_$(31)(str),
25 | };
26 |
27 | const presetsDir = path.join(CJS.__dirname, 'presets');
28 | const presetRE = /(.+)-(v[\d._]+)\.js$/;
29 | const files = fs.readdirSync(presetsDir).filter(file => presetRE.test(file));
30 |
31 | /** @type {Record>} */
32 | const records = {};
33 | for (const file of files) {
34 | const [, name, version] = presetRE.exec(file);
35 | const dot2_ = str => str.replace('.', '_'); // . -> _
36 | const record = { [dot2_(version)]: file };
37 |
38 | if (records[name]) {
39 | Object.assign(records[name], record);
40 | } else {
41 | records[name] = record;
42 | }
43 | }
44 |
45 | // generate lib.json
46 | const libfile = path.join(presetsDir, 'libs.json');
47 | fs.writeFileSync(libfile, JSON.stringify(records, null, 2));
48 | console.log(
49 | colours.cyan('[write]'),
50 | colours.gary(new Date().toLocaleTimeString()),
51 | libfile,
52 | );
53 |
54 | // generate lib.d.ts
55 | const types = [];
56 | for (const [name, versions] of Object.entries(records)) {
57 | const vs = Object.keys(versions);
58 | types.push(`export declare const ${name.replaceAll('-', '_')}: {
59 | ${vs.map(v => ` ${v}: string`).join('\n')}
60 | }`);
61 | }
62 | const typesfile = path.join(presetsDir, 'libs.d.ts');
63 | fs.writeFileSync(typesfile, types.join('\n'));
64 | console.log(
65 | colours.cyan('[write]'),
66 | colours.gary(new Date().toLocaleTimeString()),
67 | typesfile,
68 | );
69 |
70 | // generate index.mjs
71 | const cjsFiles = [
72 | 'presets/index.js'
73 | ];
74 | for (const file of cjsFiles) {
75 | const filename = path.join(CJS.__dirname, file);
76 | const basename = path.basename(filename);
77 | const destname = filename.replace('.js', '.mjs');
78 | const members = Object.keys(CJS.require(filename));
79 | const snippets = libEsm({
80 | require: `./${basename}`,
81 | exports: members,
82 | });
83 |
84 | fs.writeFileSync(destname, `${snippets.require}\n${snippets.exports}`);
85 | console.log(
86 | colours.cyan('[write]'),
87 | colours.gary(new Date().toLocaleTimeString()),
88 | destname,
89 | );
90 | }
91 |
92 | console.log(colours.green('build success'));
93 |
--------------------------------------------------------------------------------
/index.ts:
--------------------------------------------------------------------------------
1 | import type { Plugin } from 'vite'
2 | import type { LoadResult } from 'rollup'
3 |
4 | interface ResolveOptions {
5 | [moduleId: string]:
6 | | LoadResult
7 | | ((id: string, opts?: { ssr?: boolean }) => LoadResult)
8 | }
9 |
10 | export default function resolve(options: ResolveOptions): Plugin[] {
11 | const prefix = '\0plugin-resolve:'
12 | const resolveKeys = Object.keys(options)
13 | const resolveKeysWithPrefix = resolveKeys.map(key => prefix + key)
14 |
15 | return [
16 | {
17 | name: 'vite-plugin-resolve:resolveId',
18 | // Run before the builtin 'vite:resolve' of Vite
19 | enforce: 'pre',
20 | resolveId(source) {
21 | if (resolveKeys.includes(source)) {
22 | // @see - https://vitejs.dev/guide/api-plugin.html#virtual-modules-convention
23 | return prefix + source
24 | }
25 | },
26 | },
27 | {
28 | name: 'vite-plugin-resolve',
29 | config(config) {
30 | if (!config.optimizeDeps) config.optimizeDeps = {}
31 | if (!config.optimizeDeps.exclude) config.optimizeDeps.exclude = []
32 |
33 | let keys = resolveKeys
34 | if (config.optimizeDeps.include) {
35 | keys = resolveKeys.filter(
36 | key => !config.optimizeDeps?.include?.includes(key)
37 | )
38 | }
39 |
40 | config.optimizeDeps.exclude.push(...keys)
41 | },
42 | load(id, opts) {
43 | if (resolveKeysWithPrefix.includes(id)) {
44 | const stringOrFunction = options[id.replace(prefix, '')]
45 | return typeof stringOrFunction === 'function'
46 | ? stringOrFunction.apply(this, [id, opts])
47 | : stringOrFunction
48 | }
49 | },
50 | },
51 | ]
52 | }
53 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vite-plugin-resolve",
3 | "version": "2.5.2",
4 | "description": "Custom resolve module content.",
5 | "main": "./dist/index.js",
6 | "module": "./dist/index.mjs",
7 | "types": "./dist/index.d.ts",
8 | "exports": {
9 | ".": {
10 | "import": "./dist/index.mjs",
11 | "require": "./dist/index.js",
12 | "types": "./dist/index.d.ts"
13 | },
14 | "./presets": {
15 | "import": "./presets/index.mjs",
16 | "require": "./presets/index.js",
17 | "types": "./presets/indexd.ts"
18 | },
19 | "./*": "./*"
20 | },
21 | "repository": {
22 | "type": "git",
23 | "url": "git+https://github.com/vite-plugin/vite-plugin-resolve.git"
24 | },
25 | "author": "草鞋没号 <308487730@qq.com>",
26 | "license": "MIT",
27 | "scripts": {
28 | "build": "node build.mjs && vite build",
29 | "types": "tsc",
30 | "test": "node test/index.mjs",
31 | "prepublishOnly": "npm run build && npm run test"
32 | },
33 | "dependencies": {
34 | "lib-esm": "~0.4.1"
35 | },
36 | "devDependencies": {
37 | "@types/node": "^20.5.9",
38 | "typescript": "^5.2.2",
39 | "vite": "^4.4.9"
40 | },
41 | "files": [
42 | "dist",
43 | "presets/*"
44 | ],
45 | "keywords": [
46 | "vite",
47 | "plugin",
48 | "resolve",
49 | "external"
50 | ]
51 | }
52 |
--------------------------------------------------------------------------------
/presets/.gitignore:
--------------------------------------------------------------------------------
1 | /libs.json
2 | /libs.d.ts
3 | /index.mjs
--------------------------------------------------------------------------------
/presets/ant-design-vue-v1.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'antd',
6 | members: [
7 | 'install',
8 | 'Affix',
9 | 'Anchor',
10 | 'AutoComplete',
11 | 'Alert',
12 | 'Avatar',
13 | 'BackTop',
14 | 'Badge',
15 | 'Base',
16 | 'Breadcrumb',
17 | 'Button',
18 | 'Calendar',
19 | 'Card',
20 | 'Collapse',
21 | 'Carousel',
22 | 'Cascader',
23 | 'Checkbox',
24 | 'Col',
25 | 'DatePicker',
26 | 'Divider',
27 | 'Dropdown',
28 | 'Form',
29 | 'FormModel',
30 | 'Icon',
31 | 'Input',
32 | 'InputNumber',
33 | 'Layout',
34 | 'List',
35 | 'LocaleProvider',
36 | 'message',
37 | 'Menu',
38 | 'Mentions',
39 | 'Modal',
40 | 'notification',
41 | 'Pagination',
42 | 'Popconfirm',
43 | 'Popover',
44 | 'Progress',
45 | 'Radio',
46 | 'Rate',
47 | 'Row',
48 | 'Select',
49 | 'Slider',
50 | 'Spin',
51 | 'Statistic',
52 | 'Steps',
53 | 'Switch',
54 | 'Table',
55 | 'Transfer',
56 | 'Tree',
57 | 'TreeSelect',
58 | 'Tabs',
59 | 'Tag',
60 | 'TimePicker',
61 | 'Timeline',
62 | 'Tooltip',
63 | 'Upload',
64 | 'version',
65 | 'Drawer',
66 | 'Skeleton',
67 | 'Comment',
68 | 'ConfigProvider',
69 | 'Empty',
70 | 'Result',
71 | 'Descriptions',
72 | 'PageHeader',
73 | 'Space',
74 | 'default',
75 | ],
76 | };
--------------------------------------------------------------------------------
/presets/ant-design-vue-v3.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'antd',
6 | members: [
7 | 'Affix',
8 | 'Alert',
9 | 'Anchor',
10 | 'AnchorLink',
11 | 'AutoComplete',
12 | 'AutoCompleteOptGroup',
13 | 'AutoCompleteOption',
14 | 'Avatar',
15 | 'AvatarGroup',
16 | 'BackTop',
17 | 'Badge',
18 | 'BadgeRibbon',
19 | 'Breadcrumb',
20 | 'BreadcrumbItem',
21 | 'BreadcrumbSeparator',
22 | 'Button',
23 | 'ButtonGroup',
24 | 'Calendar',
25 | 'Card',
26 | 'CardGrid',
27 | 'CardMeta',
28 | 'Carousel',
29 | 'Cascader',
30 | 'CheckableTag',
31 | 'Checkbox',
32 | 'CheckboxGroup',
33 | 'Col',
34 | 'Collapse',
35 | 'CollapsePanel',
36 | 'Comment',
37 | 'ConfigProvider',
38 | 'DatePicker',
39 | 'Descriptions',
40 | 'DescriptionsItem',
41 | 'DirectoryTree',
42 | 'Divider',
43 | 'Drawer',
44 | 'Dropdown',
45 | 'DropdownButton',
46 | 'Empty',
47 | 'Form',
48 | 'FormItem',
49 | 'FormItemRest',
50 | 'Grid',
51 | 'Image',
52 | 'ImagePreviewGroup',
53 | 'Input',
54 | 'InputGroup',
55 | 'InputNumber',
56 | 'InputPassword',
57 | 'InputSearch',
58 | 'Layout',
59 | 'LayoutContent',
60 | 'LayoutFooter',
61 | 'LayoutHeader',
62 | 'LayoutSider',
63 | 'List',
64 | 'ListItem',
65 | 'ListItemMeta',
66 | 'LocaleProvider',
67 | 'Mentions',
68 | 'MentionsOption',
69 | 'Menu',
70 | 'MenuDivider',
71 | 'MenuItem',
72 | 'MenuItemGroup',
73 | 'Modal',
74 | 'MonthPicker',
75 | 'PageHeader',
76 | 'Pagination',
77 | 'Popconfirm',
78 | 'Popover',
79 | 'Progress',
80 | 'QuarterPicker',
81 | 'Radio',
82 | 'RadioButton',
83 | 'RadioGroup',
84 | 'RangePicker',
85 | 'Rate',
86 | 'Result',
87 | 'Row',
88 | 'Select',
89 | 'SelectOptGroup',
90 | 'SelectOption',
91 | 'Skeleton',
92 | 'SkeletonAvatar',
93 | 'SkeletonButton',
94 | 'SkeletonImage',
95 | 'SkeletonInput',
96 | 'SkeletonTitle',
97 | 'Slider',
98 | 'Space',
99 | 'Spin',
100 | 'Statistic',
101 | 'StatisticCountdown',
102 | 'Step',
103 | 'Steps',
104 | 'SubMenu',
105 | 'Switch',
106 | 'TabPane',
107 | 'Table',
108 | 'TableColumn',
109 | 'TableColumnGroup',
110 | 'TableSummary',
111 | 'TableSummaryCell',
112 | 'TableSummaryRow',
113 | 'Tabs',
114 | 'Tag',
115 | 'Textarea',
116 | 'TimePicker',
117 | 'TimeRangePicker',
118 | 'Timeline',
119 | 'TimelineItem',
120 | 'Tooltip',
121 | 'Transfer',
122 | 'Tree',
123 | 'TreeNode',
124 | 'TreeSelect',
125 | 'TreeSelectNode',
126 | 'Typography',
127 | 'TypographyLink',
128 | 'TypographyParagraph',
129 | 'TypographyText',
130 | 'TypographyTitle',
131 | 'Upload',
132 | 'UploadDragger',
133 | 'WeekPicker',
134 | 'default',
135 | 'install',
136 | 'message',
137 | 'notification',
138 | 'version',
139 | ],
140 | };
--------------------------------------------------------------------------------
/presets/ant-design-vue-v4.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'antd',
6 | members: [
7 | 'Affix',
8 | 'Alert',
9 | 'Anchor',
10 | 'AnchorLink',
11 | 'App',
12 | 'AutoComplete',
13 | 'AutoCompleteOptGroup',
14 | 'AutoCompleteOption',
15 | 'Avatar',
16 | 'AvatarGroup',
17 | 'BackTop',
18 | 'Badge',
19 | 'BadgeRibbon',
20 | 'Breadcrumb',
21 | 'BreadcrumbItem',
22 | 'BreadcrumbSeparator',
23 | 'Button',
24 | 'ButtonGroup',
25 | 'Calendar',
26 | 'Card',
27 | 'CardGrid',
28 | 'CardMeta',
29 | 'Carousel',
30 | 'Cascader',
31 | 'CheckableTag',
32 | 'Checkbox',
33 | 'CheckboxGroup',
34 | 'Col',
35 | 'Collapse',
36 | 'CollapsePanel',
37 | 'Comment',
38 | 'Compact',
39 | 'ConfigProvider',
40 | 'DatePicker',
41 | 'Descriptions',
42 | 'DescriptionsItem',
43 | 'DirectoryTree',
44 | 'Divider',
45 | 'Drawer',
46 | 'Dropdown',
47 | 'DropdownButton',
48 | 'Empty',
49 | 'FloatButton',
50 | 'FloatButtonGroup',
51 | 'Form',
52 | 'FormItem',
53 | 'FormItemRest',
54 | 'Grid',
55 | 'Image',
56 | 'ImagePreviewGroup',
57 | 'Input',
58 | 'InputGroup',
59 | 'InputNumber',
60 | 'InputPassword',
61 | 'InputSearch',
62 | 'Keyframes',
63 | 'Layout',
64 | 'LayoutContent',
65 | 'LayoutFooter',
66 | 'LayoutHeader',
67 | 'LayoutSider',
68 | 'List',
69 | 'ListItem',
70 | 'ListItemMeta',
71 | 'LocaleProvider',
72 | 'Mentions',
73 | 'MentionsOption',
74 | 'Menu',
75 | 'MenuDivider',
76 | 'MenuItem',
77 | 'MenuItemGroup',
78 | 'Modal',
79 | 'MonthPicker',
80 | 'PageHeader',
81 | 'Pagination',
82 | 'Popconfirm',
83 | 'Popover',
84 | 'Progress',
85 | 'QRCode',
86 | 'QuarterPicker',
87 | 'Radio',
88 | 'RadioButton',
89 | 'RadioGroup',
90 | 'RangePicker',
91 | 'Rate',
92 | 'Result',
93 | 'Row',
94 | 'Segmented',
95 | 'Select',
96 | 'SelectOptGroup',
97 | 'SelectOption',
98 | 'Skeleton',
99 | 'SkeletonAvatar',
100 | 'SkeletonButton',
101 | 'SkeletonImage',
102 | 'SkeletonInput',
103 | 'SkeletonTitle',
104 | 'Slider',
105 | 'Space',
106 | 'Spin',
107 | 'Statistic',
108 | 'StatisticCountdown',
109 | 'Step',
110 | 'Steps',
111 | 'StyleProvider',
112 | 'SubMenu',
113 | 'Switch',
114 | 'TabPane',
115 | 'Table',
116 | 'TableColumn',
117 | 'TableColumnGroup',
118 | 'TableSummary',
119 | 'TableSummaryCell',
120 | 'TableSummaryRow',
121 | 'Tabs',
122 | 'Tag',
123 | 'Textarea',
124 | 'Theme',
125 | 'TimePicker',
126 | 'TimeRangePicker',
127 | 'Timeline',
128 | 'TimelineItem',
129 | 'Tooltip',
130 | 'Tour',
131 | 'Transfer',
132 | 'Tree',
133 | 'TreeNode',
134 | 'TreeSelect',
135 | 'TreeSelectNode',
136 | 'Typography',
137 | 'TypographyLink',
138 | 'TypographyParagraph',
139 | 'TypographyText',
140 | 'TypographyTitle',
141 | 'Upload',
142 | 'UploadDragger',
143 | 'Watermark',
144 | 'WeekPicker',
145 | 'createCache',
146 | 'createTheme',
147 | 'cssinjs',
148 | 'default',
149 | 'extractStyle',
150 | 'install',
151 | 'legacyLogicalPropertiesTransformer',
152 | 'legacyNotSelectorLinter',
153 | 'logicalPropertiesLinter',
154 | 'message',
155 | 'notification',
156 | 'parentSelectorLinter',
157 | 'px2remTransformer',
158 | 'theme',
159 | 'useCacheToken',
160 | 'useStyleInject',
161 | 'useStyleProvider',
162 | 'useStyleRegister',
163 | 'version',
164 | ],
165 | };
--------------------------------------------------------------------------------
/presets/antd-v4.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'antd',
6 | members: [
7 | 'Affix',
8 | 'Anchor',
9 | 'AutoComplete',
10 | 'Alert',
11 | 'Avatar',
12 | 'BackTop',
13 | 'Badge',
14 | 'Breadcrumb',
15 | 'Button',
16 | 'Calendar',
17 | 'Card',
18 | 'Collapse',
19 | 'Carousel',
20 | 'Cascader',
21 | 'Checkbox',
22 | 'Col',
23 | 'Comment',
24 | 'ConfigProvider',
25 | 'DatePicker',
26 | 'Descriptions',
27 | 'Divider',
28 | 'Dropdown',
29 | 'Drawer',
30 | 'Empty',
31 | 'Form',
32 | 'Grid',
33 | 'Input',
34 | 'Image',
35 | 'InputNumber',
36 | 'Layout',
37 | 'List',
38 | 'message',
39 | 'Menu',
40 | 'Mentions',
41 | 'Modal',
42 | 'Statistic',
43 | 'notification',
44 | 'PageHeader',
45 | 'Pagination',
46 | 'Popconfirm',
47 | 'Popover',
48 | 'Progress',
49 | 'Radio',
50 | 'Rate',
51 | 'Result',
52 | 'Row',
53 | 'Select',
54 | 'Skeleton',
55 | 'Slider',
56 | 'Space',
57 | 'Spin',
58 | 'Steps',
59 | 'Switch',
60 | 'Table',
61 | 'Transfer',
62 | 'Tree',
63 | 'TreeSelect',
64 | 'Tabs',
65 | 'Tag',
66 | 'TimePicker',
67 | 'Timeline',
68 | 'Tooltip',
69 | 'Typography',
70 | 'Upload',
71 | 'version',
72 | ],
73 | };
--------------------------------------------------------------------------------
/presets/axios-v0.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'axios',
6 | members: [
7 | 'request',
8 | 'delete',
9 | 'get',
10 | 'head',
11 | 'options',
12 | 'post',
13 | 'put',
14 | 'patch',
15 | 'defaults',
16 | 'interceptors',
17 | 'Axios',
18 | 'create',
19 | 'Cancel',
20 | 'CancelToken',
21 | 'isCancel',
22 | 'all',
23 | 'spread',
24 | 'default',
25 | ],
26 | };
27 |
--------------------------------------------------------------------------------
/presets/axios-v1.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'axios',
6 | members: [
7 | // use import statemenet to actually export 21 members 🤔
8 | // 'constructor', -> const function Object() { [native code] } = _M_.constructor; 🚧
9 | 'request',
10 | 'getUri',
11 | 'delete',
12 | 'get',
13 | 'head',
14 | 'options',
15 | 'post',
16 | 'postForm',
17 | 'put',
18 | 'putForm',
19 | 'patch',
20 | 'patchForm',
21 | 'defaults',
22 | 'interceptors',
23 | 'create',
24 | 'Axios',
25 | 'CanceledError',
26 | 'CancelToken',
27 | 'isCancel',
28 | 'VERSION',
29 | 'toFormData',
30 | 'AxiosError',
31 | 'Cancel',
32 | 'all',
33 | 'spread',
34 | 'isAxiosError',
35 | 'mergeConfig',
36 | 'AxiosHeaders',
37 | 'formToJSON',
38 | 'getAdapter',
39 | 'HttpStatusCode',
40 | 'default',
41 | ],
42 | };
43 |
--------------------------------------------------------------------------------
/presets/element-plus-v2.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'ElementPlus',
6 | members: [
7 | 'BAR_MAP',
8 | 'CASCADER_PANEL_INJECTION_KEY',
9 | 'CHANGE_EVENT',
10 | 'ClickOutside',
11 | 'CommonPicker',
12 | 'CommonProps',
13 | 'DEFAULT_FORMATS_DATE',
14 | 'DEFAULT_FORMATS_DATEPICKER',
15 | 'DEFAULT_FORMATS_TIME',
16 | 'DROPDOWN_COLLECTION_INJECTION_KEY',
17 | 'DROPDOWN_COLLECTION_ITEM_INJECTION_KEY',
18 | 'DROPDOWN_INJECTION_KEY',
19 | 'DefaultProps',
20 | 'DynamicSizeGrid',
21 | 'DynamicSizeList',
22 | 'EVENT_CODE',
23 | 'Effect',
24 | 'ElAffix',
25 | 'ElAlert',
26 | 'ElAside',
27 | 'ElAutoResizer',
28 | 'ElAutocomplete',
29 | 'ElAvatar',
30 | 'ElBacktop',
31 | 'ElBadge',
32 | 'ElBreadcrumb',
33 | 'ElBreadcrumbItem',
34 | 'ElButton',
35 | 'ElButtonGroup',
36 | 'ElCalendar',
37 | 'ElCard',
38 | 'ElCarousel',
39 | 'ElCarouselItem',
40 | 'ElCascader',
41 | 'ElCascaderPanel',
42 | 'ElCheckTag',
43 | 'ElCheckbox',
44 | 'ElCheckboxButton',
45 | 'ElCheckboxGroup',
46 | 'ElCol',
47 | 'ElCollapse',
48 | 'ElCollapseItem',
49 | 'ElCollapseTransition',
50 | 'ElCollection',
51 | 'ElCollectionItem',
52 | 'ElColorPicker',
53 | 'ElConfigProvider',
54 | 'ElContainer',
55 | 'ElCountdown',
56 | 'ElDatePicker',
57 | 'ElDescriptions',
58 | 'ElDescriptionsItem',
59 | 'ElDialog',
60 | 'ElDivider',
61 | 'ElDrawer',
62 | 'ElDropdown',
63 | 'ElDropdownItem',
64 | 'ElDropdownMenu',
65 | 'ElEmpty',
66 | 'ElFooter',
67 | 'ElForm',
68 | 'ElFormItem',
69 | 'ElHeader',
70 | 'ElIcon',
71 | 'ElImage',
72 | 'ElImageViewer',
73 | 'ElInfiniteScroll',
74 | 'ElInput',
75 | 'ElInputNumber',
76 | 'ElLink',
77 | 'ElLoading',
78 | 'ElLoadingDirective',
79 | 'ElLoadingService',
80 | 'ElMain',
81 | 'ElMenu',
82 | 'ElMenuItem',
83 | 'ElMenuItemGroup',
84 | 'ElMessage',
85 | 'ElMessageBox',
86 | 'ElNotification',
87 | 'ElOption',
88 | 'ElOptionGroup',
89 | 'ElOverlay',
90 | 'ElPageHeader',
91 | 'ElPagination',
92 | 'ElPopconfirm',
93 | 'ElPopover',
94 | 'ElPopoverDirective',
95 | 'ElPopper',
96 | 'ElPopperArrow',
97 | 'ElPopperContent',
98 | 'ElPopperTrigger',
99 | 'ElProgress',
100 | 'ElRadio',
101 | 'ElRadioButton',
102 | 'ElRadioGroup',
103 | 'ElRate',
104 | 'ElResult',
105 | 'ElRow',
106 | 'ElScrollbar',
107 | 'ElSelect',
108 | 'ElSelectV2',
109 | 'ElSkeleton',
110 | 'ElSkeletonItem',
111 | 'ElSlider',
112 | 'ElSpace',
113 | 'ElStatistic',
114 | 'ElStep',
115 | 'ElSteps',
116 | 'ElSubMenu',
117 | 'ElSwitch',
118 | 'ElTabPane',
119 | 'ElTable',
120 | 'ElTableColumn',
121 | 'ElTableV2',
122 | 'ElTabs',
123 | 'ElTag',
124 | 'ElText',
125 | 'ElTimePicker',
126 | 'ElTimeSelect',
127 | 'ElTimeline',
128 | 'ElTimelineItem',
129 | 'ElTooltip',
130 | 'ElTransfer',
131 | 'ElTree',
132 | 'ElTreeSelect',
133 | 'ElTreeV2',
134 | 'ElUpload',
135 | 'FIRST_KEYS',
136 | 'FIRST_LAST_KEYS',
137 | 'FORWARD_REF_INJECTION_KEY',
138 | 'FixedSizeGrid',
139 | 'FixedSizeList',
140 | 'GAP',
141 | 'ID_INJECTION_KEY',
142 | 'INPUT_EVENT',
143 | 'INSTALLED_KEY',
144 | 'IconComponentMap',
145 | 'IconMap',
146 | 'LAST_KEYS',
147 | 'LEFT_CHECK_CHANGE_EVENT',
148 | 'Mousewheel',
149 | 'POPPER_CONTENT_INJECTION_KEY',
150 | 'POPPER_INJECTION_KEY',
151 | 'RIGHT_CHECK_CHANGE_EVENT',
152 | 'ROOT_PICKER_INJECTION_KEY',
153 | 'RowAlign',
154 | 'RowJustify',
155 | 'SIZE_INJECTION_KEY',
156 | 'TOOLTIP_INJECTION_KEY',
157 | 'TableV2',
158 | 'TableV2Alignment',
159 | 'TableV2FixedDir',
160 | 'TableV2Placeholder',
161 | 'TableV2SortOrder',
162 | 'TimePickPanel',
163 | 'TrapFocus',
164 | 'UPDATE_MODEL_EVENT',
165 | 'WEEK_DAYS',
166 | 'affixEmits',
167 | 'affixProps',
168 | 'alertEffects',
169 | 'alertEmits',
170 | 'alertProps',
171 | 'arrowMiddleware',
172 | 'autoResizerProps',
173 | 'autocompleteEmits',
174 | 'autocompleteProps',
175 | 'avatarEmits',
176 | 'avatarProps',
177 | 'backtopEmits',
178 | 'backtopProps',
179 | 'badgeProps',
180 | 'breadcrumbItemProps',
181 | 'breadcrumbKey',
182 | 'breadcrumbProps',
183 | 'buildLocaleContext',
184 | 'buildTimeList',
185 | 'buildTranslator',
186 | 'buttonEmits',
187 | 'buttonGroupContextKey',
188 | 'buttonNativeTypes',
189 | 'buttonProps',
190 | 'buttonTypes',
191 | 'calendarEmits',
192 | 'calendarProps',
193 | 'cardProps',
194 | 'carouselContextKey',
195 | 'carouselEmits',
196 | 'carouselItemProps',
197 | 'carouselProps',
198 | 'cascaderEmits',
199 | 'cascaderProps',
200 | 'checkTagEmits',
201 | 'checkTagProps',
202 | 'checkboxEmits',
203 | 'checkboxGroupContextKey',
204 | 'checkboxGroupEmits',
205 | 'checkboxGroupProps',
206 | 'checkboxProps',
207 | 'colProps',
208 | 'collapseContextKey',
209 | 'collapseEmits',
210 | 'collapseItemProps',
211 | 'collapseProps',
212 | 'colorPickerContextKey',
213 | 'colorPickerEmits',
214 | 'colorPickerProps',
215 | 'componentSizeMap',
216 | 'componentSizes',
217 | 'configProviderContextKey',
218 | 'configProviderProps',
219 | 'countdownEmits',
220 | 'countdownProps',
221 | 'createModelToggleComposable',
222 | 'dateEquals',
223 | 'datePickTypes',
224 | 'datePickerProps',
225 | 'dayjs',
226 | 'default',
227 | 'defaultInitialZIndex',
228 | 'defaultNamespace',
229 | 'descriptionProps',
230 | 'dialogEmits',
231 | 'dialogInjectionKey',
232 | 'dialogProps',
233 | 'dividerProps',
234 | 'drawerEmits',
235 | 'drawerProps',
236 | 'dropdownItemProps',
237 | 'dropdownMenuProps',
238 | 'dropdownProps',
239 | 'elPaginationKey',
240 | 'emitChangeFn',
241 | 'emptyProps',
242 | 'extractDateFormat',
243 | 'extractTimeFormat',
244 | 'formContextKey',
245 | 'formEmits',
246 | 'formItemContextKey',
247 | 'formItemProps',
248 | 'formItemValidateStates',
249 | 'formProps',
250 | 'formatter',
251 | 'genFileId',
252 | 'getPositionDataWithUnit',
253 | 'iconProps',
254 | 'imageEmits',
255 | 'imageProps',
256 | 'imageViewerEmits',
257 | 'imageViewerProps',
258 | 'inputEmits',
259 | 'inputNumberEmits',
260 | 'inputNumberProps',
261 | 'inputProps',
262 | 'install',
263 | 'linkEmits',
264 | 'linkProps',
265 | 'localeContextKey',
266 | 'makeInstaller',
267 | 'makeList',
268 | 'menuEmits',
269 | 'menuItemEmits',
270 | 'menuItemGroupProps',
271 | 'menuItemProps',
272 | 'menuProps',
273 | 'messageConfig',
274 | 'messageDefaults',
275 | 'messageEmits',
276 | 'messageProps',
277 | 'messageTypes',
278 | 'namespaceContextKey',
279 | 'notificationEmits',
280 | 'notificationProps',
281 | 'notificationTypes',
282 | 'overlayEmits',
283 | 'overlayProps',
284 | 'pageHeaderEmits',
285 | 'pageHeaderProps',
286 | 'paginationEmits',
287 | 'paginationProps',
288 | 'parseDate',
289 | 'popconfirmEmits',
290 | 'popconfirmProps',
291 | 'popoverEmits',
292 | 'popoverProps',
293 | 'popperArrowProps',
294 | 'popperContentEmits',
295 | 'popperContentProps',
296 | 'popperCoreConfigProps',
297 | 'popperProps',
298 | 'popperTriggerProps',
299 | 'progressProps',
300 | 'provideGlobalConfig',
301 | 'radioButtonProps',
302 | 'radioEmits',
303 | 'radioGroupEmits',
304 | 'radioGroupKey',
305 | 'radioGroupProps',
306 | 'radioProps',
307 | 'radioPropsBase',
308 | 'rangeArr',
309 | 'rateEmits',
310 | 'rateProps',
311 | 'renderThumbStyle',
312 | 'resultProps',
313 | 'roleTypes',
314 | 'rowContextKey',
315 | 'rowProps',
316 | 'scrollbarContextKey',
317 | 'scrollbarEmits',
318 | 'scrollbarProps',
319 | 'selectGroupKey',
320 | 'selectKey',
321 | 'selectV2InjectionKey',
322 | 'skeletonItemProps',
323 | 'skeletonProps',
324 | 'sliderContextKey',
325 | 'sliderEmits',
326 | 'sliderProps',
327 | 'spaceProps',
328 | 'statisticProps',
329 | 'stepProps',
330 | 'stepsEmits',
331 | 'stepsProps',
332 | 'subMenuProps',
333 | 'switchEmits',
334 | 'switchProps',
335 | 'tabBarProps',
336 | 'tabNavEmits',
337 | 'tabNavProps',
338 | 'tabPaneProps',
339 | 'tableV2Props',
340 | 'tableV2RowProps',
341 | 'tabsEmits',
342 | 'tabsProps',
343 | 'tabsRootContextKey',
344 | 'tagEmits',
345 | 'tagProps',
346 | 'textProps',
347 | 'thumbProps',
348 | 'timePickerDefaultProps',
349 | 'timeUnits',
350 | 'timelineItemProps',
351 | 'tooltipEmits',
352 | 'transferCheckedChangeFn',
353 | 'transferEmits',
354 | 'transferProps',
355 | 'translate',
356 | 'uploadBaseProps',
357 | 'uploadContentProps',
358 | 'uploadContextKey',
359 | 'uploadDraggerEmits',
360 | 'uploadDraggerProps',
361 | 'uploadListEmits',
362 | 'uploadListProps',
363 | 'uploadListTypes',
364 | 'uploadProps',
365 | 'useAttrs',
366 | 'useCascaderConfig',
367 | 'useCursor',
368 | 'useDelayedRender',
369 | 'useDelayedToggle',
370 | 'useDelayedToggleProps',
371 | 'useDeprecated',
372 | 'useDialog',
373 | 'useDisabled',
374 | 'useDraggable',
375 | 'useEscapeKeydown',
376 | 'useFloating',
377 | 'useFloatingProps',
378 | 'useFocus',
379 | 'useFocusController',
380 | 'useFormDisabled',
381 | 'useFormItem',
382 | 'useFormItemInputId',
383 | 'useFormSize',
384 | 'useForwardRef',
385 | 'useForwardRefDirective',
386 | 'useGetDerivedNamespace',
387 | 'useGlobalComponentSettings',
388 | 'useGlobalConfig',
389 | 'useGlobalSize',
390 | 'useId',
391 | 'useIdInjection',
392 | 'useLocale',
393 | 'useLockscreen',
394 | 'useModal',
395 | 'useModelToggle',
396 | 'useModelToggleEmits',
397 | 'useModelToggleProps',
398 | 'useNamespace',
399 | 'useOrderedChildren',
400 | 'usePopper',
401 | 'usePopperArrowProps',
402 | 'usePopperContainer',
403 | 'usePopperContainerId',
404 | 'usePopperContentEmits',
405 | 'usePopperContentProps',
406 | 'usePopperCoreConfigProps',
407 | 'usePopperProps',
408 | 'usePopperTriggerProps',
409 | 'usePreventGlobal',
410 | 'useProp',
411 | 'useSameTarget',
412 | 'useSize',
413 | 'useSizeProp',
414 | 'useSizeProps',
415 | 'useSpace',
416 | 'useTeleport',
417 | 'useThrottleRender',
418 | 'useTimeout',
419 | 'useTooltipContentProps',
420 | 'useTooltipModelToggle',
421 | 'useTooltipModelToggleEmits',
422 | 'useTooltipModelToggleProps',
423 | 'useTooltipProps',
424 | 'useTooltipTriggerProps',
425 | 'useTransitionFallthrough',
426 | 'useTransitionFallthroughEmits',
427 | 'useZIndex',
428 | 'vLoading',
429 | 'vRepeatClick',
430 | 'valueEquals',
431 | 'version',
432 | 'virtualizedGridProps',
433 | 'virtualizedListProps',
434 | 'virtualizedProps',
435 | 'virtualizedScrollbarProps',
436 | 'zIndexContextKey',
437 | ],
438 | };
--------------------------------------------------------------------------------
/presets/element-ui-v2.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'ELEMENT',
6 | members: [
7 | 'version',
8 | 'locale',
9 | 'i18n',
10 | 'install',
11 | 'CollapseTransition',
12 | 'Loading',
13 | 'Pagination',
14 | 'Dialog',
15 | 'Autocomplete',
16 | 'Dropdown',
17 | 'DropdownMenu',
18 | 'DropdownItem',
19 | 'Menu',
20 | 'Submenu',
21 | 'MenuItem',
22 | 'MenuItemGroup',
23 | 'Input',
24 | 'InputNumber',
25 | 'Radio',
26 | 'RadioGroup',
27 | 'RadioButton',
28 | 'Checkbox',
29 | 'CheckboxButton',
30 | 'CheckboxGroup',
31 | 'Switch',
32 | 'Select',
33 | 'Option',
34 | 'OptionGroup',
35 | 'Button',
36 | 'ButtonGroup',
37 | 'Table',
38 | 'TableColumn',
39 | 'DatePicker',
40 | 'TimeSelect',
41 | 'TimePicker',
42 | 'Popover',
43 | 'Tooltip',
44 | 'MessageBox',
45 | 'Breadcrumb',
46 | 'BreadcrumbItem',
47 | 'Form',
48 | 'FormItem',
49 | 'Tabs',
50 | 'TabPane',
51 | 'Tag',
52 | 'Tree',
53 | 'Alert',
54 | 'Notification',
55 | 'Slider',
56 | 'Icon',
57 | 'Row',
58 | 'Col',
59 | 'Upload',
60 | 'Progress',
61 | 'Spinner',
62 | 'Message',
63 | 'Badge',
64 | 'Card',
65 | 'Rate',
66 | 'Steps',
67 | 'Step',
68 | 'Carousel',
69 | 'Scrollbar',
70 | 'CarouselItem',
71 | 'Collapse',
72 | 'CollapseItem',
73 | 'Cascader',
74 | 'ColorPicker',
75 | 'Transfer',
76 | 'Container',
77 | 'Header',
78 | 'Aside',
79 | 'Main',
80 | 'Footer',
81 | 'Timeline',
82 | 'TimelineItem',
83 | 'Link',
84 | 'Divider',
85 | 'Image',
86 | 'Calendar',
87 | 'Backtop',
88 | 'InfiniteScroll',
89 | 'PageHeader',
90 | 'CascaderPanel',
91 | 'Avatar',
92 | 'Drawer',
93 | 'Popconfirm',
94 | 'Skeleton',
95 | 'SkeletonItem',
96 | 'Empty',
97 | 'Descriptions',
98 | 'DescriptionsItem',
99 | 'Result',
100 | ],
101 | };
--------------------------------------------------------------------------------
/presets/index.d.ts:
--------------------------------------------------------------------------------
1 | export * from './libs'
2 |
3 | export interface LibMeta {
4 | name: string
5 | members: string[]
6 | }
7 |
--------------------------------------------------------------------------------
/presets/index.js:
--------------------------------------------------------------------------------
1 | const libEsm = require('lib-esm').default;
2 |
3 | for (const [name, versions] of Object.entries(require('./libs.json'))) {
4 | const record = {};
5 | for (const [version, file] of Object.entries(versions)) {
6 | /** @type {import('.').LibMeta} */
7 | const lib = require(`./${file}`);
8 | const snippets = libEsm({ window: lib.name, exports: lib.members });
9 | record[version] = `${snippets.window}\n${snippets.exports}`;
10 | }
11 | exports[name.replaceAll('-', '_')] = record;
12 | }
13 |
--------------------------------------------------------------------------------
/presets/index.js.snap:
--------------------------------------------------------------------------------
1 | const antd_vue_v1 = require('./ant-design-vue-v1');
2 | const antd_vue_v3 = require('./ant-design-vue-v3');
3 | const antd_v4 = require('./antd-v4');
4 | const element_plus_v2 = require('./element-plus-v2');
5 | const element_ui_v2 = require('./element-ui-v2');
6 | const pinia_v2 = require('./pinia-v2');
7 | const react_dom_v17 = require('./react-dom-v17');
8 | const react_dom_v18 = require('./react-dom-v18');
9 | const react_router_dom_v5 = require('./react-router-dom-v5');
10 | const react_router_dom_v6 = require('./react-router-dom-v6');
11 | const react_router_v5 = require('./react-router-v5');
12 | const react_router_v6 = require('./react-router-v6');
13 | const react_v17 = require('./react-v17');
14 | const react_v18 = require('./react-v18');
15 | const redux_v5 = require('./redux-v5');
16 | const vue_composition_api_v1 = require('./vue-composition-api-v1');
17 | const vue_router_v4 = require('./vue-router-v4');
18 | const vue_v2 = require('./vue-v2');
19 | const vue_v3 = require('./vue-v3');
20 | const vuex_v3 = require('./vuex-v3');
21 | const vuex_v4 = require('./vuex-v4');
22 |
23 | /**
24 | * @type {import('.').Lib2esm}
25 | */
26 | exports.lib2esm = function (name, ...args) {
27 | if (!args.length) {
28 | return exports.lib2esm(name, [], {});
29 | }
30 | if (args.length === 1) {
31 | return Object.prototype.toString.call(args[0]) === '[object Object]'
32 | // lib2esm(name, options)
33 | ? exports.lib2esm(name, [], args[0])
34 | // lib2esm(name, members)
35 | : exports.lib2esm(name, args[0], {})
36 | }
37 | const [members, options] = args;
38 | const { format = 'iife' } = options;
39 |
40 | const keywords = [
41 | 'await',
42 | 'break',
43 | 'case',
44 | 'catch',
45 | 'class',
46 | 'const',
47 | 'continue',
48 | 'debugger',
49 | 'default',
50 | 'delete',
51 | 'do',
52 | 'else',
53 | 'enum',
54 | 'export',
55 | 'extends',
56 | 'false',
57 | 'finally',
58 | 'for',
59 | 'function',
60 | 'if',
61 | 'implements',
62 | 'import',
63 | 'in',
64 | 'instanceof',
65 | 'interface',
66 | 'let',
67 | 'new',
68 | 'null',
69 | 'package',
70 | 'private',
71 | 'protected',
72 | 'public',
73 | 'return',
74 | 'super',
75 | 'switch',
76 | 'static',
77 | 'this',
78 | 'throw',
79 | 'try',
80 | 'true',
81 | 'typeof',
82 | 'var',
83 | 'void',
84 | 'while',
85 | 'with',
86 | 'yield',
87 | ];
88 |
89 | const exportMembers = members
90 | .filter(e => !keywords.includes(e))
91 | .map(e => `export const ${e} = _M_.${e};`)
92 | .join('\n');
93 |
94 | const importTpl = format === 'cjs'
95 | ? `const _M_ = require('${name}');`
96 | : `const _M_ = window['${name}'];`
97 |
98 | const externalTpl = `
99 | ${importTpl}
100 | const _D_ = _M_.default || _M_;
101 | export { _D_ as default }
102 | ${exportMembers}
103 | `.trim();
104 |
105 | return () => externalTpl;
106 | };
107 |
108 | exports.antd_vue = {
109 | v1: this.lib2esm(antd_vue_v1.name, antd_vue_v1.members),
110 | v3: this.lib2esm(antd_vue_v3.name, antd_vue_v3.members),
111 | };
112 |
113 | exports.antd = {
114 | v4: this.lib2esm(antd_v4.name, antd_v4.members),
115 | };
116 |
117 | exports.element_plus = {
118 | v2: this.lib2esm(element_plus_v2.name, element_plus_v2.members),
119 | };
120 |
121 | exports.element_ui = {
122 | v2: this.lib2esm(element_ui_v2.name, element_ui_v2.members),
123 | };
124 |
125 | exports.pinia = {
126 | v2: this.lib2esm(pinia_v2.name, pinia_v2.members),
127 | };
128 |
129 | exports.react_dom = {
130 | v17: this.lib2esm(react_dom_v17.name, react_dom_v17.members),
131 | v18: this.lib2esm(react_dom_v18.name, react_dom_v18.members),
132 | };
133 |
134 | exports.react_router_dom = {
135 | v5: this.lib2esm(react_router_dom_v5.name, react_router_dom_v5.members),
136 | v6: this.lib2esm(react_router_dom_v6.name, react_router_dom_v6.members),
137 | };
138 |
139 | exports.react_router = {
140 | v5: this.lib2esm(react_router_v5.name, react_router_v5.members),
141 | v6: this.lib2esm(react_router_v6.name, react_router_v6.members),
142 | };
143 |
144 | exports.react = {
145 | v17: this.lib2esm(react_v17.name, react_v17.members),
146 | v18: this.lib2esm(react_v18.name, react_v18.members),
147 | };
148 |
149 | exports.redux = {
150 | v5: this.lib2esm(redux_v5.name, redux_v5.members),
151 | };
152 |
153 | exports.vue_composition_api = {
154 | v1: this.lib2esm(vue_composition_api_v1.name, vue_composition_api_v1.members),
155 | };
156 |
157 | exports.vue_router = {
158 | v4: this.lib2esm(vue_router_v4.name, vue_router_v4.members),
159 | };
160 |
161 | exports.vue = {
162 | v2: this.lib2esm(vue_v2.name, vue_v2.members),
163 | v3: this.lib2esm(vue_v3.name, vue_v3.members),
164 | };
165 |
166 | exports.vuex = {
167 | v3: this.lib2esm(vuex_v3.name, vuex_v3.members),
168 | v4: this.lib2esm(vuex_v4.name, vuex_v4.members),
169 | };
170 |
--------------------------------------------------------------------------------
/presets/pinia-v2.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'Pinia',
6 | members: [
7 | 'MutationType',
8 | 'PiniaVuePlugin',
9 | 'acceptHMRUpdate',
10 | 'createPinia',
11 | 'defineStore',
12 | 'getActivePinia',
13 | 'mapActions',
14 | 'mapGetters',
15 | 'mapState',
16 | 'mapStores',
17 | 'mapWritableState',
18 | 'setActivePinia',
19 | 'setMapStoreSuffix',
20 | 'skipHydrate',
21 | 'storeToRefs',
22 | ],
23 | };
--------------------------------------------------------------------------------
/presets/react-dom-v17.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'ReactDOM',
6 | members: [
7 | '__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED',
8 | 'createPortal',
9 | 'findDOMNode',
10 | 'flushSync',
11 | 'hydrate',
12 | 'render',
13 | 'unmountComponentAtNode',
14 | 'unstable_batchedUpdates',
15 | 'unstable_createPortal',
16 | 'unstable_renderSubtreeIntoContainer',
17 | 'version',
18 | ],
19 | };
--------------------------------------------------------------------------------
/presets/react-dom-v18.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'ReactDOM',
6 | members: [
7 | '__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED',
8 | 'createPortal',
9 | 'createRoot',
10 | 'findDOMNode',
11 | 'flushSync',
12 | 'hydrate',
13 | 'hydrateRoot',
14 | 'render',
15 | 'unmountComponentAtNode',
16 | 'unstable_batchedUpdates',
17 | 'unstable_renderSubtreeIntoContainer',
18 | 'version',
19 | ],
20 | };
--------------------------------------------------------------------------------
/presets/react-router-dom-v5.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'ReactRouterDOM',
6 | members: [
7 | 'BrowserRouter',
8 | 'HashRouter',
9 | 'Link',
10 | 'MemoryRouter',
11 | 'NavLink',
12 | 'Prompt',
13 | 'Redirect',
14 | 'Route',
15 | 'Router',
16 | 'StaticRouter',
17 | 'Switch',
18 | 'generatePath',
19 | 'matchPath',
20 | 'useHistory',
21 | 'useLocation',
22 | 'useParams',
23 | 'useRouteMatch',
24 | 'withRouter',
25 | ],
26 | };
--------------------------------------------------------------------------------
/presets/react-router-dom-v6.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'ReactRouterDOM',
6 | members: [
7 | 'MemoryRouter',
8 | 'Navigate',
9 | 'NavigationType',
10 | 'Outlet',
11 | 'Route',
12 | 'Router',
13 | 'Routes',
14 | 'UNSAFE_LocationContext',
15 | 'UNSAFE_NavigationContext',
16 | 'UNSAFE_RouteContext',
17 | 'createPath',
18 | 'createRoutesFromChildren',
19 | 'generatePath',
20 | 'matchPath',
21 | 'matchRoutes',
22 | 'parsePath',
23 | 'renderMatches',
24 | 'resolvePath',
25 | 'useHref',
26 | 'useInRouterContext',
27 | 'useLocation',
28 | 'useMatch',
29 | 'useNavigate',
30 | 'useNavigationType',
31 | 'useOutlet',
32 | 'useOutletContext',
33 | 'useParams',
34 | 'useResolvedPath',
35 | 'useRoutes',
36 | 'BrowserRouter',
37 | 'HashRouter',
38 | 'Link',
39 | 'NavLink',
40 | 'createSearchParams',
41 | 'unstable_HistoryRouter',
42 | 'useLinkClickHandler',
43 | 'useSearchParams',
44 | ],
45 | };
--------------------------------------------------------------------------------
/presets/react-router-v5.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'ReactRouter',
6 | members: [
7 | 'MemoryRouter',
8 | 'Prompt',
9 | 'Redirect',
10 | 'Route',
11 | 'Router',
12 | 'StaticRouter',
13 | 'Switch',
14 | '__HistoryContext',
15 | '__RouterContext',
16 | 'generatePath',
17 | 'matchPath',
18 | 'useHistory',
19 | 'useLocation',
20 | 'useParams',
21 | 'useRouteMatch',
22 | 'withRouter',
23 | ],
24 | };
25 |
--------------------------------------------------------------------------------
/presets/react-router-v6.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'ReactRouter',
6 | members: [
7 | 'NavigationType',
8 | 'createPath',
9 | 'parsePath',
10 | 'MemoryRouter',
11 | 'Navigate',
12 | 'Outlet',
13 | 'Route',
14 | 'Router',
15 | 'Routes',
16 | 'UNSAFE_LocationContext',
17 | 'UNSAFE_NavigationContext',
18 | 'UNSAFE_RouteContext',
19 | 'createRoutesFromChildren',
20 | 'generatePath',
21 | 'matchPath',
22 | 'matchRoutes',
23 | 'renderMatches',
24 | 'resolvePath',
25 | 'useHref',
26 | 'useInRouterContext',
27 | 'useLocation',
28 | 'useMatch',
29 | 'useNavigate',
30 | 'useNavigationType',
31 | 'useOutlet',
32 | 'useOutletContext',
33 | 'useParams',
34 | 'useResolvedPath',
35 | 'useRoutes',
36 | ],
37 | };
--------------------------------------------------------------------------------
/presets/react-v17.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'React',
6 | members: [
7 | 'Fragment',
8 | 'StrictMode',
9 | 'Profiler',
10 | 'Suspense',
11 | 'Children',
12 | 'Component',
13 | 'PureComponent',
14 | '__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED',
15 | 'cloneElement',
16 | 'createContext',
17 | 'createElement',
18 | 'createFactory',
19 | 'createRef',
20 | 'forwardRef',
21 | 'isValidElement',
22 | 'lazy',
23 | 'memo',
24 | 'useCallback',
25 | 'useContext',
26 | 'useDebugValue',
27 | 'useEffect',
28 | 'useImperativeHandle',
29 | 'useLayoutEffect',
30 | 'useMemo',
31 | 'useReducer',
32 | 'useRef',
33 | 'useState',
34 | 'version',
35 | ],
36 | };
--------------------------------------------------------------------------------
/presets/react-v18.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'React',
6 | members: [
7 | 'Children',
8 | 'Component',
9 | 'Fragment',
10 | 'Profiler',
11 | 'PureComponent',
12 | 'StrictMode',
13 | 'Suspense',
14 | '__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED',
15 | 'cloneElement',
16 | 'createContext',
17 | 'createElement',
18 | 'createFactory',
19 | 'createRef',
20 | 'forwardRef',
21 | 'isValidElement',
22 | 'lazy',
23 | 'memo',
24 | 'startTransition',
25 | 'unstable_act',
26 | 'useCallback',
27 | 'useContext',
28 | 'useDebugValue',
29 | 'useDeferredValue',
30 | 'useEffect',
31 | 'useId',
32 | 'useImperativeHandle',
33 | 'useInsertionEffect',
34 | 'useLayoutEffect',
35 | 'useMemo',
36 | 'useReducer',
37 | 'useRef',
38 | 'useState',
39 | 'useSyncExternalStore',
40 | 'useTransition',
41 | 'version',
42 | ],
43 | };
--------------------------------------------------------------------------------
/presets/redux-v5.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'Redux',
6 | members: [
7 | '__DO_NOT_USE__ActionTypes',
8 | 'applyMiddleware',
9 | 'bindActionCreators',
10 | 'combineReducers',
11 | 'compose',
12 | 'createStore',
13 | ],
14 | };
--------------------------------------------------------------------------------
/presets/vue-composition-api-v1.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'VueCompositionAPI',
6 | members: [
7 | 'EffectScope',
8 | 'computed',
9 | 'createApp',
10 | 'createRef',
11 | 'customRef',
12 | 'default',
13 | 'defineAsyncComponent',
14 | 'defineComponent',
15 | 'del',
16 | 'effectScope',
17 | 'getCurrentInstance',
18 | 'getCurrentScope',
19 | 'h',
20 | 'inject',
21 | 'isRaw',
22 | 'isReactive',
23 | 'isReadonly',
24 | 'isRef',
25 | 'markRaw',
26 | 'nextTick',
27 | 'onActivated',
28 | 'onBeforeMount',
29 | 'onBeforeUnmount',
30 | 'onBeforeUpdate',
31 | 'onDeactivated',
32 | 'onErrorCaptured',
33 | 'onMounted',
34 | 'onScopeDispose',
35 | 'onServerPrefetch',
36 | 'onUnmounted',
37 | 'onUpdated',
38 | 'provide',
39 | 'proxyRefs',
40 | 'reactive',
41 | 'readonly',
42 | 'ref',
43 | 'set',
44 | 'shallowReactive',
45 | 'shallowReadonly',
46 | 'shallowRef',
47 | 'toRaw',
48 | 'toRef',
49 | 'toRefs',
50 | 'triggerRef',
51 | 'unref',
52 | 'useAttrs',
53 | 'useCSSModule',
54 | 'useCssModule',
55 | 'useSlots',
56 | 'version',
57 | 'warn',
58 | 'watch',
59 | 'watchEffect',
60 | 'watchPostEffect',
61 | 'watchSyncEffect',
62 | ],
63 | };
--------------------------------------------------------------------------------
/presets/vue-demi-v2.7.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'VueDemi',
6 | members: [
7 | 'util',
8 | 'set',
9 | 'delete',
10 | 'nextTick',
11 | 'observable',
12 | 'options',
13 | 'use',
14 | 'mixin',
15 | 'cid',
16 | 'extend',
17 | 'component',
18 | 'directive',
19 | 'filter',
20 | 'version',
21 | 'compile',
22 | 'defineComponent',
23 | 'ref',
24 | 'shallowRef',
25 | 'isRef',
26 | 'toRef',
27 | 'toRefs',
28 | 'unref',
29 | 'proxyRefs',
30 | 'customRef',
31 | 'triggerRef',
32 | 'reactive',
33 | 'isReactive',
34 | 'isReadonly',
35 | 'isShallow',
36 | 'isProxy',
37 | 'shallowReactive',
38 | 'markRaw',
39 | 'toRaw',
40 | 'readonly',
41 | 'shallowReadonly',
42 | 'computed',
43 | 'watch',
44 | 'watchEffect',
45 | 'watchPostEffect',
46 | 'watchSyncEffect',
47 | 'EffectScope',
48 | 'effectScope',
49 | 'onScopeDispose',
50 | 'getCurrentScope',
51 | 'provide',
52 | 'inject',
53 | 'h',
54 | 'getCurrentInstance',
55 | 'useSlots',
56 | 'useAttrs',
57 | 'useListeners',
58 | 'mergeDefaults',
59 | 'del',
60 | 'useCssModule',
61 | 'useCssVars',
62 | 'defineAsyncComponent',
63 | 'onBeforeMount',
64 | 'onMounted',
65 | 'onBeforeUpdate',
66 | 'onUpdated',
67 | 'onBeforeUnmount',
68 | 'onUnmounted',
69 | 'onActivated',
70 | 'onDeactivated',
71 | 'onServerPrefetch',
72 | 'onRenderTracked',
73 | 'onRenderTriggered',
74 | 'onErrorCaptured',
75 | 'effect',
76 | 'isVue2',
77 | 'isVue3',
78 | 'install',
79 | 'Vue',
80 | 'Vue2',
81 | 'warn',
82 | 'hasInjectionContext',
83 | 'createApp',
84 | ],
85 | };
86 |
--------------------------------------------------------------------------------
/presets/vue-demi-v2.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'VueDemi',
6 | members: [
7 | 'EffectScope',
8 | 'computed',
9 | 'createApp',
10 | 'createRef',
11 | 'customRef',
12 | 'default',
13 | 'defineAsyncComponent',
14 | 'defineComponent',
15 | 'del',
16 | 'effectScope',
17 | 'getCurrentInstance',
18 | 'getCurrentScope',
19 | 'h',
20 | 'inject',
21 | 'isRaw',
22 | 'isReactive',
23 | 'isReadonly',
24 | 'isRef',
25 | 'markRaw',
26 | 'nextTick',
27 | 'onActivated',
28 | 'onBeforeMount',
29 | 'onBeforeUnmount',
30 | 'onBeforeUpdate',
31 | 'onDeactivated',
32 | 'onErrorCaptured',
33 | 'onMounted',
34 | 'onScopeDispose',
35 | 'onServerPrefetch',
36 | 'onUnmounted',
37 | 'onUpdated',
38 | 'provide',
39 | 'proxyRefs',
40 | 'reactive',
41 | 'readonly',
42 | 'ref',
43 | 'set',
44 | 'shallowReactive',
45 | 'shallowReadonly',
46 | 'shallowRef',
47 | 'toRaw',
48 | 'toRef',
49 | 'toRefs',
50 | 'triggerRef',
51 | 'unref',
52 | 'useAttrs',
53 | 'useCSSModule',
54 | 'useCssModule',
55 | 'useSlots',
56 | 'version',
57 | 'warn',
58 | 'watch',
59 | 'watchEffect',
60 | 'watchPostEffect',
61 | 'watchSyncEffect',
62 | 'isVue2',
63 | 'isVue3',
64 | 'install',
65 | 'Vue',
66 | 'Vue2',
67 | 'hasInjectionContext',
68 | ],
69 | };
70 |
--------------------------------------------------------------------------------
/presets/vue-demi-v3.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'VueDemi',
6 | members: [
7 | 'devtools',
8 | 'BaseTransition',
9 | 'BaseTransitionPropsValidators',
10 | 'Comment',
11 | 'EffectScope',
12 | 'Fragment',
13 | 'KeepAlive',
14 | 'ReactiveEffect',
15 | 'Static',
16 | 'Suspense',
17 | 'Teleport',
18 | 'Text',
19 | 'Transition',
20 | 'TransitionGroup',
21 | 'VueElement',
22 | 'assertNumber',
23 | 'callWithAsyncErrorHandling',
24 | 'callWithErrorHandling',
25 | 'camelize',
26 | 'capitalize',
27 | 'cloneVNode',
28 | 'compatUtils',
29 | 'compile',
30 | 'computed',
31 | 'createApp',
32 | 'createBlock',
33 | 'createCommentVNode',
34 | 'createElementBlock',
35 | 'createElementVNode',
36 | 'createHydrationRenderer',
37 | 'createPropsRestProxy',
38 | 'createRenderer',
39 | 'createSSRApp',
40 | 'createSlots',
41 | 'createStaticVNode',
42 | 'createTextVNode',
43 | 'createVNode',
44 | 'customRef',
45 | 'defineAsyncComponent',
46 | 'defineComponent',
47 | 'defineCustomElement',
48 | 'defineEmits',
49 | 'defineExpose',
50 | 'defineModel',
51 | 'defineOptions',
52 | 'defineProps',
53 | 'defineSSRCustomElement',
54 | 'defineSlots',
55 | 'effect',
56 | 'effectScope',
57 | 'getCurrentInstance',
58 | 'getCurrentScope',
59 | 'getTransitionRawChildren',
60 | 'guardReactiveProps',
61 | 'h',
62 | 'handleError',
63 | 'hasInjectionContext',
64 | 'hydrate',
65 | 'initCustomFormatter',
66 | 'initDirectivesForSSR',
67 | 'inject',
68 | 'isMemoSame',
69 | 'isProxy',
70 | 'isReactive',
71 | 'isReadonly',
72 | 'isRef',
73 | 'isRuntimeOnly',
74 | 'isShallow',
75 | 'isVNode',
76 | 'markRaw',
77 | 'mergeDefaults',
78 | 'mergeModels',
79 | 'mergeProps',
80 | 'nextTick',
81 | 'normalizeClass',
82 | 'normalizeProps',
83 | 'normalizeStyle',
84 | 'onActivated',
85 | 'onBeforeMount',
86 | 'onBeforeUnmount',
87 | 'onBeforeUpdate',
88 | 'onDeactivated',
89 | 'onErrorCaptured',
90 | 'onMounted',
91 | 'onRenderTracked',
92 | 'onRenderTriggered',
93 | 'onScopeDispose',
94 | 'onServerPrefetch',
95 | 'onUnmounted',
96 | 'onUpdated',
97 | 'openBlock',
98 | 'popScopeId',
99 | 'provide',
100 | 'proxyRefs',
101 | 'pushScopeId',
102 | 'queuePostFlushCb',
103 | 'reactive',
104 | 'readonly',
105 | 'ref',
106 | 'registerRuntimeCompiler',
107 | 'render',
108 | 'renderList',
109 | 'renderSlot',
110 | 'resolveComponent',
111 | 'resolveDirective',
112 | 'resolveDynamicComponent',
113 | 'resolveFilter',
114 | 'resolveTransitionHooks',
115 | 'setBlockTracking',
116 | 'setDevtoolsHook',
117 | 'setTransitionHooks',
118 | 'shallowReactive',
119 | 'shallowReadonly',
120 | 'shallowRef',
121 | 'ssrContextKey',
122 | 'ssrUtils',
123 | 'stop',
124 | 'toDisplayString',
125 | 'toHandlerKey',
126 | 'toHandlers',
127 | 'toRaw',
128 | 'toRef',
129 | 'toRefs',
130 | 'toValue',
131 | 'transformVNodeArgs',
132 | 'triggerRef',
133 | 'unref',
134 | 'useAttrs',
135 | 'useCssModule',
136 | 'useCssVars',
137 | 'useModel',
138 | 'useSSRContext',
139 | 'useSlots',
140 | 'useTransitionState',
141 | 'vModelCheckbox',
142 | 'vModelDynamic',
143 | 'vModelRadio',
144 | 'vModelSelect',
145 | 'vModelText',
146 | 'vShow',
147 | 'version',
148 | 'warn',
149 | 'watch',
150 | 'watchEffect',
151 | 'watchPostEffect',
152 | 'watchSyncEffect',
153 | 'withAsyncContext',
154 | 'withCtx',
155 | 'withDefaults',
156 | 'withDirectives',
157 | 'withKeys',
158 | 'withMemo',
159 | 'withModifiers',
160 | 'withScopeId',
161 | 'isVue2',
162 | 'isVue3',
163 | 'install',
164 | 'Vue',
165 | 'Vue2',
166 | 'set',
167 | 'del',
168 | ],
169 | };
170 |
--------------------------------------------------------------------------------
/presets/vue-router-v3.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'VueRouter',
6 | members: [
7 | 'install',
8 | 'version',
9 | ],
10 | };
11 |
--------------------------------------------------------------------------------
/presets/vue-router-v4.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'VueRouter',
6 | members: [
7 | 'NavigationFailureType',
8 | 'RouterLink',
9 | 'RouterView',
10 | 'START_LOCATION',
11 | 'createMemoryHistory',
12 | 'createRouter',
13 | 'createRouterMatcher',
14 | 'createWebHashHistory',
15 | 'createWebHistory',
16 | 'isNavigationFailure',
17 | 'matchedRouteKey',
18 | 'onBeforeRouteLeave',
19 | 'onBeforeRouteUpdate',
20 | 'parseQuery',
21 | 'routeLocationKey',
22 | 'routerKey',
23 | 'routerViewLocationKey',
24 | 'stringifyQuery',
25 | 'useLink',
26 | 'useRoute',
27 | 'useRouter',
28 | 'viewDepthKey',
29 | ],
30 | };
--------------------------------------------------------------------------------
/presets/vue-v2.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'Vue',
6 | members: [
7 | 'util',
8 | 'set',
9 | 'delete',
10 | 'nextTick',
11 | 'observable',
12 | 'options',
13 | 'use',
14 | 'mixin',
15 | 'cid',
16 | 'extend',
17 | 'component',
18 | 'directive',
19 | 'filter',
20 | 'version',
21 | 'compile',
22 | ],
23 | };
--------------------------------------------------------------------------------
/presets/vue-v2_7.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'Vue',
6 | members: [
7 | 'util',
8 | 'set',
9 | 'delete',
10 | 'nextTick',
11 | 'observable',
12 | 'options',
13 | 'use',
14 | 'mixin',
15 | 'cid',
16 | 'extend',
17 | 'component',
18 | 'directive',
19 | 'filter',
20 | 'version',
21 | 'defineComponent',
22 | 'ref',
23 | 'shallowRef',
24 | 'isRef',
25 | 'toRef',
26 | 'toRefs',
27 | 'unref',
28 | 'proxyRefs',
29 | 'customRef',
30 | 'triggerRef',
31 | 'reactive',
32 | 'isReactive',
33 | 'isReadonly',
34 | 'isShallow',
35 | 'isProxy',
36 | 'shallowReactive',
37 | 'markRaw',
38 | 'toRaw',
39 | 'readonly',
40 | 'shallowReadonly',
41 | 'computed',
42 | 'watch',
43 | 'watchEffect',
44 | 'watchPostEffect',
45 | 'watchSyncEffect',
46 | 'EffectScope',
47 | 'effectScope',
48 | 'onScopeDispose',
49 | 'getCurrentScope',
50 | 'provide',
51 | 'inject',
52 | 'h',
53 | 'getCurrentInstance',
54 | 'useSlots',
55 | 'useAttrs',
56 | 'useListeners',
57 | 'mergeDefaults',
58 | 'del',
59 | 'useCssModule',
60 | 'useCssVars',
61 | 'defineAsyncComponent',
62 | 'onBeforeMount',
63 | 'onMounted',
64 | 'onBeforeUpdate',
65 | 'onUpdated',
66 | 'onBeforeUnmount',
67 | 'onUnmounted',
68 | 'onActivated',
69 | 'onDeactivated',
70 | 'onServerPrefetch',
71 | 'onRenderTracked',
72 | 'onRenderTriggered',
73 | 'onErrorCaptured',
74 | '_installedPlugins',
75 | ],
76 | };
--------------------------------------------------------------------------------
/presets/vue-v3.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'Vue',
6 | members: [
7 | 'devtools',
8 | 'BaseTransition',
9 | 'BaseTransitionPropsValidators',
10 | 'Comment',
11 | 'EffectScope',
12 | 'Fragment',
13 | 'KeepAlive',
14 | 'ReactiveEffect',
15 | 'Static',
16 | 'Suspense',
17 | 'Teleport',
18 | 'Text',
19 | 'Transition',
20 | 'TransitionGroup',
21 | 'VueElement',
22 | 'assertNumber',
23 | 'callWithAsyncErrorHandling',
24 | 'callWithErrorHandling',
25 | 'camelize',
26 | 'capitalize',
27 | 'cloneVNode',
28 | 'compatUtils',
29 | 'compile',
30 | 'computed',
31 | 'createApp',
32 | 'createBlock',
33 | 'createCommentVNode',
34 | 'createElementBlock',
35 | 'createElementVNode',
36 | 'createHydrationRenderer',
37 | 'createPropsRestProxy',
38 | 'createRenderer',
39 | 'createSSRApp',
40 | 'createSlots',
41 | 'createStaticVNode',
42 | 'createTextVNode',
43 | 'createVNode',
44 | 'customRef',
45 | 'defineAsyncComponent',
46 | 'defineComponent',
47 | 'defineCustomElement',
48 | 'defineEmits',
49 | 'defineExpose',
50 | 'defineModel',
51 | 'defineOptions',
52 | 'defineProps',
53 | 'defineSSRCustomElement',
54 | 'defineSlots',
55 | 'effect',
56 | 'effectScope',
57 | 'getCurrentInstance',
58 | 'getCurrentScope',
59 | 'getTransitionRawChildren',
60 | 'guardReactiveProps',
61 | 'h',
62 | 'handleError',
63 | 'hasInjectionContext',
64 | 'hydrate',
65 | 'initCustomFormatter',
66 | 'initDirectivesForSSR',
67 | 'inject',
68 | 'isMemoSame',
69 | 'isProxy',
70 | 'isReactive',
71 | 'isReadonly',
72 | 'isRef',
73 | 'isRuntimeOnly',
74 | 'isShallow',
75 | 'isVNode',
76 | 'markRaw',
77 | 'mergeDefaults',
78 | 'mergeModels',
79 | 'mergeProps',
80 | 'nextTick',
81 | 'normalizeClass',
82 | 'normalizeProps',
83 | 'normalizeStyle',
84 | 'onActivated',
85 | 'onBeforeMount',
86 | 'onBeforeUnmount',
87 | 'onBeforeUpdate',
88 | 'onDeactivated',
89 | 'onErrorCaptured',
90 | 'onMounted',
91 | 'onRenderTracked',
92 | 'onRenderTriggered',
93 | 'onScopeDispose',
94 | 'onServerPrefetch',
95 | 'onUnmounted',
96 | 'onUpdated',
97 | 'openBlock',
98 | 'popScopeId',
99 | 'provide',
100 | 'proxyRefs',
101 | 'pushScopeId',
102 | 'queuePostFlushCb',
103 | 'reactive',
104 | 'readonly',
105 | 'ref',
106 | 'registerRuntimeCompiler',
107 | 'render',
108 | 'renderList',
109 | 'renderSlot',
110 | 'resolveComponent',
111 | 'resolveDirective',
112 | 'resolveDynamicComponent',
113 | 'resolveFilter',
114 | 'resolveTransitionHooks',
115 | 'setBlockTracking',
116 | 'setDevtoolsHook',
117 | 'setTransitionHooks',
118 | 'shallowReactive',
119 | 'shallowReadonly',
120 | 'shallowRef',
121 | 'ssrContextKey',
122 | 'ssrUtils',
123 | 'stop',
124 | 'toDisplayString',
125 | 'toHandlerKey',
126 | 'toHandlers',
127 | 'toRaw',
128 | 'toRef',
129 | 'toRefs',
130 | 'toValue',
131 | 'transformVNodeArgs',
132 | 'triggerRef',
133 | 'unref',
134 | 'useAttrs',
135 | 'useCssModule',
136 | 'useCssVars',
137 | 'useModel',
138 | 'useSSRContext',
139 | 'useSlots',
140 | 'useTransitionState',
141 | 'vModelCheckbox',
142 | 'vModelDynamic',
143 | 'vModelRadio',
144 | 'vModelSelect',
145 | 'vModelText',
146 | 'vShow',
147 | 'version',
148 | 'warn',
149 | 'watch',
150 | 'watchEffect',
151 | 'watchPostEffect',
152 | 'watchSyncEffect',
153 | 'withAsyncContext',
154 | 'withCtx',
155 | 'withDefaults',
156 | 'withDirectives',
157 | 'withKeys',
158 | 'withMemo',
159 | 'withModifiers',
160 | 'withScopeId',
161 | ],
162 | };
--------------------------------------------------------------------------------
/presets/vuex-v3.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'Vuex',
6 | members: [
7 | 'version',
8 | 'Store',
9 | 'install',
10 | 'mapState',
11 | 'mapMutations',
12 | 'mapGetters',
13 | 'mapActions',
14 | 'createNamespacedHelpers',
15 | 'createLogger',
16 | ],
17 | };
--------------------------------------------------------------------------------
/presets/vuex-v4.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type {import('.').LibMeta}
3 | */
4 | module.exports = {
5 | name: 'Vuex',
6 | members: [
7 | 'version',
8 | 'Store',
9 | 'storeKey',
10 | 'createStore',
11 | 'useStore',
12 | 'mapState',
13 | 'mapMutations',
14 | 'mapGetters',
15 | 'mapActions',
16 | 'createNamespacedHelpers',
17 | 'createLogger'
18 | ],
19 | };
--------------------------------------------------------------------------------
/test/-.js:
--------------------------------------------------------------------------------
1 | import { message } from 'foo'
2 | console.log(message) // foo
--------------------------------------------------------------------------------
/test/.gitignore:
--------------------------------------------------------------------------------
1 | /-.cjs
2 | /-.mjs
--------------------------------------------------------------------------------
/test/index.mjs:
--------------------------------------------------------------------------------
1 | import path from 'node:path';
2 | import cp from 'node:child_process';
3 | import { fileURLToPath } from 'node:url';
4 | import { strict as assert } from 'node:assert';
5 | import { build } from 'vite';
6 | import resolve from '../dist/index.mjs';
7 |
8 | const __dirname = path.dirname(fileURLToPath(import.meta.url));
9 |
10 | await build({
11 | root: __dirname,
12 | build: {
13 | minify: false,
14 | outDir: '',
15 | emptyOutDir: false,
16 | lib: {
17 | entry: '-.js',
18 | formats: ['es'],
19 | fileName: format => format === 'cjs' ? '[name].cjs' : '[name].mjs',
20 | },
21 | },
22 | plugins: [
23 | resolve({
24 | foo: `
25 | const message = 'foo';
26 | export {
27 | message,
28 | };
29 | `,
30 | }),
31 | ],
32 | });
33 |
34 | cp.spawn('node', ['./-.mjs'], { cwd: __dirname })
35 | .stdout.on('data', chunk => {
36 | const str = chunk.toString().trim();
37 | assert.equal(str, 'foo');
38 | console.log('[test] success');
39 | });
40 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2022",
4 | "module": "ESNext",
5 | "esModuleInterop": true,
6 | "moduleResolution": "Node",
7 | "resolveJsonModule": true,
8 | "strict": true,
9 | "allowJs": true,
10 | "declaration": true,
11 | "skipLibCheck": true,
12 | "allowSyntheticDefaultImports": true,
13 | "baseUrl": ".",
14 | "outDir": "./dist",
15 | "emitDeclarationOnly": true
16 | },
17 | "include": ["index.ts"]
18 | }
19 |
--------------------------------------------------------------------------------
/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { spawn } from 'node:child_process';
2 | import { builtinModules } from 'node:module';
3 | import { defineConfig } from 'vite';
4 | import pkg from './package.json';
5 |
6 | export default defineConfig({
7 | build: {
8 | minify: false,
9 | emptyOutDir: true,
10 | target: 'node14',
11 | lib: {
12 | entry: {
13 | index: './index.ts'
14 | },
15 | formats: ['cjs', 'es'],
16 | fileName: format => (format === 'es' ? '[name].mjs' : '[name].js'),
17 | },
18 | rollupOptions: {
19 | external: [
20 | 'vite',
21 | ...builtinModules,
22 | ...builtinModules.map(m => `node:${m}`),
23 | ...Object.keys(
24 | 'dependencies' in pkg ? (pkg.dependencies as object) : {}
25 | ),
26 | ],
27 | output: {
28 | exports: 'named',
29 | },
30 | },
31 | },
32 | plugins: [
33 | {
34 | name: 'generate-types',
35 | async closeBundle() {
36 | if (process.env.NODE_ENV === 'test') return;
37 | await generateTypes();
38 | },
39 | },
40 | ],
41 | });
42 |
43 | function generateTypes() {
44 | return new Promise(resolve => {
45 | const cp = spawn(
46 | process.platform === 'win32' ? 'npm.cmd' : 'npm',
47 | ['run', 'types'],
48 | { stdio: 'inherit' }
49 | );
50 | cp.on('exit', code => {
51 | !code && console.log('[types]', 'declaration generated');
52 | resolve(code);
53 | });
54 | cp.on('error', process.exit);
55 | });
56 | }
57 |
--------------------------------------------------------------------------------