@lego-build/plugins 0.0.3 → 0.0.10
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/auto.js +3 -10
- package/dist/babel-plugin.d.ts +18 -0
- package/dist/babel-plugin.js +43 -0
- package/dist/{chunk-MZJDRENL.js → chunk-2R3NUXAB.js} +13 -9
- package/dist/chunk-3TRIUWCT.js +539 -0
- package/dist/chunk-42QHGI4F.js +512 -0
- package/dist/chunk-4EX2R46A.js +528 -0
- package/dist/{chunk-RM4HZDF3.js → chunk-6EMRLRSE.js} +12 -5
- package/dist/chunk-6MOTW5WZ.js +505 -0
- package/dist/chunk-FJKEG5SO.js +493 -0
- package/dist/chunk-J6RRTMEB.js +553 -0
- package/dist/chunk-L7YJKPPK.js +438 -0
- package/dist/chunk-NYSOJK4V.js +436 -0
- package/dist/chunk-ONSLHF7O.js +553 -0
- package/dist/chunk-QMPWAJBL.js +539 -0
- package/dist/chunk-RG2IIZUF.js +560 -0
- package/dist/chunk-SQ3BWA54.js +307 -0
- package/dist/chunk-URUG7I3S.js +539 -0
- package/dist/chunk-V3KCJYHC.js +468 -0
- package/dist/chunk-XRXDULJG.js +502 -0
- package/dist/chunk-XZZFN45X.js +539 -0
- package/dist/index.d.ts +4 -32
- package/dist/index.js +8 -830
- package/dist/react.d.ts +7 -0
- package/dist/react.js +18 -0
- package/dist/vite-plugin.d.ts +16 -0
- package/dist/vite-plugin.js +103 -0
- package/package.json +35 -34
- package/dist/webpack-loader.d.ts +0 -25
- package/dist/webpack-loader.js +0 -198
package/dist/react.d.ts
ADDED
package/dist/react.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
initIframeBridge
|
|
4
|
+
} from "./chunk-FJKEG5SO.js";
|
|
5
|
+
|
|
6
|
+
// src/react.tsx
|
|
7
|
+
import { useEffect } from "react";
|
|
8
|
+
function IframeBridge() {
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
initIframeBridge();
|
|
11
|
+
}, []);
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
var react_default = IframeBridge;
|
|
15
|
+
export {
|
|
16
|
+
IframeBridge,
|
|
17
|
+
react_default as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
|
|
3
|
+
interface SourceLocatorOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Patterns to exclude from source location injection
|
|
6
|
+
* @default ['node_modules', 'dist', 'build']
|
|
7
|
+
*/
|
|
8
|
+
exclude?: string[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Vite plugin that adds data-locator-path and data-locator-line attributes
|
|
12
|
+
* to JSX elements for inline editing support.
|
|
13
|
+
*/
|
|
14
|
+
declare function sourceLocator(options?: SourceLocatorOptions): Plugin;
|
|
15
|
+
|
|
16
|
+
export { type SourceLocatorOptions, sourceLocator as default, sourceLocator };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// src/vite-plugin.ts
|
|
2
|
+
import MagicString from "magic-string";
|
|
3
|
+
import path from "path";
|
|
4
|
+
function sourceLocator(options = {}) {
|
|
5
|
+
const { exclude = ["node_modules", "dist", "build"] } = options;
|
|
6
|
+
let root = "";
|
|
7
|
+
return {
|
|
8
|
+
name: "lego-source-locator",
|
|
9
|
+
enforce: "pre",
|
|
10
|
+
configResolved(config) {
|
|
11
|
+
root = config.root;
|
|
12
|
+
},
|
|
13
|
+
transform(code, id) {
|
|
14
|
+
if (!id.match(/\.[tj]sx$/)) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
for (const pattern of exclude) {
|
|
18
|
+
if (id.includes(pattern)) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const relativePath = path.relative(root, id);
|
|
23
|
+
const s = new MagicString(code);
|
|
24
|
+
let hasChanges = false;
|
|
25
|
+
const jsxOpeningTagRegex = /<([A-Z][a-zA-Z0-9]*|[a-z][a-z0-9-]*)\s*(?=[^>]*>)/g;
|
|
26
|
+
const lines = code.split("\n");
|
|
27
|
+
const lineStarts = [0];
|
|
28
|
+
for (let i = 0; i < lines.length - 1; i++) {
|
|
29
|
+
lineStarts.push(lineStarts[i] + lines[i].length + 1);
|
|
30
|
+
}
|
|
31
|
+
const getLineNumber = (index) => {
|
|
32
|
+
for (let i = lineStarts.length - 1; i >= 0; i--) {
|
|
33
|
+
if (lineStarts[i] <= index) {
|
|
34
|
+
return i + 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return 1;
|
|
38
|
+
};
|
|
39
|
+
let match;
|
|
40
|
+
while ((match = jsxOpeningTagRegex.exec(code)) !== null) {
|
|
41
|
+
const tagStart = match.index;
|
|
42
|
+
const tagName = match[1];
|
|
43
|
+
if (!tagName || tagName === "Fragment") {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
let depth = 1;
|
|
47
|
+
let i = tagStart + match[0].length;
|
|
48
|
+
let inString = null;
|
|
49
|
+
let inExpression = 0;
|
|
50
|
+
while (i < code.length && depth > 0) {
|
|
51
|
+
const char = code[i];
|
|
52
|
+
if (inString) {
|
|
53
|
+
if (char === inString && code[i - 1] !== "\\") {
|
|
54
|
+
inString = null;
|
|
55
|
+
}
|
|
56
|
+
} else if (inExpression > 0) {
|
|
57
|
+
if (char === "{") {
|
|
58
|
+
inExpression++;
|
|
59
|
+
} else if (char === "}") {
|
|
60
|
+
inExpression--;
|
|
61
|
+
} else if (char === '"' || char === "'" || char === "`") {
|
|
62
|
+
inString = char;
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
if (char === "{") {
|
|
66
|
+
inExpression++;
|
|
67
|
+
} else if (char === '"' || char === "'" || char === "`") {
|
|
68
|
+
inString = char;
|
|
69
|
+
} else if (char === ">") {
|
|
70
|
+
depth = 0;
|
|
71
|
+
} else if (char === "/" && code[i + 1] === ">") {
|
|
72
|
+
depth = 0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
i++;
|
|
76
|
+
}
|
|
77
|
+
if (depth === 0) {
|
|
78
|
+
const insertPos = code[i - 2] === "/" ? i - 2 : i - 1;
|
|
79
|
+
const lineNum = getLineNumber(tagStart);
|
|
80
|
+
const tagContent = code.slice(tagStart, i);
|
|
81
|
+
if (tagContent.includes("data-locator-path")) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
const attrs = ` data-locator-path="${relativePath}" data-locator-line="${lineNum}"`;
|
|
85
|
+
s.appendLeft(insertPos, attrs);
|
|
86
|
+
hasChanges = true;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (!hasChanges) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
code: s.toString(),
|
|
94
|
+
map: s.generateMap({ hires: true })
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
var vite_plugin_default = sourceLocator;
|
|
100
|
+
export {
|
|
101
|
+
vite_plugin_default as default,
|
|
102
|
+
sourceLocator
|
|
103
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lego-build/plugins",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -9,47 +9,48 @@
|
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"import": "./dist/index.js"
|
|
11
11
|
},
|
|
12
|
-
"./
|
|
13
|
-
"import": "./dist/
|
|
12
|
+
"./auto": {
|
|
13
|
+
"import": "./dist/auto.js"
|
|
14
14
|
},
|
|
15
|
-
"./
|
|
16
|
-
"
|
|
15
|
+
"./react": {
|
|
16
|
+
"types": "./dist/react.d.ts",
|
|
17
|
+
"import": "./dist/react.js"
|
|
18
|
+
},
|
|
19
|
+
"./vite-plugin": {
|
|
20
|
+
"types": "./dist/vite-plugin.d.ts",
|
|
21
|
+
"import": "./dist/vite-plugin.js"
|
|
22
|
+
},
|
|
23
|
+
"./babel-plugin": {
|
|
24
|
+
"types": "./dist/babel-plugin.d.ts",
|
|
25
|
+
"import": "./dist/babel-plugin.js"
|
|
17
26
|
}
|
|
18
27
|
},
|
|
19
|
-
"files": [
|
|
20
|
-
"dist"
|
|
21
|
-
],
|
|
22
|
-
"scripts": {
|
|
23
|
-
"build": "tsup src/index.ts src/webpack-loader.ts --format esm --dts",
|
|
24
|
-
"dev": "tsup src/index.ts src/webpack-loader.ts --format esm --dts --watch"
|
|
25
|
-
},
|
|
26
28
|
"dependencies": {
|
|
27
|
-
"
|
|
28
|
-
"@babel/parser": "^7.27.0",
|
|
29
|
-
"@babel/traverse": "^7.27.0",
|
|
30
|
-
"@babel/types": "^7.27.0",
|
|
31
|
-
"micromatch": "^4.0.5"
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@types/babel__generator": "^7.27.0",
|
|
35
|
-
"@types/babel__traverse": "^7.20.7",
|
|
36
|
-
"@types/micromatch": "^4.0.9",
|
|
37
|
-
"@types/node": "^22",
|
|
38
|
-
"@types/webpack": "^5.28.5",
|
|
39
|
-
"tsup": "^8.0.0",
|
|
40
|
-
"typescript": "^5.0.0",
|
|
41
|
-
"webpack": "^5.98.0"
|
|
29
|
+
"magic-string": "^0.30.0"
|
|
42
30
|
},
|
|
43
31
|
"peerDependencies": {
|
|
44
|
-
"
|
|
45
|
-
"webpack": "^5.0.0"
|
|
32
|
+
"react": ">=18"
|
|
46
33
|
},
|
|
47
34
|
"peerDependenciesMeta": {
|
|
48
|
-
"
|
|
49
|
-
"optional": true
|
|
50
|
-
},
|
|
51
|
-
"webpack": {
|
|
35
|
+
"react": {
|
|
52
36
|
"optional": true
|
|
53
37
|
}
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@babel/core": "^7.24.0",
|
|
41
|
+
"@types/babel__core": "^7.20.0",
|
|
42
|
+
"@types/react": "^18",
|
|
43
|
+
"react": "^18",
|
|
44
|
+
"tsup": "^8.0.0",
|
|
45
|
+
"typescript": "^5.0.0",
|
|
46
|
+
"vite": "^5.0.0"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsup src/index.ts src/auto.ts src/react.tsx src/vite-plugin.ts src/babel-plugin.ts --format esm --dts --external react",
|
|
50
|
+
"dev": "tsup src/index.ts src/auto.ts src/react.tsx src/vite-plugin.ts src/babel-plugin.ts --format esm --dts --external react --watch",
|
|
51
|
+
"publish:patch": "./scripts/publish.sh patch",
|
|
52
|
+
"publish:minor": "./scripts/publish.sh minor",
|
|
53
|
+
"publish:major": "./scripts/publish.sh major",
|
|
54
|
+
"publish:only": "./scripts/publish.sh none"
|
|
54
55
|
}
|
|
55
|
-
}
|
|
56
|
+
}
|
package/dist/webpack-loader.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
interface SourceLocatorLoaderOptions {
|
|
2
|
-
/** Prefix for data attributes (default: 'locator') */
|
|
3
|
-
prefix?: string;
|
|
4
|
-
/** Custom filter for tags */
|
|
5
|
-
filterTag?: string[] | ((tag: string) => boolean);
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Webpack loader for adding source locator attributes to JSX elements.
|
|
9
|
-
* Use in next.config.js with webpack config.
|
|
10
|
-
*/
|
|
11
|
-
declare function sourceLocatorLoader(this: any, source: string): string;
|
|
12
|
-
/**
|
|
13
|
-
* Helper to add source locator loader to Next.js webpack config.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* // next.config.mjs
|
|
17
|
-
* import { withSourceLocator } from '@lego-build/plugins/next';
|
|
18
|
-
*
|
|
19
|
-
* export default withSourceLocator({
|
|
20
|
-
* // your next config
|
|
21
|
-
* });
|
|
22
|
-
*/
|
|
23
|
-
declare function withSourceLocator(nextConfig?: any, loaderOptions?: SourceLocatorLoaderOptions): any;
|
|
24
|
-
|
|
25
|
-
export { type SourceLocatorLoaderOptions, sourceLocatorLoader as default, withSourceLocator };
|
package/dist/webpack-loader.js
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
// src/webpack-loader.ts
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { createRequire } from "module";
|
|
4
|
-
import * as parser from "@babel/parser";
|
|
5
|
-
import traverse from "@babel/traverse";
|
|
6
|
-
import generate from "@babel/generator";
|
|
7
|
-
import * as t from "@babel/types";
|
|
8
|
-
var require2 = createRequire(import.meta.url);
|
|
9
|
-
var HTML_TAGS = [
|
|
10
|
-
"div",
|
|
11
|
-
"span",
|
|
12
|
-
"p",
|
|
13
|
-
"h1",
|
|
14
|
-
"h2",
|
|
15
|
-
"h3",
|
|
16
|
-
"h4",
|
|
17
|
-
"h5",
|
|
18
|
-
"h6",
|
|
19
|
-
"button",
|
|
20
|
-
"a",
|
|
21
|
-
"img",
|
|
22
|
-
"input",
|
|
23
|
-
"textarea",
|
|
24
|
-
"select",
|
|
25
|
-
"form",
|
|
26
|
-
"ul",
|
|
27
|
-
"ol",
|
|
28
|
-
"li",
|
|
29
|
-
"table",
|
|
30
|
-
"thead",
|
|
31
|
-
"tbody",
|
|
32
|
-
"tr",
|
|
33
|
-
"td",
|
|
34
|
-
"th",
|
|
35
|
-
"header",
|
|
36
|
-
"footer",
|
|
37
|
-
"nav",
|
|
38
|
-
"main",
|
|
39
|
-
"section",
|
|
40
|
-
"article",
|
|
41
|
-
"aside",
|
|
42
|
-
"label",
|
|
43
|
-
"strong",
|
|
44
|
-
"em",
|
|
45
|
-
"code",
|
|
46
|
-
"pre",
|
|
47
|
-
"blockquote"
|
|
48
|
-
];
|
|
49
|
-
var TEXT_TAGS = ["label", "span", "button", "p", "div", "h1", "h2", "h3", "h4", "h5", "h6"];
|
|
50
|
-
function getWorkspaceRoot(filePath) {
|
|
51
|
-
let dir = path.resolve(filePath);
|
|
52
|
-
const { root } = path.parse(dir);
|
|
53
|
-
while (dir !== root) {
|
|
54
|
-
if (path.basename(dir) === "workspace") return dir;
|
|
55
|
-
dir = path.dirname(dir);
|
|
56
|
-
}
|
|
57
|
-
return path.resolve(process.cwd(), "..");
|
|
58
|
-
}
|
|
59
|
-
function shouldProcessTag(tagName, options) {
|
|
60
|
-
if (options.filterTag) {
|
|
61
|
-
if (Array.isArray(options.filterTag)) {
|
|
62
|
-
return options.filterTag.includes(tagName);
|
|
63
|
-
}
|
|
64
|
-
return options.filterTag(tagName);
|
|
65
|
-
}
|
|
66
|
-
return HTML_TAGS.includes(tagName.toLowerCase());
|
|
67
|
-
}
|
|
68
|
-
function getElementTextContent(nodePath) {
|
|
69
|
-
const parent = nodePath.parent;
|
|
70
|
-
if (!t.isJSXElement(parent)) return "";
|
|
71
|
-
let text = "";
|
|
72
|
-
let hasExpression = false;
|
|
73
|
-
for (const child of parent.children) {
|
|
74
|
-
if (t.isJSXText(child)) {
|
|
75
|
-
text += child.value;
|
|
76
|
-
} else if (t.isJSXExpressionContainer(child)) {
|
|
77
|
-
hasExpression = true;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return hasExpression ? "" : text.trim();
|
|
81
|
-
}
|
|
82
|
-
function transformJSX(code, filePath, prefix, options) {
|
|
83
|
-
const ast = parser.parse(code, {
|
|
84
|
-
sourceType: "module",
|
|
85
|
-
plugins: ["jsx", "typescript", "classProperties", "decorators-legacy"]
|
|
86
|
-
});
|
|
87
|
-
const workspaceRoot = getWorkspaceRoot(filePath);
|
|
88
|
-
const relativePath = path.relative(workspaceRoot, filePath);
|
|
89
|
-
let hasChanges = false;
|
|
90
|
-
traverse(ast, {
|
|
91
|
-
JSXOpeningElement(nodePath) {
|
|
92
|
-
const node = nodePath.node;
|
|
93
|
-
const hasLocatorAttr = node.attributes.some(
|
|
94
|
-
(attr) => t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name) && attr.name.name.startsWith(`data-${prefix}`)
|
|
95
|
-
);
|
|
96
|
-
if (hasLocatorAttr) return;
|
|
97
|
-
if (t.isJSXIdentifier(node.name) && node.name.name === "Fragment") return;
|
|
98
|
-
if (t.isJSXMemberExpression(node.name) && t.isJSXIdentifier(node.name.object) && node.name.object.name === "React" && t.isJSXIdentifier(node.name.property) && node.name.property.name === "Fragment")
|
|
99
|
-
return;
|
|
100
|
-
let tagName = "";
|
|
101
|
-
if (t.isJSXIdentifier(node.name)) {
|
|
102
|
-
tagName = node.name.name;
|
|
103
|
-
}
|
|
104
|
-
if (!shouldProcessTag(tagName, options)) return;
|
|
105
|
-
const line = node.loc?.start.line;
|
|
106
|
-
const column = node.loc?.start.column;
|
|
107
|
-
if (!line || column === void 0) return;
|
|
108
|
-
const textContent = TEXT_TAGS.includes(tagName.toLowerCase()) ? getElementTextContent(nodePath) : "";
|
|
109
|
-
const attributes = [
|
|
110
|
-
t.jsxAttribute(t.jsxIdentifier(`data-${prefix}-path`), t.stringLiteral(relativePath)),
|
|
111
|
-
t.jsxAttribute(t.jsxIdentifier(`data-${prefix}-line`), t.stringLiteral(String(line))),
|
|
112
|
-
t.jsxAttribute(t.jsxIdentifier(`data-${prefix}-column`), t.stringLiteral(String(column))),
|
|
113
|
-
t.jsxAttribute(t.jsxIdentifier(`data-${prefix}-tag`), t.stringLiteral(tagName))
|
|
114
|
-
];
|
|
115
|
-
if (textContent) {
|
|
116
|
-
attributes.push(
|
|
117
|
-
t.jsxAttribute(
|
|
118
|
-
t.jsxIdentifier(`data-${prefix}-text`),
|
|
119
|
-
t.stringLiteral(textContent)
|
|
120
|
-
)
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
const spreadIndex = node.attributes.findIndex((attr) => t.isJSXSpreadAttribute(attr));
|
|
124
|
-
if (spreadIndex === -1) {
|
|
125
|
-
node.attributes.push(...attributes);
|
|
126
|
-
} else {
|
|
127
|
-
node.attributes.splice(spreadIndex, 0, ...attributes);
|
|
128
|
-
}
|
|
129
|
-
hasChanges = true;
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
if (!hasChanges) return null;
|
|
133
|
-
const result = generate(ast, {}, code);
|
|
134
|
-
return result.code;
|
|
135
|
-
}
|
|
136
|
-
function sourceLocatorLoader(source) {
|
|
137
|
-
const options = this.getOptions() || {};
|
|
138
|
-
const { prefix = "locator" } = options;
|
|
139
|
-
if (process.env.NODE_ENV !== "development") {
|
|
140
|
-
return source;
|
|
141
|
-
}
|
|
142
|
-
const ext = path.extname(this.resourcePath);
|
|
143
|
-
if (![".jsx", ".tsx", ".js", ".ts"].includes(ext)) {
|
|
144
|
-
return source;
|
|
145
|
-
}
|
|
146
|
-
if (this.resourcePath.includes("node_modules")) {
|
|
147
|
-
return source;
|
|
148
|
-
}
|
|
149
|
-
try {
|
|
150
|
-
const result = transformJSX(source, this.resourcePath, prefix, options);
|
|
151
|
-
return result || source;
|
|
152
|
-
} catch (error) {
|
|
153
|
-
console.error(`[source-locator] Error transforming ${this.resourcePath}:`, error);
|
|
154
|
-
return source;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function withSourceLocator(nextConfig = {}, loaderOptions = {}) {
|
|
158
|
-
return {
|
|
159
|
-
...nextConfig,
|
|
160
|
-
webpack(config, options) {
|
|
161
|
-
if (options.dev) {
|
|
162
|
-
config.module.rules.push({
|
|
163
|
-
test: /\.(jsx|tsx|js|ts)$/,
|
|
164
|
-
exclude: /node_modules/,
|
|
165
|
-
use: [
|
|
166
|
-
{
|
|
167
|
-
loader: require2.resolve("@lego-build/plugins/webpack-loader"),
|
|
168
|
-
options: loaderOptions
|
|
169
|
-
}
|
|
170
|
-
]
|
|
171
|
-
});
|
|
172
|
-
if (!options.isServer) {
|
|
173
|
-
const originalEntry = config.entry;
|
|
174
|
-
config.entry = async () => {
|
|
175
|
-
const entries = await (typeof originalEntry === "function" ? originalEntry() : originalEntry);
|
|
176
|
-
for (const entryName of Object.keys(entries)) {
|
|
177
|
-
if (Array.isArray(entries[entryName])) {
|
|
178
|
-
const bridgePath = require2.resolve("@lego-build/plugins");
|
|
179
|
-
if (!entries[entryName].includes(bridgePath)) {
|
|
180
|
-
entries[entryName].unshift(bridgePath);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return entries;
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
if (typeof nextConfig.webpack === "function") {
|
|
189
|
-
return nextConfig.webpack(config, options);
|
|
190
|
-
}
|
|
191
|
-
return config;
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
export {
|
|
196
|
-
sourceLocatorLoader as default,
|
|
197
|
-
withSourceLocator
|
|
198
|
-
};
|