react-code-locator 0.1.17 → 0.1.18

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/dist/webpack.cjs DELETED
@@ -1,92 +0,0 @@
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/webpack.ts
31
- var webpack_exports = {};
32
- __export(webpack_exports, {
33
- ReactCodeLocatorPlugin: () => ReactCodeLocatorPlugin,
34
- createReactCodeLocatorPlugin: () => createReactCodeLocatorPlugin,
35
- default: () => webpack_default,
36
- webpackPlugin: () => webpackPlugin
37
- });
38
- module.exports = __toCommonJS(webpack_exports);
39
- var DEFAULT_INCLUDE = /\.([jt]sx)$/;
40
- var DEFAULT_EXCLUDE = /node_modules/;
41
- var ReactCodeLocatorPlugin = class {
42
- options;
43
- constructor(options = {}) {
44
- this.options = options;
45
- }
46
- apply(compiler) {
47
- const {
48
- include = DEFAULT_INCLUDE,
49
- exclude = DEFAULT_EXCLUDE,
50
- projectRoot = process.cwd(),
51
- injectComponentSource = true,
52
- injectJsxSource = true
53
- } = this.options;
54
- const pluginName = "ReactCodeLocatorPlugin";
55
- compiler.hooks.afterEnvironment.tap(pluginName, () => {
56
- const rules = compiler.options.module?.rules || [];
57
- const loaderPath = require.resolve("./core/webpackPitchLoader-cjs.cjs");
58
- const rule = {
59
- test: include,
60
- exclude,
61
- enforce: "pre",
62
- use: [
63
- {
64
- loader: loaderPath,
65
- options: {
66
- projectRoot,
67
- injectComponentSource,
68
- injectJsxSource
69
- }
70
- }
71
- ]
72
- };
73
- rules.unshift(rule);
74
- if (!compiler.options.module) {
75
- compiler.options.module = { rules: [] };
76
- }
77
- compiler.options.module.rules = rules;
78
- });
79
- }
80
- };
81
- function createReactCodeLocatorPlugin(options = {}) {
82
- return new ReactCodeLocatorPlugin(options);
83
- }
84
- var webpack_default = ReactCodeLocatorPlugin;
85
- var webpackPlugin = createReactCodeLocatorPlugin;
86
- // Annotate the CommonJS export names for ESM import in node:
87
- 0 && (module.exports = {
88
- ReactCodeLocatorPlugin,
89
- createReactCodeLocatorPlugin,
90
- webpackPlugin
91
- });
92
- //# sourceMappingURL=webpack.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/webpack.ts"],"sourcesContent":["/**\n * Webpack Plugin for react-code-locator\n * CJS-compatible version - no unplugin dependency\n * \n * Usage:\n * ```js\n * // webpack.config.js\n * const { ReactCodeLocatorPlugin } = require('react-code-locator/webpack');\n * \n * module.exports = {\n * plugins: [\n * new ReactCodeLocatorPlugin()\n * ]\n * };\n * ```\n */\n\nimport { transformSource } from \"./core/transform\";\nimport type { Compiler, NormalModule } from \"webpack\";\n\nexport interface ReactCodeLocatorWebpackOptions {\n /** \n * Enable source transform for component definitions\n * @default true\n */\n injectComponentSource?: boolean;\n \n /** \n * Enable source transform for JSX call sites\n * @default true\n */\n injectJsxSource?: boolean;\n \n /**\n * Project root for relative path calculation\n * @default process.cwd()\n */\n projectRoot?: string;\n \n /**\n * Include filter for file paths\n * @default /\\.[jt]sx$/\n */\n include?: RegExp | RegExp[];\n \n /**\n * Exclude filter for file paths\n * @default /node_modules/\n */\n exclude?: RegExp | RegExp[];\n}\n\nconst DEFAULT_INCLUDE = /\\.([jt]sx)$/;\nconst DEFAULT_EXCLUDE = /node_modules/;\n\nfunction shouldTransform(id: string, include: RegExp | RegExp[], exclude: RegExp | RegExp[]): boolean {\n const includePatterns = Array.isArray(include) ? include : [include];\n const excludePatterns = Array.isArray(exclude) ? exclude : [exclude];\n \n if (excludePatterns.some(pattern => pattern.test(id))) {\n return false;\n }\n \n return includePatterns.some(pattern => pattern.test(id));\n}\n\nexport class ReactCodeLocatorPlugin {\n private options: ReactCodeLocatorWebpackOptions;\n\n constructor(options: ReactCodeLocatorWebpackOptions = {}) {\n this.options = options;\n }\n\n apply(compiler: Compiler): void {\n const {\n include = DEFAULT_INCLUDE,\n exclude = DEFAULT_EXCLUDE,\n projectRoot = process.cwd(),\n injectComponentSource = true,\n injectJsxSource = true,\n } = this.options;\n\n const pluginName = \"ReactCodeLocatorPlugin\";\n\n // Add loader rule using compiler.options.module.rules\n compiler.hooks.afterEnvironment.tap(pluginName, () => {\n const rules = compiler.options.module?.rules || [];\n \n // Create loader path - use bundled CJS version (relative to webpack.cjs)\n const loaderPath = require.resolve('./core/webpackPitchLoader-cjs.cjs');\n \n // Create rule\n const rule = {\n test: include,\n exclude: exclude,\n enforce: 'pre' as const,\n use: [\n {\n loader: loaderPath,\n options: {\n projectRoot,\n injectComponentSource,\n injectJsxSource,\n },\n },\n ],\n };\n \n // Add rule to beginning\n rules.unshift(rule);\n \n if (!compiler.options.module) {\n compiler.options.module = { rules: [] } as any;\n }\n compiler.options.module.rules = rules;\n });\n }\n}\n\n// Factory function\nexport function createReactCodeLocatorPlugin(options: ReactCodeLocatorWebpackOptions = {}): ReactCodeLocatorPlugin {\n return new ReactCodeLocatorPlugin(options);\n}\n\n// Default export\nexport default ReactCodeLocatorPlugin;\n\n// Also export as webpackPlugin for compatibility\nexport const webpackPlugin = createReactCodeLocatorPlugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoDA,IAAM,kBAAkB;AACxB,IAAM,kBAAkB;AAajB,IAAM,yBAAN,MAA6B;AAAA,EAC1B;AAAA,EAER,YAAY,UAA0C,CAAC,GAAG;AACxD,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,MAAM,UAA0B;AAC9B,UAAM;AAAA,MACJ,UAAU;AAAA,MACV,UAAU;AAAA,MACV,cAAc,QAAQ,IAAI;AAAA,MAC1B,wBAAwB;AAAA,MACxB,kBAAkB;AAAA,IACpB,IAAI,KAAK;AAET,UAAM,aAAa;AAGnB,aAAS,MAAM,iBAAiB,IAAI,YAAY,MAAM;AACpD,YAAM,QAAQ,SAAS,QAAQ,QAAQ,SAAS,CAAC;AAGjD,YAAM,aAAa,gBAAgB,mCAAmC;AAGtE,YAAM,OAAO;AAAA,QACX,MAAM;AAAA,QACN;AAAA,QACA,SAAS;AAAA,QACT,KAAK;AAAA,UACH;AAAA,YACE,QAAQ;AAAA,YACR,SAAS;AAAA,cACP;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAGA,YAAM,QAAQ,IAAI;AAElB,UAAI,CAAC,SAAS,QAAQ,QAAQ;AAC5B,iBAAS,QAAQ,SAAS,EAAE,OAAO,CAAC,EAAE;AAAA,MACxC;AACA,eAAS,QAAQ,OAAO,QAAQ;AAAA,IAClC,CAAC;AAAA,EACH;AACF;AAGO,SAAS,6BAA6B,UAA0C,CAAC,GAA2B;AACjH,SAAO,IAAI,uBAAuB,OAAO;AAC3C;AAGA,IAAO,kBAAQ;AAGR,IAAM,gBAAgB;","names":[]}
@@ -1,56 +0,0 @@
1
- import { Compiler } from 'webpack';
2
-
3
- /**
4
- * Webpack Plugin for react-code-locator
5
- * CJS-compatible version - no unplugin dependency
6
- *
7
- * Usage:
8
- * ```js
9
- * // webpack.config.js
10
- * const { ReactCodeLocatorPlugin } = require('react-code-locator/webpack');
11
- *
12
- * module.exports = {
13
- * plugins: [
14
- * new ReactCodeLocatorPlugin()
15
- * ]
16
- * };
17
- * ```
18
- */
19
-
20
- interface ReactCodeLocatorWebpackOptions {
21
- /**
22
- * Enable source transform for component definitions
23
- * @default true
24
- */
25
- injectComponentSource?: boolean;
26
- /**
27
- * Enable source transform for JSX call sites
28
- * @default true
29
- */
30
- injectJsxSource?: boolean;
31
- /**
32
- * Project root for relative path calculation
33
- * @default process.cwd()
34
- */
35
- projectRoot?: string;
36
- /**
37
- * Include filter for file paths
38
- * @default /\.[jt]sx$/
39
- */
40
- include?: RegExp | RegExp[];
41
- /**
42
- * Exclude filter for file paths
43
- * @default /node_modules/
44
- */
45
- exclude?: RegExp | RegExp[];
46
- }
47
- declare class ReactCodeLocatorPlugin {
48
- private options;
49
- constructor(options?: ReactCodeLocatorWebpackOptions);
50
- apply(compiler: Compiler): void;
51
- }
52
- declare function createReactCodeLocatorPlugin(options?: ReactCodeLocatorWebpackOptions): ReactCodeLocatorPlugin;
53
-
54
- declare const webpackPlugin: typeof createReactCodeLocatorPlugin;
55
-
56
- export { ReactCodeLocatorPlugin, type ReactCodeLocatorWebpackOptions, createReactCodeLocatorPlugin, ReactCodeLocatorPlugin as default, webpackPlugin };
package/dist/webpack.d.ts DELETED
@@ -1,56 +0,0 @@
1
- import { Compiler } from 'webpack';
2
-
3
- /**
4
- * Webpack Plugin for react-code-locator
5
- * CJS-compatible version - no unplugin dependency
6
- *
7
- * Usage:
8
- * ```js
9
- * // webpack.config.js
10
- * const { ReactCodeLocatorPlugin } = require('react-code-locator/webpack');
11
- *
12
- * module.exports = {
13
- * plugins: [
14
- * new ReactCodeLocatorPlugin()
15
- * ]
16
- * };
17
- * ```
18
- */
19
-
20
- interface ReactCodeLocatorWebpackOptions {
21
- /**
22
- * Enable source transform for component definitions
23
- * @default true
24
- */
25
- injectComponentSource?: boolean;
26
- /**
27
- * Enable source transform for JSX call sites
28
- * @default true
29
- */
30
- injectJsxSource?: boolean;
31
- /**
32
- * Project root for relative path calculation
33
- * @default process.cwd()
34
- */
35
- projectRoot?: string;
36
- /**
37
- * Include filter for file paths
38
- * @default /\.[jt]sx$/
39
- */
40
- include?: RegExp | RegExp[];
41
- /**
42
- * Exclude filter for file paths
43
- * @default /node_modules/
44
- */
45
- exclude?: RegExp | RegExp[];
46
- }
47
- declare class ReactCodeLocatorPlugin {
48
- private options;
49
- constructor(options?: ReactCodeLocatorWebpackOptions);
50
- apply(compiler: Compiler): void;
51
- }
52
- declare function createReactCodeLocatorPlugin(options?: ReactCodeLocatorWebpackOptions): ReactCodeLocatorPlugin;
53
-
54
- declare const webpackPlugin: typeof createReactCodeLocatorPlugin;
55
-
56
- export { ReactCodeLocatorPlugin, type ReactCodeLocatorWebpackOptions, createReactCodeLocatorPlugin, ReactCodeLocatorPlugin as default, webpackPlugin };
package/dist/webpack.js DELETED
@@ -1,62 +0,0 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
- // src/webpack.ts
9
- var DEFAULT_INCLUDE = /\.([jt]sx)$/;
10
- var DEFAULT_EXCLUDE = /node_modules/;
11
- var ReactCodeLocatorPlugin = class {
12
- options;
13
- constructor(options = {}) {
14
- this.options = options;
15
- }
16
- apply(compiler) {
17
- const {
18
- include = DEFAULT_INCLUDE,
19
- exclude = DEFAULT_EXCLUDE,
20
- projectRoot = process.cwd(),
21
- injectComponentSource = true,
22
- injectJsxSource = true
23
- } = this.options;
24
- const pluginName = "ReactCodeLocatorPlugin";
25
- compiler.hooks.afterEnvironment.tap(pluginName, () => {
26
- const rules = compiler.options.module?.rules || [];
27
- const loaderPath = __require.resolve("./core/webpackPitchLoader-cjs.cjs");
28
- const rule = {
29
- test: include,
30
- exclude,
31
- enforce: "pre",
32
- use: [
33
- {
34
- loader: loaderPath,
35
- options: {
36
- projectRoot,
37
- injectComponentSource,
38
- injectJsxSource
39
- }
40
- }
41
- ]
42
- };
43
- rules.unshift(rule);
44
- if (!compiler.options.module) {
45
- compiler.options.module = { rules: [] };
46
- }
47
- compiler.options.module.rules = rules;
48
- });
49
- }
50
- };
51
- function createReactCodeLocatorPlugin(options = {}) {
52
- return new ReactCodeLocatorPlugin(options);
53
- }
54
- var webpack_default = ReactCodeLocatorPlugin;
55
- var webpackPlugin = createReactCodeLocatorPlugin;
56
- export {
57
- ReactCodeLocatorPlugin,
58
- createReactCodeLocatorPlugin,
59
- webpack_default as default,
60
- webpackPlugin
61
- };
62
- //# sourceMappingURL=webpack.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/webpack.ts"],"sourcesContent":["/**\n * Webpack Plugin for react-code-locator\n * CJS-compatible version - no unplugin dependency\n * \n * Usage:\n * ```js\n * // webpack.config.js\n * const { ReactCodeLocatorPlugin } = require('react-code-locator/webpack');\n * \n * module.exports = {\n * plugins: [\n * new ReactCodeLocatorPlugin()\n * ]\n * };\n * ```\n */\n\nimport { transformSource } from \"./core/transform\";\nimport type { Compiler, NormalModule } from \"webpack\";\n\nexport interface ReactCodeLocatorWebpackOptions {\n /** \n * Enable source transform for component definitions\n * @default true\n */\n injectComponentSource?: boolean;\n \n /** \n * Enable source transform for JSX call sites\n * @default true\n */\n injectJsxSource?: boolean;\n \n /**\n * Project root for relative path calculation\n * @default process.cwd()\n */\n projectRoot?: string;\n \n /**\n * Include filter for file paths\n * @default /\\.[jt]sx$/\n */\n include?: RegExp | RegExp[];\n \n /**\n * Exclude filter for file paths\n * @default /node_modules/\n */\n exclude?: RegExp | RegExp[];\n}\n\nconst DEFAULT_INCLUDE = /\\.([jt]sx)$/;\nconst DEFAULT_EXCLUDE = /node_modules/;\n\nfunction shouldTransform(id: string, include: RegExp | RegExp[], exclude: RegExp | RegExp[]): boolean {\n const includePatterns = Array.isArray(include) ? include : [include];\n const excludePatterns = Array.isArray(exclude) ? exclude : [exclude];\n \n if (excludePatterns.some(pattern => pattern.test(id))) {\n return false;\n }\n \n return includePatterns.some(pattern => pattern.test(id));\n}\n\nexport class ReactCodeLocatorPlugin {\n private options: ReactCodeLocatorWebpackOptions;\n\n constructor(options: ReactCodeLocatorWebpackOptions = {}) {\n this.options = options;\n }\n\n apply(compiler: Compiler): void {\n const {\n include = DEFAULT_INCLUDE,\n exclude = DEFAULT_EXCLUDE,\n projectRoot = process.cwd(),\n injectComponentSource = true,\n injectJsxSource = true,\n } = this.options;\n\n const pluginName = \"ReactCodeLocatorPlugin\";\n\n // Add loader rule using compiler.options.module.rules\n compiler.hooks.afterEnvironment.tap(pluginName, () => {\n const rules = compiler.options.module?.rules || [];\n \n // Create loader path - use bundled CJS version (relative to webpack.cjs)\n const loaderPath = require.resolve('./core/webpackPitchLoader-cjs.cjs');\n \n // Create rule\n const rule = {\n test: include,\n exclude: exclude,\n enforce: 'pre' as const,\n use: [\n {\n loader: loaderPath,\n options: {\n projectRoot,\n injectComponentSource,\n injectJsxSource,\n },\n },\n ],\n };\n \n // Add rule to beginning\n rules.unshift(rule);\n \n if (!compiler.options.module) {\n compiler.options.module = { rules: [] } as any;\n }\n compiler.options.module.rules = rules;\n });\n }\n}\n\n// Factory function\nexport function createReactCodeLocatorPlugin(options: ReactCodeLocatorWebpackOptions = {}): ReactCodeLocatorPlugin {\n return new ReactCodeLocatorPlugin(options);\n}\n\n// Default export\nexport default ReactCodeLocatorPlugin;\n\n// Also export as webpackPlugin for compatibility\nexport const webpackPlugin = createReactCodeLocatorPlugin;\n"],"mappings":";;;;;;;;AAoDA,IAAM,kBAAkB;AACxB,IAAM,kBAAkB;AAajB,IAAM,yBAAN,MAA6B;AAAA,EAC1B;AAAA,EAER,YAAY,UAA0C,CAAC,GAAG;AACxD,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,MAAM,UAA0B;AAC9B,UAAM;AAAA,MACJ,UAAU;AAAA,MACV,UAAU;AAAA,MACV,cAAc,QAAQ,IAAI;AAAA,MAC1B,wBAAwB;AAAA,MACxB,kBAAkB;AAAA,IACpB,IAAI,KAAK;AAET,UAAM,aAAa;AAGnB,aAAS,MAAM,iBAAiB,IAAI,YAAY,MAAM;AACpD,YAAM,QAAQ,SAAS,QAAQ,QAAQ,SAAS,CAAC;AAGjD,YAAM,aAAa,UAAQ,QAAQ,mCAAmC;AAGtE,YAAM,OAAO;AAAA,QACX,MAAM;AAAA,QACN;AAAA,QACA,SAAS;AAAA,QACT,KAAK;AAAA,UACH;AAAA,YACE,QAAQ;AAAA,YACR,SAAS;AAAA,cACP;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAGA,YAAM,QAAQ,IAAI;AAElB,UAAI,CAAC,SAAS,QAAQ,QAAQ;AAC5B,iBAAS,QAAQ,SAAS,EAAE,OAAO,CAAC,EAAE;AAAA,MACxC;AACA,eAAS,QAAQ,OAAO,QAAQ;AAAA,IAClC,CAAC;AAAA,EACH;AACF;AAGO,SAAS,6BAA6B,UAA0C,CAAC,GAA2B;AACjH,SAAO,IAAI,uBAAuB,OAAO;AAC3C;AAGA,IAAO,kBAAQ;AAGR,IAAM,gBAAgB;","names":[]}