unplugin-jsx-source 0.1.2
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/LICENSE +21 -0
- package/README.md +115 -0
- package/dist/astro.cjs +21 -0
- package/dist/astro.d.cts +7 -0
- package/dist/astro.d.ts +7 -0
- package/dist/astro.js +19 -0
- package/dist/chunk-4CXGYDJU.js +58 -0
- package/dist/chunk-A4KZOKT4.cjs +58 -0
- package/dist/chunk-D73UW2IR.cjs +32 -0
- package/dist/chunk-DGY54NDT.js +11 -0
- package/dist/chunk-OUJGOKNR.cjs +11 -0
- package/dist/chunk-P5DL7FEC.cjs +11 -0
- package/dist/chunk-PGUIHQNS.js +11 -0
- package/dist/chunk-RTGSRM4I.js +32 -0
- package/dist/esbuild.cjs +13 -0
- package/dist/esbuild.d.cts +8 -0
- package/dist/esbuild.d.ts +8 -0
- package/dist/esbuild.js +11 -0
- package/dist/farm.cjs +13 -0
- package/dist/farm.d.cts +8 -0
- package/dist/farm.d.ts +8 -0
- package/dist/farm.js +11 -0
- package/dist/index.cjs +11 -0
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +11 -0
- package/dist/nuxt.cjs +30 -0
- package/dist/nuxt.d.cts +10 -0
- package/dist/nuxt.d.ts +10 -0
- package/dist/nuxt.js +28 -0
- package/dist/options.cjs +6 -0
- package/dist/options.d.cts +26 -0
- package/dist/options.d.ts +26 -0
- package/dist/options.js +6 -0
- package/dist/rollup.cjs +13 -0
- package/dist/rollup.d.cts +8 -0
- package/dist/rollup.d.ts +8 -0
- package/dist/rollup.js +11 -0
- package/dist/rspack.cjs +13 -0
- package/dist/rspack.d.cts +7 -0
- package/dist/rspack.d.ts +7 -0
- package/dist/rspack.js +11 -0
- package/dist/vite.cjs +10 -0
- package/dist/vite.d.cts +8 -0
- package/dist/vite.d.ts +8 -0
- package/dist/vite.js +8 -0
- package/dist/webpack.cjs +10 -0
- package/dist/webpack.d.cts +8 -0
- package/dist/webpack.d.ts +8 -0
- package/dist/webpack.js +8 -0
- package/package.json +153 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Anthony Fu <https://github.com/antfu>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# unplugin-jsx-source
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/unplugin-jsx-source)
|
|
4
|
+
|
|
5
|
+
A plugin designed to automatically annotate your JSX components with a `data-at`(configurable) attribute, indicating the file name and line number for easier debugging and development.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i unplugin-jsx-source
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
<details>
|
|
14
|
+
<summary>Vite</summary><br>
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
// vite.config.ts
|
|
18
|
+
import Starter from 'unplugin-jsx-source/vite'
|
|
19
|
+
|
|
20
|
+
export default defineConfig({
|
|
21
|
+
plugins: [
|
|
22
|
+
Starter({ /* options */ }),
|
|
23
|
+
],
|
|
24
|
+
})
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Example: [`playground/`](./playground/)
|
|
28
|
+
|
|
29
|
+
<br></details>
|
|
30
|
+
|
|
31
|
+
<details>
|
|
32
|
+
<summary>Rollup</summary><br>
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
// rollup.config.js
|
|
36
|
+
import Starter from 'unplugin-jsx-source/rollup'
|
|
37
|
+
|
|
38
|
+
export default {
|
|
39
|
+
plugins: [
|
|
40
|
+
Starter({ /* options */ }),
|
|
41
|
+
],
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
<br></details>
|
|
46
|
+
|
|
47
|
+
<details>
|
|
48
|
+
<summary>Webpack</summary><br>
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
// webpack.config.js
|
|
52
|
+
module.exports = {
|
|
53
|
+
/* ... */
|
|
54
|
+
plugins: [
|
|
55
|
+
require('unplugin-jsx-source/webpack')({ /* options */ })
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
<br></details>
|
|
61
|
+
|
|
62
|
+
<details>
|
|
63
|
+
<summary>Nuxt</summary><br>
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
// nuxt.config.js
|
|
67
|
+
export default defineNuxtConfig({
|
|
68
|
+
modules: [
|
|
69
|
+
['unplugin-jsx-source/nuxt', { /* options */ }],
|
|
70
|
+
],
|
|
71
|
+
})
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
> This module works for both Nuxt 2 and [Nuxt Vite](https://github.com/nuxt/vite)
|
|
75
|
+
|
|
76
|
+
<br></details>
|
|
77
|
+
|
|
78
|
+
<details>
|
|
79
|
+
<summary>Vue CLI</summary><br>
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
// vue.config.js
|
|
83
|
+
module.exports = {
|
|
84
|
+
configureWebpack: {
|
|
85
|
+
plugins: [
|
|
86
|
+
require('unplugin-jsx-source/webpack')({ /* options */ }),
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
<br></details>
|
|
93
|
+
|
|
94
|
+
<details>
|
|
95
|
+
<summary>esbuild</summary><br>
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
// esbuild.config.js
|
|
99
|
+
import { build } from 'esbuild'
|
|
100
|
+
import Starter from 'unplugin-jsx-source/esbuild'
|
|
101
|
+
|
|
102
|
+
build({
|
|
103
|
+
plugins: [Starter()],
|
|
104
|
+
})
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
<br></details>
|
|
108
|
+
|
|
109
|
+
## Made with
|
|
110
|
+
|
|
111
|
+
https://github.com/unplugin/unplugin-starter/
|
|
112
|
+
|
|
113
|
+
cause I saw that idea again from Nate (Tamagui's author) https://x.com/natebirdman/status/1890913196967419958
|
|
114
|
+
|
|
115
|
+
although Astro also has it with `<div data-astro-source-file="/absolute/path/file.astro" data-astro-source-loc="72:49"`
|
package/dist/astro.cjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkA4KZOKT4cjs = require('./chunk-A4KZOKT4.cjs');
|
|
4
|
+
require('./chunk-D73UW2IR.cjs');
|
|
5
|
+
|
|
6
|
+
// src/astro.ts
|
|
7
|
+
var astro_default = (options) => ({
|
|
8
|
+
name: "unplugin-jsx-source",
|
|
9
|
+
hooks: {
|
|
10
|
+
"astro:config:setup": async (astro) => {
|
|
11
|
+
var _a;
|
|
12
|
+
(_a = astro.config.vite).plugins || (_a.plugins = []);
|
|
13
|
+
astro.config.vite.plugins.push(_chunkA4KZOKT4cjs.index_default.vite(options));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.default = astro_default;
|
|
20
|
+
|
|
21
|
+
module.exports = exports.default;
|
package/dist/astro.d.cts
ADDED
package/dist/astro.d.ts
ADDED
package/dist/astro.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
index_default
|
|
3
|
+
} from "./chunk-4CXGYDJU.js";
|
|
4
|
+
import "./chunk-RTGSRM4I.js";
|
|
5
|
+
|
|
6
|
+
// src/astro.ts
|
|
7
|
+
var astro_default = (options) => ({
|
|
8
|
+
name: "unplugin-jsx-source",
|
|
9
|
+
hooks: {
|
|
10
|
+
"astro:config:setup": async (astro) => {
|
|
11
|
+
var _a;
|
|
12
|
+
(_a = astro.config.vite).plugins || (_a.plugins = []);
|
|
13
|
+
astro.config.vite.plugins.push(index_default.vite(options));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
astro_default as default
|
|
19
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__spreadValues,
|
|
3
|
+
resolveOption
|
|
4
|
+
} from "./chunk-RTGSRM4I.js";
|
|
5
|
+
|
|
6
|
+
// src/index.ts
|
|
7
|
+
import { parse } from "@babel/parser";
|
|
8
|
+
import _traverse from "@babel/traverse";
|
|
9
|
+
import _generate from "@babel/generator";
|
|
10
|
+
import * as t from "@babel/types";
|
|
11
|
+
import { createFilter } from "unplugin-utils";
|
|
12
|
+
import { createUnplugin } from "unplugin";
|
|
13
|
+
var traverse = _traverse.default || _traverse;
|
|
14
|
+
var generate = _generate.default || _generate;
|
|
15
|
+
var unpluginFactory = (options = {}) => {
|
|
16
|
+
const opt = resolveOption(options);
|
|
17
|
+
const filter = createFilter(opt.include, opt.exclude);
|
|
18
|
+
return {
|
|
19
|
+
name: "unplugin-jsx-source",
|
|
20
|
+
enforce: opt.enforce,
|
|
21
|
+
transformInclude(id) {
|
|
22
|
+
return filter(id);
|
|
23
|
+
},
|
|
24
|
+
transform(code, id) {
|
|
25
|
+
const ast = parse(code, __spreadValues({
|
|
26
|
+
sourceType: "module",
|
|
27
|
+
plugins: ["jsx", "typescript"]
|
|
28
|
+
}, opt.parserOptions));
|
|
29
|
+
traverse(ast, {
|
|
30
|
+
JSXOpeningElement(path) {
|
|
31
|
+
if (path.node.name.type === "JSXIdentifier" && path.node.loc) {
|
|
32
|
+
const filename = id.split("/").pop();
|
|
33
|
+
const dataAtAttr = t.jsxAttribute(
|
|
34
|
+
t.jsxIdentifier(opt.attribute),
|
|
35
|
+
t.stringLiteral(
|
|
36
|
+
`${filename}:${path.node.loc.start.line}-${path.node.loc.end.line}`
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
path.node.attributes.unshift(dataAtAttr);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const { code: transformedCode } = generate(ast, { filename: id }, code);
|
|
44
|
+
return {
|
|
45
|
+
code: transformedCode,
|
|
46
|
+
map: null
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
var unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
|
|
52
|
+
var index_default = unplugin;
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
unpluginFactory,
|
|
56
|
+
unplugin,
|
|
57
|
+
index_default
|
|
58
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkD73UW2IRcjs = require('./chunk-D73UW2IR.cjs');
|
|
5
|
+
|
|
6
|
+
// src/index.ts
|
|
7
|
+
var _parser = require('@babel/parser');
|
|
8
|
+
var _traverse2 = require('@babel/traverse'); var _traverse3 = _interopRequireDefault(_traverse2);
|
|
9
|
+
var _generator = require('@babel/generator'); var _generator2 = _interopRequireDefault(_generator);
|
|
10
|
+
var _types = require('@babel/types'); var t = _interopRequireWildcard(_types);
|
|
11
|
+
var _unpluginutils = require('unplugin-utils');
|
|
12
|
+
var _unplugin = require('unplugin');
|
|
13
|
+
var traverse = _traverse3.default.default || _traverse3.default;
|
|
14
|
+
var generate = _generator2.default.default || _generator2.default;
|
|
15
|
+
var unpluginFactory = (options = {}) => {
|
|
16
|
+
const opt = _chunkD73UW2IRcjs.resolveOption.call(void 0, options);
|
|
17
|
+
const filter = _unpluginutils.createFilter.call(void 0, opt.include, opt.exclude);
|
|
18
|
+
return {
|
|
19
|
+
name: "unplugin-jsx-source",
|
|
20
|
+
enforce: opt.enforce,
|
|
21
|
+
transformInclude(id) {
|
|
22
|
+
return filter(id);
|
|
23
|
+
},
|
|
24
|
+
transform(code, id) {
|
|
25
|
+
const ast = _parser.parse.call(void 0, code, _chunkD73UW2IRcjs.__spreadValues.call(void 0, {
|
|
26
|
+
sourceType: "module",
|
|
27
|
+
plugins: ["jsx", "typescript"]
|
|
28
|
+
}, opt.parserOptions));
|
|
29
|
+
traverse(ast, {
|
|
30
|
+
JSXOpeningElement(path) {
|
|
31
|
+
if (path.node.name.type === "JSXIdentifier" && path.node.loc) {
|
|
32
|
+
const filename = id.split("/").pop();
|
|
33
|
+
const dataAtAttr = t.jsxAttribute(
|
|
34
|
+
t.jsxIdentifier(opt.attribute),
|
|
35
|
+
t.stringLiteral(
|
|
36
|
+
`${filename}:${path.node.loc.start.line}-${path.node.loc.end.line}`
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
path.node.attributes.unshift(dataAtAttr);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const { code: transformedCode } = generate(ast, { filename: id }, code);
|
|
44
|
+
return {
|
|
45
|
+
code: transformedCode,
|
|
46
|
+
map: null
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
var unplugin = /* @__PURE__ */ _unplugin.createUnplugin.call(void 0, unpluginFactory);
|
|
52
|
+
var index_default = unplugin;
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
exports.unpluginFactory = unpluginFactory; exports.unplugin = unplugin; exports.index_default = index_default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// src/options.ts
|
|
19
|
+
function resolveOption(options) {
|
|
20
|
+
return {
|
|
21
|
+
include: options.include || [/\.[jt]sx?$/],
|
|
22
|
+
exclude: options.exclude || void 0,
|
|
23
|
+
enforce: options.enforce || void 0,
|
|
24
|
+
parserOptions: options.parserOptions || {},
|
|
25
|
+
attribute: options.attribute || "data-at"
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
exports.__spreadValues = __spreadValues; exports.resolveOption = resolveOption;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkA4KZOKT4cjs = require('./chunk-A4KZOKT4.cjs');
|
|
4
|
+
|
|
5
|
+
// src/webpack.ts
|
|
6
|
+
var _unplugin = require('unplugin');
|
|
7
|
+
var webpack_default = _unplugin.createWebpackPlugin.call(void 0, _chunkA4KZOKT4cjs.unpluginFactory);
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.webpack_default = webpack_default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkA4KZOKT4cjs = require('./chunk-A4KZOKT4.cjs');
|
|
4
|
+
|
|
5
|
+
// src/vite.ts
|
|
6
|
+
var _unplugin = require('unplugin');
|
|
7
|
+
var vite_default = _unplugin.createVitePlugin.call(void 0, _chunkA4KZOKT4cjs.unpluginFactory);
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.vite_default = vite_default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// src/options.ts
|
|
19
|
+
function resolveOption(options) {
|
|
20
|
+
return {
|
|
21
|
+
include: options.include || [/\.[jt]sx?$/],
|
|
22
|
+
exclude: options.exclude || void 0,
|
|
23
|
+
enforce: options.enforce || void 0,
|
|
24
|
+
parserOptions: options.parserOptions || {},
|
|
25
|
+
attribute: options.attribute || "data-at"
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
__spreadValues,
|
|
31
|
+
resolveOption
|
|
32
|
+
};
|
package/dist/esbuild.cjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkA4KZOKT4cjs = require('./chunk-A4KZOKT4.cjs');
|
|
4
|
+
require('./chunk-D73UW2IR.cjs');
|
|
5
|
+
|
|
6
|
+
// src/esbuild.ts
|
|
7
|
+
var _unplugin = require('unplugin');
|
|
8
|
+
var esbuild_default = _unplugin.createEsbuildPlugin.call(void 0, _chunkA4KZOKT4cjs.unpluginFactory);
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.default = esbuild_default;
|
|
12
|
+
|
|
13
|
+
module.exports = exports.default;
|
package/dist/esbuild.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
unpluginFactory
|
|
3
|
+
} from "./chunk-4CXGYDJU.js";
|
|
4
|
+
import "./chunk-RTGSRM4I.js";
|
|
5
|
+
|
|
6
|
+
// src/esbuild.ts
|
|
7
|
+
import { createEsbuildPlugin } from "unplugin";
|
|
8
|
+
var esbuild_default = createEsbuildPlugin(unpluginFactory);
|
|
9
|
+
export {
|
|
10
|
+
esbuild_default as default
|
|
11
|
+
};
|
package/dist/farm.cjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkA4KZOKT4cjs = require('./chunk-A4KZOKT4.cjs');
|
|
4
|
+
require('./chunk-D73UW2IR.cjs');
|
|
5
|
+
|
|
6
|
+
// src/farm.ts
|
|
7
|
+
var _unplugin = require('unplugin');
|
|
8
|
+
var farm_default = _unplugin.createFarmPlugin.call(void 0, _chunkA4KZOKT4cjs.unpluginFactory);
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.default = farm_default;
|
|
12
|
+
|
|
13
|
+
module.exports = exports.default;
|
package/dist/farm.d.cts
ADDED
package/dist/farm.d.ts
ADDED
package/dist/farm.js
ADDED
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkA4KZOKT4cjs = require('./chunk-A4KZOKT4.cjs');
|
|
6
|
+
require('./chunk-D73UW2IR.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.default = _chunkA4KZOKT4cjs.index_default; exports.unplugin = _chunkA4KZOKT4cjs.unplugin; exports.unpluginFactory = _chunkA4KZOKT4cjs.unpluginFactory;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as _unplugin from 'unplugin';
|
|
2
|
+
import { UnpluginFactory } from 'unplugin';
|
|
3
|
+
import { Options } from './options.cjs';
|
|
4
|
+
import '@babel/parser';
|
|
5
|
+
import 'unplugin-utils';
|
|
6
|
+
|
|
7
|
+
declare const unpluginFactory: UnpluginFactory<Options | undefined>;
|
|
8
|
+
declare const unplugin: _unplugin.UnpluginInstance<Options | undefined, boolean>;
|
|
9
|
+
|
|
10
|
+
export { unplugin as default, unplugin, unpluginFactory };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as _unplugin from 'unplugin';
|
|
2
|
+
import { UnpluginFactory } from 'unplugin';
|
|
3
|
+
import { Options } from './options.js';
|
|
4
|
+
import '@babel/parser';
|
|
5
|
+
import 'unplugin-utils';
|
|
6
|
+
|
|
7
|
+
declare const unpluginFactory: UnpluginFactory<Options | undefined>;
|
|
8
|
+
declare const unplugin: _unplugin.UnpluginInstance<Options | undefined, boolean>;
|
|
9
|
+
|
|
10
|
+
export { unplugin as default, unplugin, unpluginFactory };
|
package/dist/index.js
ADDED
package/dist/nuxt.cjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkP5DL7FECcjs = require('./chunk-P5DL7FEC.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkOUJGOKNRcjs = require('./chunk-OUJGOKNR.cjs');
|
|
7
|
+
require('./chunk-A4KZOKT4.cjs');
|
|
8
|
+
require('./chunk-D73UW2IR.cjs');
|
|
9
|
+
|
|
10
|
+
// src/nuxt.ts
|
|
11
|
+
var _kit = require('@nuxt/kit');
|
|
12
|
+
require('@nuxt/schema');
|
|
13
|
+
var nuxt_default = _kit.defineNuxtModule.call(void 0, {
|
|
14
|
+
meta: {
|
|
15
|
+
name: "nuxt-unplugin-jsx-source",
|
|
16
|
+
configKey: "unpluginStarter"
|
|
17
|
+
},
|
|
18
|
+
defaults: {
|
|
19
|
+
// ...default options
|
|
20
|
+
},
|
|
21
|
+
setup(options, _nuxt) {
|
|
22
|
+
_kit.addVitePlugin.call(void 0, () => _chunkP5DL7FECcjs.vite_default.call(void 0, options));
|
|
23
|
+
_kit.addWebpackPlugin.call(void 0, () => _chunkOUJGOKNRcjs.webpack_default.call(void 0, options));
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
exports.default = nuxt_default;
|
|
29
|
+
|
|
30
|
+
module.exports = exports.default;
|
package/dist/nuxt.d.cts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
import { Options } from './options.cjs';
|
|
3
|
+
import '@babel/parser';
|
|
4
|
+
import 'unplugin-utils';
|
|
5
|
+
|
|
6
|
+
interface ModuleOptions extends Options {
|
|
7
|
+
}
|
|
8
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
9
|
+
|
|
10
|
+
export { type ModuleOptions, _default as default };
|
package/dist/nuxt.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
import { Options } from './options.js';
|
|
3
|
+
import '@babel/parser';
|
|
4
|
+
import 'unplugin-utils';
|
|
5
|
+
|
|
6
|
+
interface ModuleOptions extends Options {
|
|
7
|
+
}
|
|
8
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
9
|
+
|
|
10
|
+
export { type ModuleOptions, _default as default };
|
package/dist/nuxt.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
vite_default
|
|
3
|
+
} from "./chunk-PGUIHQNS.js";
|
|
4
|
+
import {
|
|
5
|
+
webpack_default
|
|
6
|
+
} from "./chunk-DGY54NDT.js";
|
|
7
|
+
import "./chunk-4CXGYDJU.js";
|
|
8
|
+
import "./chunk-RTGSRM4I.js";
|
|
9
|
+
|
|
10
|
+
// src/nuxt.ts
|
|
11
|
+
import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
|
|
12
|
+
import "@nuxt/schema";
|
|
13
|
+
var nuxt_default = defineNuxtModule({
|
|
14
|
+
meta: {
|
|
15
|
+
name: "nuxt-unplugin-jsx-source",
|
|
16
|
+
configKey: "unpluginStarter"
|
|
17
|
+
},
|
|
18
|
+
defaults: {
|
|
19
|
+
// ...default options
|
|
20
|
+
},
|
|
21
|
+
setup(options, _nuxt) {
|
|
22
|
+
addVitePlugin(() => vite_default(options));
|
|
23
|
+
addWebpackPlugin(() => webpack_default(options));
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
export {
|
|
27
|
+
nuxt_default as default
|
|
28
|
+
};
|
package/dist/options.cjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ParserOptions } from '@babel/parser';
|
|
2
|
+
import { FilterPattern } from 'unplugin-utils';
|
|
3
|
+
|
|
4
|
+
interface Options {
|
|
5
|
+
/**
|
|
6
|
+
* The include pattern to match files
|
|
7
|
+
* @default ['.[jt]sx?$']
|
|
8
|
+
*/
|
|
9
|
+
include?: FilterPattern;
|
|
10
|
+
exclude?: FilterPattern | undefined;
|
|
11
|
+
enforce?: "post" | "pre" | undefined;
|
|
12
|
+
parserOptions?: ParserOptions;
|
|
13
|
+
/**
|
|
14
|
+
* The attribute name to add to the JSX element
|
|
15
|
+
* @default 'data-at'
|
|
16
|
+
*/
|
|
17
|
+
attribute?: string;
|
|
18
|
+
}
|
|
19
|
+
type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
20
|
+
type OptionsResolved = Overwrite<Required<Options>, {
|
|
21
|
+
exclude: Options["exclude"];
|
|
22
|
+
enforce: Options["enforce"];
|
|
23
|
+
}>;
|
|
24
|
+
declare function resolveOption(options: Options): OptionsResolved;
|
|
25
|
+
|
|
26
|
+
export { type Options, type OptionsResolved, resolveOption };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ParserOptions } from '@babel/parser';
|
|
2
|
+
import { FilterPattern } from 'unplugin-utils';
|
|
3
|
+
|
|
4
|
+
interface Options {
|
|
5
|
+
/**
|
|
6
|
+
* The include pattern to match files
|
|
7
|
+
* @default ['.[jt]sx?$']
|
|
8
|
+
*/
|
|
9
|
+
include?: FilterPattern;
|
|
10
|
+
exclude?: FilterPattern | undefined;
|
|
11
|
+
enforce?: "post" | "pre" | undefined;
|
|
12
|
+
parserOptions?: ParserOptions;
|
|
13
|
+
/**
|
|
14
|
+
* The attribute name to add to the JSX element
|
|
15
|
+
* @default 'data-at'
|
|
16
|
+
*/
|
|
17
|
+
attribute?: string;
|
|
18
|
+
}
|
|
19
|
+
type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
20
|
+
type OptionsResolved = Overwrite<Required<Options>, {
|
|
21
|
+
exclude: Options["exclude"];
|
|
22
|
+
enforce: Options["enforce"];
|
|
23
|
+
}>;
|
|
24
|
+
declare function resolveOption(options: Options): OptionsResolved;
|
|
25
|
+
|
|
26
|
+
export { type Options, type OptionsResolved, resolveOption };
|
package/dist/options.js
ADDED
package/dist/rollup.cjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkA4KZOKT4cjs = require('./chunk-A4KZOKT4.cjs');
|
|
4
|
+
require('./chunk-D73UW2IR.cjs');
|
|
5
|
+
|
|
6
|
+
// src/rollup.ts
|
|
7
|
+
var _unplugin = require('unplugin');
|
|
8
|
+
var rollup_default = _unplugin.createRollupPlugin.call(void 0, _chunkA4KZOKT4cjs.unpluginFactory);
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.default = rollup_default;
|
|
12
|
+
|
|
13
|
+
module.exports = exports.default;
|
package/dist/rollup.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as rollup from 'rollup';
|
|
2
|
+
import { Options } from './options.js';
|
|
3
|
+
import '@babel/parser';
|
|
4
|
+
import 'unplugin-utils';
|
|
5
|
+
|
|
6
|
+
declare const _default: (options?: Options | undefined) => rollup.Plugin<any> | rollup.Plugin<any>[];
|
|
7
|
+
|
|
8
|
+
export { _default as default };
|
package/dist/rollup.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
unpluginFactory
|
|
3
|
+
} from "./chunk-4CXGYDJU.js";
|
|
4
|
+
import "./chunk-RTGSRM4I.js";
|
|
5
|
+
|
|
6
|
+
// src/rollup.ts
|
|
7
|
+
import { createRollupPlugin } from "unplugin";
|
|
8
|
+
var rollup_default = createRollupPlugin(unpluginFactory);
|
|
9
|
+
export {
|
|
10
|
+
rollup_default as default
|
|
11
|
+
};
|
package/dist/rspack.cjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkA4KZOKT4cjs = require('./chunk-A4KZOKT4.cjs');
|
|
4
|
+
require('./chunk-D73UW2IR.cjs');
|
|
5
|
+
|
|
6
|
+
// src/rspack.ts
|
|
7
|
+
var _unplugin = require('unplugin');
|
|
8
|
+
var rspack_default = _unplugin.createRspackPlugin.call(void 0, _chunkA4KZOKT4cjs.unpluginFactory);
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.default = rspack_default;
|
|
12
|
+
|
|
13
|
+
module.exports = exports.default;
|
package/dist/rspack.d.ts
ADDED
package/dist/rspack.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
unpluginFactory
|
|
3
|
+
} from "./chunk-4CXGYDJU.js";
|
|
4
|
+
import "./chunk-RTGSRM4I.js";
|
|
5
|
+
|
|
6
|
+
// src/rspack.ts
|
|
7
|
+
import { createRspackPlugin } from "unplugin";
|
|
8
|
+
var rspack_default = createRspackPlugin(unpluginFactory);
|
|
9
|
+
export {
|
|
10
|
+
rspack_default as default
|
|
11
|
+
};
|
package/dist/vite.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkP5DL7FECcjs = require('./chunk-P5DL7FEC.cjs');
|
|
4
|
+
require('./chunk-A4KZOKT4.cjs');
|
|
5
|
+
require('./chunk-D73UW2IR.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.default = _chunkP5DL7FECcjs.vite_default;
|
|
9
|
+
|
|
10
|
+
module.exports = exports.default;
|
package/dist/vite.d.cts
ADDED
package/dist/vite.d.ts
ADDED
package/dist/vite.js
ADDED
package/dist/webpack.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkOUJGOKNRcjs = require('./chunk-OUJGOKNR.cjs');
|
|
4
|
+
require('./chunk-A4KZOKT4.cjs');
|
|
5
|
+
require('./chunk-D73UW2IR.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.default = _chunkOUJGOKNRcjs.webpack_default;
|
|
9
|
+
|
|
10
|
+
module.exports = exports.default;
|
package/dist/webpack.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "unplugin-jsx-source",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.2",
|
|
5
|
+
"description": "",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/astahmer/unplugin-jsx-source#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/astahmer/unplugin-jsx-source.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/astahmer/unplugin-jsx-source/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"unplugin",
|
|
17
|
+
"jsx",
|
|
18
|
+
"source",
|
|
19
|
+
"data-at",
|
|
20
|
+
"data-source",
|
|
21
|
+
"annotate",
|
|
22
|
+
"devtools",
|
|
23
|
+
"vite",
|
|
24
|
+
"webpack",
|
|
25
|
+
"rollup",
|
|
26
|
+
"transform"
|
|
27
|
+
],
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"import": "./dist/index.js",
|
|
31
|
+
"require": "./dist/index.cjs"
|
|
32
|
+
},
|
|
33
|
+
"./astro": {
|
|
34
|
+
"import": "./dist/astro.js",
|
|
35
|
+
"require": "./dist/astro.cjs"
|
|
36
|
+
},
|
|
37
|
+
"./rspack": {
|
|
38
|
+
"import": "./dist/rspack.js",
|
|
39
|
+
"require": "./dist/rspack.cjs"
|
|
40
|
+
},
|
|
41
|
+
"./vite": {
|
|
42
|
+
"import": "./dist/vite.js",
|
|
43
|
+
"require": "./dist/vite.cjs"
|
|
44
|
+
},
|
|
45
|
+
"./webpack": {
|
|
46
|
+
"import": "./dist/webpack.js",
|
|
47
|
+
"require": "./dist/webpack.cjs"
|
|
48
|
+
},
|
|
49
|
+
"./rollup": {
|
|
50
|
+
"import": "./dist/rollup.js",
|
|
51
|
+
"require": "./dist/rollup.cjs"
|
|
52
|
+
},
|
|
53
|
+
"./esbuild": {
|
|
54
|
+
"import": "./dist/esbuild.js",
|
|
55
|
+
"require": "./dist/esbuild.cjs"
|
|
56
|
+
},
|
|
57
|
+
"./nuxt": {
|
|
58
|
+
"import": "./dist/nuxt.js",
|
|
59
|
+
"require": "./dist/nuxt.cjs"
|
|
60
|
+
},
|
|
61
|
+
"./farm": {
|
|
62
|
+
"import": "./dist/farm.js",
|
|
63
|
+
"require": "./dist/farm.cjs"
|
|
64
|
+
},
|
|
65
|
+
"./types": {
|
|
66
|
+
"import": "./dist/types.js",
|
|
67
|
+
"require": "./dist/types.cjs"
|
|
68
|
+
},
|
|
69
|
+
"./*": "./*"
|
|
70
|
+
},
|
|
71
|
+
"main": "dist/index.cjs",
|
|
72
|
+
"module": "dist/index.js",
|
|
73
|
+
"types": "dist/index.d.ts",
|
|
74
|
+
"typesVersions": {
|
|
75
|
+
"*": {
|
|
76
|
+
"*": [
|
|
77
|
+
"./dist/*",
|
|
78
|
+
"./*"
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"files": [
|
|
83
|
+
"dist"
|
|
84
|
+
],
|
|
85
|
+
"peerDependencies": {
|
|
86
|
+
"@farmfe/core": ">=1",
|
|
87
|
+
"@nuxt/kit": "^3",
|
|
88
|
+
"@nuxt/schema": "^3",
|
|
89
|
+
"esbuild": "*",
|
|
90
|
+
"rollup": "^3",
|
|
91
|
+
"vite": ">=3",
|
|
92
|
+
"webpack": "^4 || ^5"
|
|
93
|
+
},
|
|
94
|
+
"peerDependenciesMeta": {
|
|
95
|
+
"@farmfe/core": {
|
|
96
|
+
"optional": true
|
|
97
|
+
},
|
|
98
|
+
"@nuxt/kit": {
|
|
99
|
+
"optional": true
|
|
100
|
+
},
|
|
101
|
+
"@nuxt/schema": {
|
|
102
|
+
"optional": true
|
|
103
|
+
},
|
|
104
|
+
"esbuild": {
|
|
105
|
+
"optional": true
|
|
106
|
+
},
|
|
107
|
+
"rollup": {
|
|
108
|
+
"optional": true
|
|
109
|
+
},
|
|
110
|
+
"vite": {
|
|
111
|
+
"optional": true
|
|
112
|
+
},
|
|
113
|
+
"webpack": {
|
|
114
|
+
"optional": true
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"dependencies": {
|
|
118
|
+
"@babel/generator": "^7.26.9",
|
|
119
|
+
"@babel/parser": "^7.26.9",
|
|
120
|
+
"@babel/traverse": "^7.26.9",
|
|
121
|
+
"@babel/types": "^7.26.9",
|
|
122
|
+
"unplugin": "^2.1.2",
|
|
123
|
+
"unplugin-utils": "^0.2.4"
|
|
124
|
+
},
|
|
125
|
+
"devDependencies": {
|
|
126
|
+
"@antfu/eslint-config": "^4.2.0",
|
|
127
|
+
"@biomejs/biome": "1.9.4",
|
|
128
|
+
"@nuxt/kit": "^3.15.4",
|
|
129
|
+
"@nuxt/schema": "^3.15.4",
|
|
130
|
+
"@types/babel__generator": "^7.6.8",
|
|
131
|
+
"@types/babel__traverse": "^7.20.6",
|
|
132
|
+
"@types/node": "^22.13.1",
|
|
133
|
+
"bumpp": "^10.0.2",
|
|
134
|
+
"eslint": "^9.20.0",
|
|
135
|
+
"nodemon": "^3.1.9",
|
|
136
|
+
"rollup": "^4.34.6",
|
|
137
|
+
"tsup": "^8.3.6",
|
|
138
|
+
"tsx": "^4.19.2",
|
|
139
|
+
"typescript": "^5.7.3",
|
|
140
|
+
"vite": "^6.1.0",
|
|
141
|
+
"vitest": "^3.0.5",
|
|
142
|
+
"webpack": "^5.97.1"
|
|
143
|
+
},
|
|
144
|
+
"scripts": {
|
|
145
|
+
"build": "tsup",
|
|
146
|
+
"dev": "tsup --watch src",
|
|
147
|
+
"lint": "eslint .",
|
|
148
|
+
"play": "npm -C playground run dev",
|
|
149
|
+
"release": "bumpp && pnpm publish",
|
|
150
|
+
"start": "tsx src/index.ts",
|
|
151
|
+
"test": "vitest"
|
|
152
|
+
}
|
|
153
|
+
}
|