@builder.io/dev-tools 1.6.49 → 1.6.50-dev.202505202036.032b583c
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/angular/index.cjs +46 -1
- package/angular/index.mjs +21 -1
- package/cli/index.cjs +105830 -3553
- package/cli/index.cjs.map +4 -4
- package/core/index.cjs +13656 -851
- package/core/index.mjs +13647 -852
- package/figma/index.cjs +39 -1
- package/figma/index.mjs +19 -1
- package/node/index.cjs +25304 -105
- package/node/index.mjs +25308 -105
- package/package.json +1 -1
- package/remix/build.cjs +132 -1
- package/remix/index.mjs +113 -1
- package/server/index.cjs +15022 -1363
- package/server/index.mjs +15015 -1363
- package/types/cli/code-file-utils.d.ts +2 -40
- package/types/cli/code-tools.d.ts +9 -5
- package/types/cli/codegen.d.ts +9 -20
- package/types/cli/index.d.ts +0 -2
- package/types/cli/launch/github.d.ts +1 -3
- package/types/cli/launch.d.ts +19 -2
- package/types/cli/utils/open.d.ts +1 -0
- package/types/tsconfig.tsbuildinfo +1 -1
- package/vite/index.cjs +153 -3
- package/vite/index.mjs +119 -3
- package/webpack/index.cjs +2883 -27
- package/webpack/index.mjs +2871 -27
package/package.json
CHANGED
package/remix/build.cjs
CHANGED
|
@@ -1 +1,132 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/dev-tools/remix/index.ts
|
|
21
|
+
var remix_exports = {};
|
|
22
|
+
__export(remix_exports, {
|
|
23
|
+
default: () => remix_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(remix_exports);
|
|
26
|
+
var import_core = require("../core/index.cjs");
|
|
27
|
+
var import_node = require("../node/index.cjs");
|
|
28
|
+
var import_server = require("../server/index.cjs");
|
|
29
|
+
var import_node_path = require("path");
|
|
30
|
+
var import_node_fs = require("fs");
|
|
31
|
+
var remix_default = (devToolsOpts = {}) => {
|
|
32
|
+
return (remixConfig) => {
|
|
33
|
+
if (devToolsOpts.enabled == null) {
|
|
34
|
+
devToolsOpts.enabled = process.env.NODE_ENV !== "production";
|
|
35
|
+
}
|
|
36
|
+
if (devToolsOpts.enabled === false) {
|
|
37
|
+
return remixConfig;
|
|
38
|
+
}
|
|
39
|
+
const withBuilderConfig = { ...remixConfig };
|
|
40
|
+
const configPath = findRemixConfigPath(process.cwd());
|
|
41
|
+
const rootDir = (0, import_node_path.dirname)(configPath);
|
|
42
|
+
process.env.BUILDER_REMIX_DEVTOOLS_URL = `http://localhost:5273/`;
|
|
43
|
+
withBuilderConfig.watchPaths = async () => {
|
|
44
|
+
const sys = await (0, import_node.createDevToolsNodeSys)({
|
|
45
|
+
cwd: rootDir
|
|
46
|
+
});
|
|
47
|
+
const devTools = await (0, import_core.createDevTools)(sys);
|
|
48
|
+
const devToolsServer = await (0, import_server.createDevToolsServer)({
|
|
49
|
+
...devTools,
|
|
50
|
+
getClientId: () => "remix-builder-dev-tools",
|
|
51
|
+
closeAppServer: async () => {
|
|
52
|
+
},
|
|
53
|
+
restartAppServer: async () => {
|
|
54
|
+
sys.debug("restart server");
|
|
55
|
+
const content = (0, import_node_fs.readFileSync)(configPath, "utf-8");
|
|
56
|
+
(0, import_node_fs.writeFileSync)(configPath, content);
|
|
57
|
+
},
|
|
58
|
+
enableAppWatch: async (enable) => {
|
|
59
|
+
return enable;
|
|
60
|
+
},
|
|
61
|
+
...sys,
|
|
62
|
+
...devToolsOpts
|
|
63
|
+
});
|
|
64
|
+
process.env.BUILDER_REMIX_DEVTOOLS_URL = devToolsServer.getUrl();
|
|
65
|
+
if (typeof remixConfig.watchPaths === "function") {
|
|
66
|
+
return remixConfig.watchPaths();
|
|
67
|
+
}
|
|
68
|
+
if (remixConfig.watchPaths) {
|
|
69
|
+
return remixConfig.watchPaths;
|
|
70
|
+
}
|
|
71
|
+
return [];
|
|
72
|
+
};
|
|
73
|
+
let dir;
|
|
74
|
+
if (true) {
|
|
75
|
+
dir = __dirname;
|
|
76
|
+
} else {
|
|
77
|
+
dir = (0, import_node_path.dirname)(fileURLToPath(import_meta.url));
|
|
78
|
+
}
|
|
79
|
+
const devToolServerEntryPath = (0, import_node_path.join)(dir, "server-build", "index.mjs");
|
|
80
|
+
if (!(0, import_node_fs.existsSync)(devToolServerEntryPath)) {
|
|
81
|
+
console.log(
|
|
82
|
+
`Builder Devtools unable to run: "${devToolServerEntryPath}" not found`
|
|
83
|
+
);
|
|
84
|
+
return remixConfig;
|
|
85
|
+
}
|
|
86
|
+
if (typeof remixConfig.server === "string") {
|
|
87
|
+
const userServerEntryPath = (0, import_node_path.resolve)(
|
|
88
|
+
(0, import_node_path.dirname)(configPath),
|
|
89
|
+
remixConfig.server
|
|
90
|
+
);
|
|
91
|
+
if (!(0, import_node_fs.existsSync)(userServerEntryPath)) {
|
|
92
|
+
console.log(
|
|
93
|
+
`Builder Devtools unable to run: "${userServerEntryPath}" set from "${remixConfig.server}" server config not found`
|
|
94
|
+
);
|
|
95
|
+
return remixConfig;
|
|
96
|
+
}
|
|
97
|
+
let madeChanges = false;
|
|
98
|
+
let userServerEntryContent = (0, import_node_fs.readFileSync)(userServerEntryPath, "utf-8");
|
|
99
|
+
while (userServerEntryContent.includes("@remix-run/dev/server-build")) {
|
|
100
|
+
userServerEntryContent = userServerEntryContent.replace(
|
|
101
|
+
`@remix-run/dev/server-build`,
|
|
102
|
+
`@builder.io/dev-tools/remix/server-build`
|
|
103
|
+
);
|
|
104
|
+
madeChanges = true;
|
|
105
|
+
}
|
|
106
|
+
if (madeChanges) {
|
|
107
|
+
(0, import_node_fs.writeFileSync)(userServerEntryPath, userServerEntryContent);
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
withBuilderConfig.server = devToolServerEntryPath;
|
|
111
|
+
}
|
|
112
|
+
return withBuilderConfig;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
function findRemixConfigPath(dir) {
|
|
116
|
+
const fsRoot = (0, import_node_path.resolve)("/");
|
|
117
|
+
for (let i = 0; i < 20; i++) {
|
|
118
|
+
let configPath = (0, import_node_path.join)(dir, "remix.config.js");
|
|
119
|
+
if ((0, import_node_fs.existsSync)(configPath)) {
|
|
120
|
+
return configPath;
|
|
121
|
+
}
|
|
122
|
+
configPath = (0, import_node_path.join)(dir, "remix.config.ts");
|
|
123
|
+
if ((0, import_node_fs.existsSync)(configPath)) {
|
|
124
|
+
return configPath;
|
|
125
|
+
}
|
|
126
|
+
if (dir === fsRoot) {
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
dir = (0, import_node_path.dirname)(dir);
|
|
130
|
+
}
|
|
131
|
+
throw new Error(`Could not find Remix config`);
|
|
132
|
+
}
|
package/remix/index.mjs
CHANGED
|
@@ -1,2 +1,114 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
// packages/dev-tools/remix/index.ts
|
|
4
|
+
import { createDevTools } from "../core/index.mjs";
|
|
5
|
+
import { createDevToolsNodeSys } from "../node/index.mjs";
|
|
6
|
+
import { createDevToolsServer } from "../server/index.mjs";
|
|
7
|
+
import { dirname, join, resolve } from "path";
|
|
8
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
9
|
+
import { fileURLToPath } from "url";
|
|
10
|
+
var remix_default = (devToolsOpts = {}) => {
|
|
11
|
+
return (remixConfig) => {
|
|
12
|
+
if (devToolsOpts.enabled == null) {
|
|
13
|
+
devToolsOpts.enabled = process.env.NODE_ENV !== "production";
|
|
14
|
+
}
|
|
15
|
+
if (devToolsOpts.enabled === false) {
|
|
16
|
+
return remixConfig;
|
|
17
|
+
}
|
|
18
|
+
const withBuilderConfig = { ...remixConfig };
|
|
19
|
+
const configPath = findRemixConfigPath(process.cwd());
|
|
20
|
+
const rootDir = dirname(configPath);
|
|
21
|
+
process.env.BUILDER_REMIX_DEVTOOLS_URL = `http://localhost:5273/`;
|
|
22
|
+
withBuilderConfig.watchPaths = async () => {
|
|
23
|
+
const sys = await createDevToolsNodeSys({
|
|
24
|
+
cwd: rootDir
|
|
25
|
+
});
|
|
26
|
+
const devTools = await createDevTools(sys);
|
|
27
|
+
const devToolsServer = await createDevToolsServer({
|
|
28
|
+
...devTools,
|
|
29
|
+
getClientId: () => "remix-builder-dev-tools",
|
|
30
|
+
closeAppServer: async () => {
|
|
31
|
+
},
|
|
32
|
+
restartAppServer: async () => {
|
|
33
|
+
sys.debug("restart server");
|
|
34
|
+
const content = readFileSync(configPath, "utf-8");
|
|
35
|
+
writeFileSync(configPath, content);
|
|
36
|
+
},
|
|
37
|
+
enableAppWatch: async (enable) => {
|
|
38
|
+
return enable;
|
|
39
|
+
},
|
|
40
|
+
...sys,
|
|
41
|
+
...devToolsOpts
|
|
42
|
+
});
|
|
43
|
+
process.env.BUILDER_REMIX_DEVTOOLS_URL = devToolsServer.getUrl();
|
|
44
|
+
if (typeof remixConfig.watchPaths === "function") {
|
|
45
|
+
return remixConfig.watchPaths();
|
|
46
|
+
}
|
|
47
|
+
if (remixConfig.watchPaths) {
|
|
48
|
+
return remixConfig.watchPaths;
|
|
49
|
+
}
|
|
50
|
+
return [];
|
|
51
|
+
};
|
|
52
|
+
let dir;
|
|
53
|
+
if (false) {
|
|
54
|
+
dir = __dirname;
|
|
55
|
+
} else {
|
|
56
|
+
dir = dirname(fileURLToPath(import.meta.url));
|
|
57
|
+
}
|
|
58
|
+
const devToolServerEntryPath = join(dir, "server-build", "index.mjs");
|
|
59
|
+
if (!existsSync(devToolServerEntryPath)) {
|
|
60
|
+
console.log(
|
|
61
|
+
`Builder Devtools unable to run: "${devToolServerEntryPath}" not found`
|
|
62
|
+
);
|
|
63
|
+
return remixConfig;
|
|
64
|
+
}
|
|
65
|
+
if (typeof remixConfig.server === "string") {
|
|
66
|
+
const userServerEntryPath = resolve(
|
|
67
|
+
dirname(configPath),
|
|
68
|
+
remixConfig.server
|
|
69
|
+
);
|
|
70
|
+
if (!existsSync(userServerEntryPath)) {
|
|
71
|
+
console.log(
|
|
72
|
+
`Builder Devtools unable to run: "${userServerEntryPath}" set from "${remixConfig.server}" server config not found`
|
|
73
|
+
);
|
|
74
|
+
return remixConfig;
|
|
75
|
+
}
|
|
76
|
+
let madeChanges = false;
|
|
77
|
+
let userServerEntryContent = readFileSync(userServerEntryPath, "utf-8");
|
|
78
|
+
while (userServerEntryContent.includes("@remix-run/dev/server-build")) {
|
|
79
|
+
userServerEntryContent = userServerEntryContent.replace(
|
|
80
|
+
`@remix-run/dev/server-build`,
|
|
81
|
+
`@builder.io/dev-tools/remix/server-build`
|
|
82
|
+
);
|
|
83
|
+
madeChanges = true;
|
|
84
|
+
}
|
|
85
|
+
if (madeChanges) {
|
|
86
|
+
writeFileSync(userServerEntryPath, userServerEntryContent);
|
|
87
|
+
}
|
|
88
|
+
} else {
|
|
89
|
+
withBuilderConfig.server = devToolServerEntryPath;
|
|
90
|
+
}
|
|
91
|
+
return withBuilderConfig;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
function findRemixConfigPath(dir) {
|
|
95
|
+
const fsRoot = resolve("/");
|
|
96
|
+
for (let i = 0; i < 20; i++) {
|
|
97
|
+
let configPath = join(dir, "remix.config.js");
|
|
98
|
+
if (existsSync(configPath)) {
|
|
99
|
+
return configPath;
|
|
100
|
+
}
|
|
101
|
+
configPath = join(dir, "remix.config.ts");
|
|
102
|
+
if (existsSync(configPath)) {
|
|
103
|
+
return configPath;
|
|
104
|
+
}
|
|
105
|
+
if (dir === fsRoot) {
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
dir = dirname(dir);
|
|
109
|
+
}
|
|
110
|
+
throw new Error(`Could not find Remix config`);
|
|
111
|
+
}
|
|
112
|
+
export {
|
|
113
|
+
remix_default as default
|
|
114
|
+
};
|