@cedarjs/internal 5.0.0-canary.2561 → 5.0.0-canary.2563
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/build/api.d.ts +1 -0
- package/dist/build/api.d.ts.map +1 -1
- package/dist/build/api.js +47 -2
- package/dist/cjs/build/api.d.ts +1 -0
- package/dist/cjs/build/api.d.ts.map +1 -1
- package/dist/cjs/build/api.js +48 -2
- package/package.json +9 -9
package/dist/build/api.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export declare const buildApi: () => Promise<import("esbuild").BuildResult<Build
|
|
|
3
3
|
export declare const rebuildApi: () => Promise<import("esbuild").BuildResult<BuildOptions>>;
|
|
4
4
|
export declare const cleanApiBuild: () => Promise<void>;
|
|
5
5
|
export declare const buildApiWithVite: () => Promise<import("rollup").RollupOutput | import("rollup").RollupOutput[] | import("rollup").RollupWatcher>;
|
|
6
|
+
export declare function fixSourceMaps(distDir: string, srcDir: string): Promise<void>;
|
|
6
7
|
//# sourceMappingURL=api.d.ts.map
|
package/dist/build/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/build/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,YAAY,EAAe,MAAM,SAAS,CAAA;AAetE,eAAO,MAAM,QAAQ,4DAIpB,CAAA;AAED,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/build/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,YAAY,EAAe,MAAM,SAAS,CAAA;AAetE,eAAO,MAAM,QAAQ,4DAIpB,CAAA;AAED,eAAO,MAAM,UAAU,4DAStB,CAAA;AAED,eAAO,MAAM,aAAa,qBAGzB,CAAA;AAqED,eAAO,MAAM,gBAAgB,iHAqD5B,CAAA;AAcD,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAoDf"}
|
package/dist/build/api.js
CHANGED
|
@@ -19,7 +19,10 @@ const rebuildApi = async () => {
|
|
|
19
19
|
if (!BUILD_CTX) {
|
|
20
20
|
BUILD_CTX = await context(getEsbuildOptions(apiFiles));
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
const result = await BUILD_CTX.rebuild();
|
|
23
|
+
const cedarPaths = getPaths();
|
|
24
|
+
await fixSourceMaps(cedarPaths.api.dist, cedarPaths.api.src);
|
|
25
|
+
return result;
|
|
23
26
|
};
|
|
24
27
|
const cleanApiBuild = async () => {
|
|
25
28
|
const cedarPaths = getPaths();
|
|
@@ -124,8 +127,49 @@ const buildApiWithVite = async () => {
|
|
|
124
127
|
});
|
|
125
128
|
};
|
|
126
129
|
const transpileApi = async (files) => {
|
|
127
|
-
|
|
130
|
+
const result = await build(getEsbuildOptions(files));
|
|
131
|
+
const cedarPaths = getPaths();
|
|
132
|
+
await fixSourceMaps(cedarPaths.api.dist, cedarPaths.api.src);
|
|
133
|
+
return result;
|
|
128
134
|
};
|
|
135
|
+
async function fixSourceMaps(distDir, srcDir) {
|
|
136
|
+
let entries;
|
|
137
|
+
try {
|
|
138
|
+
entries = await fs.promises.readdir(distDir, {
|
|
139
|
+
recursive: true,
|
|
140
|
+
withFileTypes: true
|
|
141
|
+
});
|
|
142
|
+
} catch {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const mapFiles = entries.filter((e) => e.isFile() && e.name.endsWith(".js.map")).map((e) => path.join(e.parentPath ?? e.path, e.name));
|
|
146
|
+
await Promise.all(
|
|
147
|
+
mapFiles.map(async (mapFile) => {
|
|
148
|
+
try {
|
|
149
|
+
const raw = await fs.promises.readFile(mapFile, "utf8");
|
|
150
|
+
const map = JSON.parse(raw);
|
|
151
|
+
if (!Array.isArray(map.sources) || map.sources.length === 0) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const jsFile = mapFile.slice(0, -4);
|
|
155
|
+
const baseName = path.relative(distDir, jsFile).replace(/\.js$/, "");
|
|
156
|
+
const srcFile = [".ts", ".tsx", ".jsx", ".js"].map((ext) => path.join(srcDir, baseName + ext)).find((f) => fs.existsSync(f));
|
|
157
|
+
if (!srcFile) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const correctRelPath = normalizePath(
|
|
161
|
+
path.relative(path.dirname(mapFile), srcFile)
|
|
162
|
+
);
|
|
163
|
+
if (map.sources[0] === correctRelPath) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
map.sources = [correctRelPath];
|
|
167
|
+
await fs.promises.writeFile(mapFile, JSON.stringify(map), "utf8");
|
|
168
|
+
} catch {
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
);
|
|
172
|
+
}
|
|
129
173
|
function getEsbuildOptions(files) {
|
|
130
174
|
const cedarPaths = getPaths();
|
|
131
175
|
const format = projectSideIsEsm("api") ? "esm" : "cjs";
|
|
@@ -149,5 +193,6 @@ export {
|
|
|
149
193
|
buildApi,
|
|
150
194
|
buildApiWithVite,
|
|
151
195
|
cleanApiBuild,
|
|
196
|
+
fixSourceMaps,
|
|
152
197
|
rebuildApi
|
|
153
198
|
};
|
package/dist/cjs/build/api.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export declare const buildApi: () => Promise<import("esbuild").BuildResult<Build
|
|
|
3
3
|
export declare const rebuildApi: () => Promise<import("esbuild").BuildResult<BuildOptions>>;
|
|
4
4
|
export declare const cleanApiBuild: () => Promise<void>;
|
|
5
5
|
export declare const buildApiWithVite: () => Promise<import("rollup").RollupOutput | import("rollup").RollupOutput[] | import("rollup").RollupWatcher>;
|
|
6
|
+
export declare function fixSourceMaps(distDir: string, srcDir: string): Promise<void>;
|
|
6
7
|
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/build/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,YAAY,EAAe,MAAM,SAAS,CAAA;AAetE,eAAO,MAAM,QAAQ,4DAIpB,CAAA;AAED,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/build/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,YAAY,EAAe,MAAM,SAAS,CAAA;AAetE,eAAO,MAAM,QAAQ,4DAIpB,CAAA;AAED,eAAO,MAAM,UAAU,4DAStB,CAAA;AAED,eAAO,MAAM,aAAa,qBAGzB,CAAA;AAqED,eAAO,MAAM,gBAAgB,iHAqD5B,CAAA;AAcD,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAoDf"}
|
package/dist/cjs/build/api.js
CHANGED
|
@@ -31,6 +31,7 @@ __export(api_exports, {
|
|
|
31
31
|
buildApi: () => buildApi,
|
|
32
32
|
buildApiWithVite: () => buildApiWithVite,
|
|
33
33
|
cleanApiBuild: () => cleanApiBuild,
|
|
34
|
+
fixSourceMaps: () => fixSourceMaps,
|
|
34
35
|
rebuildApi: () => rebuildApi
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(api_exports);
|
|
@@ -52,7 +53,10 @@ const rebuildApi = async () => {
|
|
|
52
53
|
if (!BUILD_CTX) {
|
|
53
54
|
BUILD_CTX = await (0, import_esbuild.context)(getEsbuildOptions(apiFiles));
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
+
const result = await BUILD_CTX.rebuild();
|
|
57
|
+
const cedarPaths = (0, import_project_config.getPaths)();
|
|
58
|
+
await fixSourceMaps(cedarPaths.api.dist, cedarPaths.api.src);
|
|
59
|
+
return result;
|
|
56
60
|
};
|
|
57
61
|
const cleanApiBuild = async () => {
|
|
58
62
|
const cedarPaths = (0, import_project_config.getPaths)();
|
|
@@ -157,8 +161,49 @@ const buildApiWithVite = async () => {
|
|
|
157
161
|
});
|
|
158
162
|
};
|
|
159
163
|
const transpileApi = async (files) => {
|
|
160
|
-
|
|
164
|
+
const result = await (0, import_esbuild.build)(getEsbuildOptions(files));
|
|
165
|
+
const cedarPaths = (0, import_project_config.getPaths)();
|
|
166
|
+
await fixSourceMaps(cedarPaths.api.dist, cedarPaths.api.src);
|
|
167
|
+
return result;
|
|
161
168
|
};
|
|
169
|
+
async function fixSourceMaps(distDir, srcDir) {
|
|
170
|
+
let entries;
|
|
171
|
+
try {
|
|
172
|
+
entries = await import_node_fs.default.promises.readdir(distDir, {
|
|
173
|
+
recursive: true,
|
|
174
|
+
withFileTypes: true
|
|
175
|
+
});
|
|
176
|
+
} catch {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const mapFiles = entries.filter((e) => e.isFile() && e.name.endsWith(".js.map")).map((e) => import_node_path.default.join(e.parentPath ?? e.path, e.name));
|
|
180
|
+
await Promise.all(
|
|
181
|
+
mapFiles.map(async (mapFile) => {
|
|
182
|
+
try {
|
|
183
|
+
const raw = await import_node_fs.default.promises.readFile(mapFile, "utf8");
|
|
184
|
+
const map = JSON.parse(raw);
|
|
185
|
+
if (!Array.isArray(map.sources) || map.sources.length === 0) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const jsFile = mapFile.slice(0, -4);
|
|
189
|
+
const baseName = import_node_path.default.relative(distDir, jsFile).replace(/\.js$/, "");
|
|
190
|
+
const srcFile = [".ts", ".tsx", ".jsx", ".js"].map((ext) => import_node_path.default.join(srcDir, baseName + ext)).find((f) => import_node_fs.default.existsSync(f));
|
|
191
|
+
if (!srcFile) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const correctRelPath = (0, import_vite.normalizePath)(
|
|
195
|
+
import_node_path.default.relative(import_node_path.default.dirname(mapFile), srcFile)
|
|
196
|
+
);
|
|
197
|
+
if (map.sources[0] === correctRelPath) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
map.sources = [correctRelPath];
|
|
201
|
+
await import_node_fs.default.promises.writeFile(mapFile, JSON.stringify(map), "utf8");
|
|
202
|
+
} catch {
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
);
|
|
206
|
+
}
|
|
162
207
|
function getEsbuildOptions(files) {
|
|
163
208
|
const cedarPaths = (0, import_project_config.getPaths)();
|
|
164
209
|
const format = (0, import_project_config.projectSideIsEsm)("api") ? "esm" : "cjs";
|
|
@@ -183,5 +228,6 @@ function getEsbuildOptions(files) {
|
|
|
183
228
|
buildApi,
|
|
184
229
|
buildApiWithVite,
|
|
185
230
|
cleanApiBuild,
|
|
231
|
+
fixSourceMaps,
|
|
186
232
|
rebuildApi
|
|
187
233
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/internal",
|
|
3
|
-
"version": "5.0.0-canary.
|
|
3
|
+
"version": "5.0.0-canary.2563",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -159,13 +159,13 @@
|
|
|
159
159
|
"@babel/plugin-transform-react-jsx": "7.29.7",
|
|
160
160
|
"@babel/plugin-transform-typescript": "^7.26.8",
|
|
161
161
|
"@babel/traverse": "7.29.7",
|
|
162
|
-
"@cedarjs/babel-config": "5.0.0-canary.
|
|
163
|
-
"@cedarjs/cli-helpers": "5.0.0-canary.
|
|
164
|
-
"@cedarjs/graphql-server": "5.0.0-canary.
|
|
165
|
-
"@cedarjs/project-config": "5.0.0-canary.
|
|
166
|
-
"@cedarjs/router": "5.0.0-canary.
|
|
167
|
-
"@cedarjs/structure": "5.0.0-canary.
|
|
168
|
-
"@cedarjs/utils": "5.0.0-canary.
|
|
162
|
+
"@cedarjs/babel-config": "5.0.0-canary.2563",
|
|
163
|
+
"@cedarjs/cli-helpers": "5.0.0-canary.2563",
|
|
164
|
+
"@cedarjs/graphql-server": "5.0.0-canary.2563",
|
|
165
|
+
"@cedarjs/project-config": "5.0.0-canary.2563",
|
|
166
|
+
"@cedarjs/router": "5.0.0-canary.2563",
|
|
167
|
+
"@cedarjs/structure": "5.0.0-canary.2563",
|
|
168
|
+
"@cedarjs/utils": "5.0.0-canary.2563",
|
|
169
169
|
"@graphql-codegen/add": "6.0.1",
|
|
170
170
|
"@graphql-codegen/cli": "6.3.1",
|
|
171
171
|
"@graphql-codegen/client-preset": "5.3.0",
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
},
|
|
207
207
|
"devDependencies": {
|
|
208
208
|
"@arethetypeswrong/cli": "0.18.3",
|
|
209
|
-
"@cedarjs/framework-tools": "5.0.0-canary.
|
|
209
|
+
"@cedarjs/framework-tools": "5.0.0-canary.2563",
|
|
210
210
|
"concurrently": "9.2.1",
|
|
211
211
|
"graphql-tag": "2.12.6",
|
|
212
212
|
"publint": "0.3.21",
|