@open-xchange/vite-plugin-es-decorators 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +34 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +22 -17
- package/dist/index.d.ts +0 -9
- package/dist/index.js +0 -36
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Plugin } from "vite";
|
|
2
|
+
|
|
3
|
+
//#region src/index.d.ts
|
|
4
|
+
declare const PROJECT_NAME = "@open-xchange/vite-plugin-es-decorators";
|
|
5
|
+
/**
|
|
6
|
+
* Vite plugin that adds support for native ES decorators in JS source files.
|
|
7
|
+
*
|
|
8
|
+
* @returns
|
|
9
|
+
* The Vite plugin object.
|
|
10
|
+
*/
|
|
11
|
+
declare function vitePluginEsDecorators(): Promise<Plugin>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { PROJECT_NAME, vitePluginEsDecorators as default };
|
|
14
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAOa,YAAA;;AAAb;;;;;iBAY8B,sBAAA,CAAA,GAA0B,OAAA,CAAQ,MAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { version } from "vite";
|
|
2
|
+
import vitePluginBabel from "vite-plugin-babel";
|
|
3
|
+
import rolldownPluginBabel from "@rolldown/plugin-babel";
|
|
4
|
+
//#region src/index.ts
|
|
5
|
+
const PROJECT_NAME = "@open-xchange/vite-plugin-es-decorators";
|
|
6
|
+
const VITE_VERSION = parseInt(version.split(".")[0], 10);
|
|
7
|
+
/**
|
|
8
|
+
* Vite plugin that adds support for native ES decorators in JS source files.
|
|
9
|
+
*
|
|
10
|
+
* @returns
|
|
11
|
+
* The Vite plugin object.
|
|
12
|
+
*/
|
|
13
|
+
async function vitePluginEsDecorators() {
|
|
14
|
+
const plugin = { name: PROJECT_NAME };
|
|
15
|
+
const babelPlugins = [["@babel/plugin-proposal-decorators", { version: "2023-11" }]];
|
|
16
|
+
if (VITE_VERSION >= 8) Object.assign(plugin, await rolldownPluginBabel({ presets: [{
|
|
17
|
+
preset: () => ({ plugins: babelPlugins }),
|
|
18
|
+
rolldown: { filter: { code: "@" } }
|
|
19
|
+
}] }));
|
|
20
|
+
else {
|
|
21
|
+
const babelPlugin = vitePluginBabel({ babelConfig: {
|
|
22
|
+
babelrc: false,
|
|
23
|
+
configFile: false,
|
|
24
|
+
plugins: babelPlugins
|
|
25
|
+
} });
|
|
26
|
+
const config = babelPlugin.config;
|
|
27
|
+
Object.assign(plugin, babelPlugin, { config: () => Object.assign(config(), { esbuild: { target: "es2022" } }) });
|
|
28
|
+
}
|
|
29
|
+
return plugin;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { PROJECT_NAME, vitePluginEsDecorators as default };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["\nimport { type Plugin, type UserConfig, version } from 'vite'\nimport vitePluginBabel from 'vite-plugin-babel'\nimport rolldownPluginBabel from '@rolldown/plugin-babel'\n\n// constants ==================================================================\n\nexport const PROJECT_NAME = '@open-xchange/vite-plugin-es-decorators'\n\nconst VITE_VERSION = parseInt(version.split('.')[0], 10)\n\n// plugin =====================================================================\n\n/**\n * Vite plugin that adds support for native ES decorators in JS source files.\n *\n * @returns\n * The Vite plugin object.\n */\nexport default async function vitePluginEsDecorators(): Promise<Plugin> {\n\n const plugin: Plugin = { name: PROJECT_NAME }\n const babelPlugins = [['@babel/plugin-proposal-decorators', { version: '2023-11' }]]\n\n if (VITE_VERSION >= 8) {\n Object.assign(plugin, await rolldownPluginBabel({\n presets: [{\n preset: () => ({ plugins: babelPlugins }),\n // only for source files with decorators\n rolldown: { filter: { code: '@' } },\n }],\n }))\n } else {\n const babelPlugin = vitePluginBabel({\n babelConfig: { babelrc: false, configFile: false, plugins: babelPlugins },\n })\n const config = babelPlugin.config as () => UserConfig\n Object.assign(plugin, babelPlugin, {\n config: () => Object.assign(config(), { esbuild: { target: 'es2022' } }),\n })\n }\n\n return plugin\n}\n"],"mappings":";;;;AAOA,MAAa,eAAe;AAE5B,MAAM,eAAe,SAAS,QAAQ,MAAM,IAAI,CAAC,IAAI,GAAG;;;;;;;AAUxD,eAA8B,yBAA0C;CAEtE,MAAM,SAAiB,EAAE,MAAM,cAAc;CAC7C,MAAM,eAAe,CAAC,CAAC,qCAAqC,EAAE,SAAS,WAAW,CAAC,CAAC;AAEpF,KAAI,gBAAgB,EAClB,QAAO,OAAO,QAAQ,MAAM,oBAAoB,EAC9C,SAAS,CAAC;EACR,eAAe,EAAE,SAAS,cAAc;EAExC,UAAU,EAAE,QAAQ,EAAE,MAAM,KAAK,EAAE;EACpC,CAAC,EACH,CAAC,CAAC;MACE;EACL,MAAM,cAAc,gBAAgB,EAClC,aAAa;GAAE,SAAS;GAAO,YAAY;GAAO,SAAS;GAAc,EAC1E,CAAC;EACF,MAAM,SAAS,YAAY;AAC3B,SAAO,OAAO,QAAQ,aAAa,EACjC,cAAc,OAAO,OAAO,QAAQ,EAAE,EAAE,SAAS,EAAE,QAAQ,UAAU,EAAE,CAAC,EACzE,CAAC;;AAGJ,QAAO"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-xchange/vite-plugin-es-decorators",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Vite plugin that adds support for native ES decorators in JS source files",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "https://gitlab.open-xchange.com/fspd/commons/plugins",
|
|
7
|
+
"url": "git+https://gitlab.open-xchange.com/fspd/commons/plugins.git",
|
|
8
8
|
"directory": "packages/vite-plugin-es-decorators"
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
"node": ">=20.18"
|
|
13
13
|
},
|
|
14
14
|
"type": "module",
|
|
15
|
-
"exports":
|
|
15
|
+
"exports": {
|
|
16
|
+
".": "./dist/index.mjs",
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
16
19
|
"files": [
|
|
17
20
|
"dist",
|
|
18
21
|
"CHANGELOG.*"
|
|
@@ -20,28 +23,30 @@
|
|
|
20
23
|
"dependencies": {
|
|
21
24
|
"@babel/core": "^7.29.0",
|
|
22
25
|
"@babel/plugin-proposal-decorators": "^7.29.0",
|
|
23
|
-
"@rolldown/plugin-babel": "^0.2.
|
|
24
|
-
"vite-plugin-babel": "^1.
|
|
26
|
+
"@rolldown/plugin-babel": "^0.2.2",
|
|
27
|
+
"vite-plugin-babel": "^1.6.0"
|
|
25
28
|
},
|
|
26
29
|
"devDependencies": {
|
|
27
30
|
"@types/babel__core": "^7.20.5",
|
|
28
|
-
"@vitest/coverage-v8": "^4.1.
|
|
29
|
-
"vite": "^8.0.
|
|
30
|
-
"vite-v6": "npm:vite@^
|
|
31
|
-
"vite-v7": "npm:vite@^
|
|
32
|
-
"vite-v8": "npm:vite@^8.0.
|
|
33
|
-
"vitest": "^4.1.
|
|
34
|
-
"@open-xchange/linter-presets": "^1.
|
|
35
|
-
"@open-xchange/
|
|
31
|
+
"@vitest/coverage-v8": "^4.1.3",
|
|
32
|
+
"vite": "^8.0.8",
|
|
33
|
+
"vite-v6": "npm:vite@^8.0.8",
|
|
34
|
+
"vite-v7": "npm:vite@^8.0.8",
|
|
35
|
+
"vite-v8": "npm:vite@^8.0.8",
|
|
36
|
+
"vitest": "^4.1.3",
|
|
37
|
+
"@open-xchange/linter-presets": "^1.22.0",
|
|
38
|
+
"@open-xchange/tsconfig": "^0.0.2",
|
|
39
|
+
"@open-xchange/vitest-plugin-extended": "^1.6.0",
|
|
40
|
+
"@open-xchange/vitest-vite-plugin-utils": "^0.0.2"
|
|
36
41
|
},
|
|
37
42
|
"peerDependencies": {
|
|
38
43
|
"vite": "^8.0.0"
|
|
39
44
|
},
|
|
40
45
|
"scripts": {
|
|
41
|
-
"build": "
|
|
42
|
-
"clean": "premove dist",
|
|
46
|
+
"build": "tsdown",
|
|
43
47
|
"coverage": "vitest run --coverage",
|
|
44
|
-
"lint": "tsc && tsc --project src
|
|
45
|
-
"test": "vitest run"
|
|
48
|
+
"lint": "tsc && tsc --project src && tsc --project test && eslint .",
|
|
49
|
+
"test": "vitest run",
|
|
50
|
+
"verify": "pnpm build && pnpm lint && pnpm test"
|
|
46
51
|
}
|
|
47
52
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type Plugin } from 'vite';
|
|
2
|
-
export declare const PROJECT_NAME = "@open-xchange/vite-plugin-es-decorators";
|
|
3
|
-
/**
|
|
4
|
-
* Vite plugin that adds support for native ES decorators in JS source files.
|
|
5
|
-
*
|
|
6
|
-
* @returns
|
|
7
|
-
* The Vite plugin object.
|
|
8
|
-
*/
|
|
9
|
-
export default function vitePluginEsDecorators(): Promise<Plugin>;
|
package/dist/index.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { version } from 'vite';
|
|
2
|
-
import vitePluginBabel from 'vite-plugin-babel';
|
|
3
|
-
import rolldownPluginBabel from '@rolldown/plugin-babel';
|
|
4
|
-
// constants ==================================================================
|
|
5
|
-
export const PROJECT_NAME = '@open-xchange/vite-plugin-es-decorators';
|
|
6
|
-
const VITE_VERSION = parseInt(version.split('.')[0], 10);
|
|
7
|
-
// plugin =====================================================================
|
|
8
|
-
/**
|
|
9
|
-
* Vite plugin that adds support for native ES decorators in JS source files.
|
|
10
|
-
*
|
|
11
|
-
* @returns
|
|
12
|
-
* The Vite plugin object.
|
|
13
|
-
*/
|
|
14
|
-
export default async function vitePluginEsDecorators() {
|
|
15
|
-
const plugin = { name: PROJECT_NAME };
|
|
16
|
-
const babelPlugins = [['@babel/plugin-proposal-decorators', { version: '2023-11' }]];
|
|
17
|
-
if (VITE_VERSION >= 8) {
|
|
18
|
-
Object.assign(plugin, await rolldownPluginBabel({
|
|
19
|
-
presets: [{
|
|
20
|
-
preset: () => ({ plugins: babelPlugins }),
|
|
21
|
-
// only for source files with decorators
|
|
22
|
-
rolldown: { filter: { code: '@' } },
|
|
23
|
-
}],
|
|
24
|
-
}));
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
const babelPlugin = vitePluginBabel({
|
|
28
|
-
babelConfig: { babelrc: false, configFile: false, plugins: babelPlugins },
|
|
29
|
-
});
|
|
30
|
-
const config = babelPlugin.config;
|
|
31
|
-
Object.assign(plugin, babelPlugin, {
|
|
32
|
-
config: () => Object.assign(config(), { esbuild: { target: 'es2022' } }),
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
return plugin;
|
|
36
|
-
}
|