vite-plugin-jsx-source-attrs 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hansanghyeon
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,130 @@
1
+ # vite-plugin-jsx-source-attrs
2
+
3
+ Vite React 개발 환경에서 JSX 요소에 소스 위치 정보를 담은 attribute를 주입하기 위한 Babel 플러그인 유틸리티입니다.
4
+
5
+ 여러 Analytics MFE 프로젝트에 반복되어 있던 `@wix/babel-plugin-jsx-source-attrs` 설정과 로컬 Babel 플러그인 구현을 공통 패키지로 분리해, 동일한 동작을 한 곳에서 관리하는 것을 목표로 합니다.
6
+
7
+ ## 기능
8
+
9
+ - 개발 모드 JSX에 `data-source-location` attribute를 주입합니다.
10
+ - 프로덕션 빌드 또는 비활성화 조건에서는 source attribute를 주입하지 않을 수 있습니다.
11
+ - 기본값에서는 intrinsic JSX 요소(`div`, `span`, `my-element`)만 대상으로 합니다.
12
+ - `componentAttributeName`을 지정하면 사용자 컴포넌트에도 별도 attribute를 주입할 수 있습니다.
13
+ - 파일 경로의 query/hash 제거, Vite 가상 모듈 prefix 제거, OS 경로 구분자 정규화를 제공합니다.
14
+ - 이미 같은 이름의 attribute가 있으면 중복으로 주입하지 않습니다.
15
+
16
+ ## 설치
17
+
18
+ ```bash
19
+ bun add -D vite-plugin-jsx-source-attrs
20
+ ```
21
+
22
+ npm을 사용한다면 다음처럼 설치합니다.
23
+
24
+ ```bash
25
+ npm install -D vite-plugin-jsx-source-attrs
26
+ ```
27
+
28
+ ## 사용법
29
+
30
+ `@vitejs/plugin-react`의 Babel 플러그인 배열에 `jsxSourceAttrs()`를 추가합니다.
31
+
32
+ ```ts
33
+ import react from '@vitejs/plugin-react';
34
+ import { jsxSourceAttrs } from 'vite-plugin-jsx-source-attrs';
35
+ import { defineConfig } from 'vite';
36
+
37
+ export default defineConfig(({ mode }) => ({
38
+ plugins: [
39
+ react({
40
+ babel: {
41
+ plugins: [
42
+ jsxSourceAttrs({
43
+ enabled: mode === 'development',
44
+ attributeName: 'data-source-location',
45
+ componentAttributeName: null,
46
+ }),
47
+ ],
48
+ },
49
+ }),
50
+ ],
51
+ }));
52
+ ```
53
+
54
+ 입력 JSX가 다음과 같다면,
55
+
56
+ ```tsx
57
+ const view = <div />;
58
+ ```
59
+
60
+ 개발 모드에서는 다음처럼 source location이 추가됩니다.
61
+
62
+ ```tsx
63
+ const view = <div data-source-location="src/App.tsx:1:14" />;
64
+ ```
65
+
66
+ ## 옵션
67
+
68
+ | 옵션 | 기본값 | 설명 |
69
+ | --- | --- | --- |
70
+ | `enabled` | `process.env.NODE_ENV !== 'production'` | attribute 주입 여부입니다. boolean 또는 context 기반 함수로 지정할 수 있습니다. |
71
+ | `attributeName` | `data-source-location` | intrinsic JSX 요소에 주입할 attribute 이름입니다. |
72
+ | `componentAttributeName` | `null` | 사용자 컴포넌트에 별도로 주입할 attribute 이름입니다. `null`이면 사용자 컴포넌트에는 주입하지 않습니다. |
73
+ | `root` | `process.cwd()` | 절대 경로를 상대 경로로 바꿀 기준 루트입니다. |
74
+ | `normalizePath` | 내장 정규화 함수 | 파일 경로를 attribute 값에 맞게 정규화하는 함수입니다. |
75
+
76
+ ### enabled 함수 예시
77
+
78
+ ```ts
79
+ jsxSourceAttrs({
80
+ enabled: ({ filename }) => filename.endsWith('.tsx') && !filename.includes('/node_modules/'),
81
+ });
82
+ ```
83
+
84
+ ### 사용자 컴포넌트 attribute 예시
85
+
86
+ ```ts
87
+ jsxSourceAttrs({
88
+ attributeName: 'data-source-location',
89
+ componentAttributeName: 'data-component-source-location',
90
+ });
91
+ ```
92
+
93
+ ## 경로 정규화
94
+
95
+ 내장 `normalizeSourcePath()`는 다음 처리를 수행합니다.
96
+
97
+ - `?raw`, `?import`, `#hash` 같은 query/hash 제거
98
+ - Vite 가상 모듈 prefix인 `\0`, `/@id/__x00__`, `/@fs/`, `virtual:` 제거
99
+ - Windows 경로 구분자 `\\`를 `/`로 정규화
100
+ - `root` 하위 절대 경로를 상대 경로로 변환
101
+
102
+ ## 개발
103
+
104
+ ```bash
105
+ bun install
106
+ bun run lint
107
+ bun run typecheck
108
+ bun run test
109
+ bun run build
110
+ ```
111
+
112
+ 한 번에 검증하려면 다음 명령을 사용합니다.
113
+
114
+ ```bash
115
+ bun run verify
116
+ ```
117
+
118
+ ## 배포
119
+
120
+ 패키지 배포 산출물은 `package.json`의 `files` 필드와 `.npmignore`로 제한합니다. CI는 Bun 기반으로 검증하고, npm Registry와 GitLab Package Registry 배포 경로를 분리합니다.
121
+
122
+ 자세한 내용은 [`docs/publishing.md`](docs/publishing.md)를 참고하세요.
123
+
124
+ ## 마이그레이션
125
+
126
+ 기존 analytics 프로젝트의 로컬 `jsx-source-attrs.js` 복사본 또는 `@wix/babel-plugin-jsx-source-attrs` 직접 사용을 이 패키지로 바꾸는 방법은 [`docs/migration.md`](docs/migration.md)를 참고하세요.
127
+
128
+ ## 라이선스
129
+
130
+ MIT
package/dist/index.cjs ADDED
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ default: () => index_default,
34
+ jsxSourceAttrs: () => jsxSourceAttrs,
35
+ normalizeSourcePath: () => normalizeSourcePath
36
+ });
37
+ module.exports = __toCommonJS(index_exports);
38
+ var import_node_path2 = __toESM(require("path"), 1);
39
+ var t = __toESM(require("@babel/types"), 1);
40
+
41
+ // src/normalize.ts
42
+ var import_node_path = __toESM(require("path"), 1);
43
+ var QUERY_OR_HASH_RE = /[?#]/;
44
+ function removeQueryAndHash(filename) {
45
+ return filename.split(QUERY_OR_HASH_RE, 1)[0] ?? filename;
46
+ }
47
+ function removeViteVirtualPrefix(filename) {
48
+ return filename.replace(/^\0+/, "").replace(/^\/?@id\/__x00__/, "").replace(/^\/?@fs\//, "/").replace(/^virtual:/, "");
49
+ }
50
+ function toSlash(filename) {
51
+ return filename.replace(/\\/g, "/");
52
+ }
53
+ function toRelativeFromRoot(filename, root) {
54
+ const slashFilename = toSlash(filename);
55
+ const slashRoot = toSlash(root).replace(/\/$/, "");
56
+ if (!slashRoot) {
57
+ return slashFilename;
58
+ }
59
+ if (slashFilename === slashRoot) {
60
+ return import_node_path.default.posix.basename(slashFilename);
61
+ }
62
+ if (slashFilename.startsWith(`${slashRoot}/`)) {
63
+ return slashFilename.slice(slashRoot.length + 1);
64
+ }
65
+ const relative = toSlash(import_node_path.default.relative(root, filename));
66
+ if (!relative.startsWith("..") && relative !== "") {
67
+ return relative;
68
+ }
69
+ return slashFilename;
70
+ }
71
+ function normalizeSourcePath(filename, context) {
72
+ const withoutQuery = removeQueryAndHash(filename);
73
+ const withoutVirtualPrefix = removeViteVirtualPrefix(withoutQuery);
74
+ const slashPath = toSlash(withoutVirtualPrefix);
75
+ return toRelativeFromRoot(slashPath, context.root);
76
+ }
77
+
78
+ // src/index.ts
79
+ var DEFAULT_ATTRIBUTE_NAME = "data-source-location";
80
+ function resolveOptions(options) {
81
+ return {
82
+ enabled: options.enabled ?? process.env.NODE_ENV !== "production",
83
+ attributeName: options.attributeName ?? DEFAULT_ATTRIBUTE_NAME,
84
+ componentAttributeName: options.componentAttributeName ?? null,
85
+ root: import_node_path2.default.resolve(options.root ?? process.cwd()),
86
+ normalizePath: options.normalizePath ?? normalizeSourcePath
87
+ };
88
+ }
89
+ function getContext(state, options) {
90
+ return {
91
+ filename: state.file.opts.filename ?? "unknown",
92
+ root: options.root,
93
+ envName: state.file.opts.envName
94
+ };
95
+ }
96
+ function shouldInject(state, options) {
97
+ if (typeof options.enabled === "function") {
98
+ return options.enabled(getContext(state, options));
99
+ }
100
+ return options.enabled;
101
+ }
102
+ function isIntrinsicName(name) {
103
+ if (!t.isJSXIdentifier(name)) {
104
+ return false;
105
+ }
106
+ return /^[a-z]/.test(name.name) || name.name.includes("-");
107
+ }
108
+ function getTargetAttributeName(name, options) {
109
+ if (isIntrinsicName(name)) {
110
+ return options.attributeName;
111
+ }
112
+ return options.componentAttributeName;
113
+ }
114
+ function hasAttribute(node, attributeName) {
115
+ return node.attributes.some((attribute) => {
116
+ return t.isJSXAttribute(attribute) && t.isJSXIdentifier(attribute.name, { name: attributeName });
117
+ });
118
+ }
119
+ function createLocationValue(pathToOpeningElement, state, options) {
120
+ const location = pathToOpeningElement.node.loc?.start;
121
+ if (!location) {
122
+ return null;
123
+ }
124
+ const context = getContext(state, options);
125
+ const filename = options.normalizePath(context.filename, {
126
+ ...context,
127
+ rawFilename: context.filename
128
+ });
129
+ return `${filename}:${location.line}:${location.column + 1}`;
130
+ }
131
+ function jsxSourceAttrs(options = {}) {
132
+ const resolvedOptions = resolveOptions(options);
133
+ return {
134
+ name: "vite-plugin-jsx-source-attrs",
135
+ visitor: {
136
+ JSXOpeningElement(pathToOpeningElement, state) {
137
+ if (!shouldInject(state, resolvedOptions)) {
138
+ return;
139
+ }
140
+ const attributeName = getTargetAttributeName(pathToOpeningElement.node.name, resolvedOptions);
141
+ if (!attributeName || hasAttribute(pathToOpeningElement.node, attributeName)) {
142
+ return;
143
+ }
144
+ const value = createLocationValue(pathToOpeningElement, state, resolvedOptions);
145
+ if (!value) {
146
+ return;
147
+ }
148
+ pathToOpeningElement.node.attributes.push(
149
+ t.jsxAttribute(t.jsxIdentifier(attributeName), t.stringLiteral(value))
150
+ );
151
+ }
152
+ }
153
+ };
154
+ }
155
+ var index_default = jsxSourceAttrs;
156
+ // Annotate the CommonJS export names for ESM import in node:
157
+ 0 && (module.exports = {
158
+ jsxSourceAttrs,
159
+ normalizeSourcePath
160
+ });
@@ -0,0 +1,46 @@
1
+ import { PluginObj, PluginPass } from '@babel/core';
2
+
3
+ interface JsxSourceAttrsContext {
4
+ /** Babel이 전달한 파일명입니다. */
5
+ filename: string;
6
+ /** 경로를 상대화할 기준 루트입니다. */
7
+ root: string;
8
+ /** Babel envName입니다. */
9
+ envName?: string;
10
+ }
11
+ interface NormalizePathContext extends JsxSourceAttrsContext {
12
+ /** attribute 값 생성을 위해 query/hash를 제거하기 전 원본 파일명입니다. */
13
+ rawFilename: string;
14
+ }
15
+ interface JsxSourceAttrsOptions {
16
+ /**
17
+ * attribute 주입 여부입니다.
18
+ * 기본값은 `process.env.NODE_ENV !== 'production'`입니다.
19
+ */
20
+ enabled?: boolean | ((context: JsxSourceAttrsContext) => boolean);
21
+ /** intrinsic JSX 요소에 주입할 attribute 이름입니다. */
22
+ attributeName?: string;
23
+ /** 사용자 컴포넌트에 주입할 attribute 이름입니다. `null`이면 주입하지 않습니다. */
24
+ componentAttributeName?: string | null;
25
+ /** 절대 경로를 상대 경로로 바꿀 기준 루트입니다. */
26
+ root?: string;
27
+ /** 파일 경로를 attribute 값에 맞게 정규화하는 함수입니다. */
28
+ normalizePath?: (filename: string, context: NormalizePathContext) => string;
29
+ }
30
+
31
+ declare function normalizeSourcePath(filename: string, context: NormalizePathContext): string;
32
+
33
+ interface JsxSourceAttrsPluginState extends PluginPass {
34
+ file: PluginPass['file'] & {
35
+ opts: PluginPass['file']['opts'] & {
36
+ filename?: string;
37
+ envName?: string;
38
+ };
39
+ };
40
+ }
41
+ /**
42
+ * Vite의 `@vitejs/plugin-react` Babel 플러그인 배열에 넣어 사용하는 JSX source attribute 플러그인입니다.
43
+ */
44
+ declare function jsxSourceAttrs(options?: JsxSourceAttrsOptions): PluginObj<JsxSourceAttrsPluginState>;
45
+
46
+ export { type JsxSourceAttrsContext, type JsxSourceAttrsOptions, type NormalizePathContext, jsxSourceAttrs as default, jsxSourceAttrs, normalizeSourcePath };
@@ -0,0 +1,46 @@
1
+ import { PluginObj, PluginPass } from '@babel/core';
2
+
3
+ interface JsxSourceAttrsContext {
4
+ /** Babel이 전달한 파일명입니다. */
5
+ filename: string;
6
+ /** 경로를 상대화할 기준 루트입니다. */
7
+ root: string;
8
+ /** Babel envName입니다. */
9
+ envName?: string;
10
+ }
11
+ interface NormalizePathContext extends JsxSourceAttrsContext {
12
+ /** attribute 값 생성을 위해 query/hash를 제거하기 전 원본 파일명입니다. */
13
+ rawFilename: string;
14
+ }
15
+ interface JsxSourceAttrsOptions {
16
+ /**
17
+ * attribute 주입 여부입니다.
18
+ * 기본값은 `process.env.NODE_ENV !== 'production'`입니다.
19
+ */
20
+ enabled?: boolean | ((context: JsxSourceAttrsContext) => boolean);
21
+ /** intrinsic JSX 요소에 주입할 attribute 이름입니다. */
22
+ attributeName?: string;
23
+ /** 사용자 컴포넌트에 주입할 attribute 이름입니다. `null`이면 주입하지 않습니다. */
24
+ componentAttributeName?: string | null;
25
+ /** 절대 경로를 상대 경로로 바꿀 기준 루트입니다. */
26
+ root?: string;
27
+ /** 파일 경로를 attribute 값에 맞게 정규화하는 함수입니다. */
28
+ normalizePath?: (filename: string, context: NormalizePathContext) => string;
29
+ }
30
+
31
+ declare function normalizeSourcePath(filename: string, context: NormalizePathContext): string;
32
+
33
+ interface JsxSourceAttrsPluginState extends PluginPass {
34
+ file: PluginPass['file'] & {
35
+ opts: PluginPass['file']['opts'] & {
36
+ filename?: string;
37
+ envName?: string;
38
+ };
39
+ };
40
+ }
41
+ /**
42
+ * Vite의 `@vitejs/plugin-react` Babel 플러그인 배열에 넣어 사용하는 JSX source attribute 플러그인입니다.
43
+ */
44
+ declare function jsxSourceAttrs(options?: JsxSourceAttrsOptions): PluginObj<JsxSourceAttrsPluginState>;
45
+
46
+ export { type JsxSourceAttrsContext, type JsxSourceAttrsOptions, type NormalizePathContext, jsxSourceAttrs as default, jsxSourceAttrs, normalizeSourcePath };
package/dist/index.js ADDED
@@ -0,0 +1,124 @@
1
+ // src/index.ts
2
+ import path2 from "path";
3
+ import * as t from "@babel/types";
4
+
5
+ // src/normalize.ts
6
+ import path from "path";
7
+ var QUERY_OR_HASH_RE = /[?#]/;
8
+ function removeQueryAndHash(filename) {
9
+ return filename.split(QUERY_OR_HASH_RE, 1)[0] ?? filename;
10
+ }
11
+ function removeViteVirtualPrefix(filename) {
12
+ return filename.replace(/^\0+/, "").replace(/^\/?@id\/__x00__/, "").replace(/^\/?@fs\//, "/").replace(/^virtual:/, "");
13
+ }
14
+ function toSlash(filename) {
15
+ return filename.replace(/\\/g, "/");
16
+ }
17
+ function toRelativeFromRoot(filename, root) {
18
+ const slashFilename = toSlash(filename);
19
+ const slashRoot = toSlash(root).replace(/\/$/, "");
20
+ if (!slashRoot) {
21
+ return slashFilename;
22
+ }
23
+ if (slashFilename === slashRoot) {
24
+ return path.posix.basename(slashFilename);
25
+ }
26
+ if (slashFilename.startsWith(`${slashRoot}/`)) {
27
+ return slashFilename.slice(slashRoot.length + 1);
28
+ }
29
+ const relative = toSlash(path.relative(root, filename));
30
+ if (!relative.startsWith("..") && relative !== "") {
31
+ return relative;
32
+ }
33
+ return slashFilename;
34
+ }
35
+ function normalizeSourcePath(filename, context) {
36
+ const withoutQuery = removeQueryAndHash(filename);
37
+ const withoutVirtualPrefix = removeViteVirtualPrefix(withoutQuery);
38
+ const slashPath = toSlash(withoutVirtualPrefix);
39
+ return toRelativeFromRoot(slashPath, context.root);
40
+ }
41
+
42
+ // src/index.ts
43
+ var DEFAULT_ATTRIBUTE_NAME = "data-source-location";
44
+ function resolveOptions(options) {
45
+ return {
46
+ enabled: options.enabled ?? process.env.NODE_ENV !== "production",
47
+ attributeName: options.attributeName ?? DEFAULT_ATTRIBUTE_NAME,
48
+ componentAttributeName: options.componentAttributeName ?? null,
49
+ root: path2.resolve(options.root ?? process.cwd()),
50
+ normalizePath: options.normalizePath ?? normalizeSourcePath
51
+ };
52
+ }
53
+ function getContext(state, options) {
54
+ return {
55
+ filename: state.file.opts.filename ?? "unknown",
56
+ root: options.root,
57
+ envName: state.file.opts.envName
58
+ };
59
+ }
60
+ function shouldInject(state, options) {
61
+ if (typeof options.enabled === "function") {
62
+ return options.enabled(getContext(state, options));
63
+ }
64
+ return options.enabled;
65
+ }
66
+ function isIntrinsicName(name) {
67
+ if (!t.isJSXIdentifier(name)) {
68
+ return false;
69
+ }
70
+ return /^[a-z]/.test(name.name) || name.name.includes("-");
71
+ }
72
+ function getTargetAttributeName(name, options) {
73
+ if (isIntrinsicName(name)) {
74
+ return options.attributeName;
75
+ }
76
+ return options.componentAttributeName;
77
+ }
78
+ function hasAttribute(node, attributeName) {
79
+ return node.attributes.some((attribute) => {
80
+ return t.isJSXAttribute(attribute) && t.isJSXIdentifier(attribute.name, { name: attributeName });
81
+ });
82
+ }
83
+ function createLocationValue(pathToOpeningElement, state, options) {
84
+ const location = pathToOpeningElement.node.loc?.start;
85
+ if (!location) {
86
+ return null;
87
+ }
88
+ const context = getContext(state, options);
89
+ const filename = options.normalizePath(context.filename, {
90
+ ...context,
91
+ rawFilename: context.filename
92
+ });
93
+ return `${filename}:${location.line}:${location.column + 1}`;
94
+ }
95
+ function jsxSourceAttrs(options = {}) {
96
+ const resolvedOptions = resolveOptions(options);
97
+ return {
98
+ name: "vite-plugin-jsx-source-attrs",
99
+ visitor: {
100
+ JSXOpeningElement(pathToOpeningElement, state) {
101
+ if (!shouldInject(state, resolvedOptions)) {
102
+ return;
103
+ }
104
+ const attributeName = getTargetAttributeName(pathToOpeningElement.node.name, resolvedOptions);
105
+ if (!attributeName || hasAttribute(pathToOpeningElement.node, attributeName)) {
106
+ return;
107
+ }
108
+ const value = createLocationValue(pathToOpeningElement, state, resolvedOptions);
109
+ if (!value) {
110
+ return;
111
+ }
112
+ pathToOpeningElement.node.attributes.push(
113
+ t.jsxAttribute(t.jsxIdentifier(attributeName), t.stringLiteral(value))
114
+ );
115
+ }
116
+ }
117
+ };
118
+ }
119
+ var index_default = jsxSourceAttrs;
120
+ export {
121
+ index_default as default,
122
+ jsxSourceAttrs,
123
+ normalizeSourcePath
124
+ };
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "vite-plugin-jsx-source-attrs",
3
+ "version": "0.1.0",
4
+ "description": "Vite React 개발 환경에서 JSX 요소에 소스 위치 attribute를 주입하는 Babel 플러그인 유틸리티",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "Hansanghyeon",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+ssh://git@git.hyeon.pro/space/tools/vite-plugin-jsx-source-attrs.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://git.hyeon.pro/space/tools/vite-plugin-jsx-source-attrs/-/issues"
14
+ },
15
+ "homepage": "https://git.hyeon.pro/space/tools/vite-plugin-jsx-source-attrs",
16
+ "keywords": [
17
+ "vite",
18
+ "react",
19
+ "babel",
20
+ "jsx",
21
+ "source-location"
22
+ ],
23
+ "sideEffects": false,
24
+ "files": [
25
+ "dist",
26
+ "README.md",
27
+ "LICENSE"
28
+ ],
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js",
33
+ "require": "./dist/index.cjs"
34
+ }
35
+ },
36
+ "main": "./dist/index.cjs",
37
+ "module": "./dist/index.js",
38
+ "types": "./dist/index.d.ts",
39
+ "scripts": {
40
+ "build": "tsup src/index.ts --format esm,cjs --dts --clean",
41
+ "typecheck": "tsc --noEmit",
42
+ "lint": "eslint .",
43
+ "test": "vitest run",
44
+ "verify": "bun run lint && bun run typecheck && bun run test && bun run build",
45
+ "pack:dry": "bun pm pack --dry-run"
46
+ },
47
+ "peerDependencies": {
48
+ "@babel/core": ">=7.20.0"
49
+ },
50
+ "dependencies": {
51
+ "@babel/types": "^7.26.0"
52
+ },
53
+ "devDependencies": {
54
+ "@babel/core": "^7.26.0",
55
+ "@babel/preset-react": "^7.25.9",
56
+ "@eslint/js": "^9.17.0",
57
+ "@types/babel__core": "^7.20.5",
58
+ "@types/bun": "^1.1.14",
59
+ "eslint": "^9.17.0",
60
+ "tsup": "^8.3.5",
61
+ "typescript": "^5.7.2",
62
+ "typescript-eslint": "^8.18.2",
63
+ "vitest": "^2.1.8"
64
+ },
65
+ "publishConfig": {
66
+ "access": "public"
67
+ }
68
+ }