@vercel/cervel 0.0.2 → 0.0.4

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/bin/cervel.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { main } from '../dist/cli.js';
2
+ import { main } from '../dist/cli.mjs';
3
3
 
4
4
  await main();
@@ -170,16 +170,6 @@ const rolldown = async (args) => {
170
170
  for (const dependency of Object.keys(pkg.peerDependencies || {})) external.push(dependency);
171
171
  for (const dependency of Object.keys(pkg.optionalDependencies || {})) external.push(dependency);
172
172
  }
173
- const absoluteImportPlugin = {
174
- name: "absolute-import-resolver",
175
- resolveId(source) {
176
- if (external.includes(source)) return {
177
- id: source,
178
- external: true
179
- };
180
- return null;
181
- }
182
- };
183
173
  const tsconfig = await findNearestTsconfig(baseDir);
184
174
  const relativeOutputDir = args.out;
185
175
  const outputDir = join(baseDir, relativeOutputDir);
@@ -188,8 +178,12 @@ const rolldown = async (args) => {
188
178
  input: entrypointPath,
189
179
  cwd: baseDir,
190
180
  platform: "node",
191
- external: /node_modules/,
192
- plugins: [absoluteImportPlugin],
181
+ external: (source) => {
182
+ if (source.startsWith(".") || source.startsWith("/")) return false;
183
+ return external.some((pkg$1) => {
184
+ return source === pkg$1 || source.startsWith(pkg$1 + "/");
185
+ });
186
+ },
193
187
  tsconfig,
194
188
  output: {
195
189
  dir: outputDir,
@@ -289,6 +283,11 @@ const findEntrypoint = async (cwd, options) => {
289
283
  const require = createRequire(import.meta.url);
290
284
  const build$1 = async (args) => {
291
285
  const entrypoint = args.entrypoint || await findEntrypoint(args.cwd);
286
+ const tsPromise = typescript({
287
+ ...args,
288
+ entrypoint,
289
+ workPath: args.cwd
290
+ });
292
291
  const rolldownResult = await rolldown({
293
292
  ...args,
294
293
  entrypoint,
@@ -297,12 +296,9 @@ const build$1 = async (args) => {
297
296
  out: args.out
298
297
  });
299
298
  await writeFile(join(args.cwd, args.out, ".cervel.json"), JSON.stringify({ handler: rolldownResult.result.handler }, null, 2));
300
- const tsPromise = typescript({
301
- ...args,
302
- entrypoint,
303
- workPath: args.cwd
304
- });
305
299
  console.log(Colors.gray(`${Colors.bold(Colors.cyan("✓"))} Build complete`));
300
+ const typecheckComplete = true;
301
+ if (!await Promise.race([tsPromise.then(() => typecheckComplete), Promise.resolve(false)])) console.log(Colors.gray(`${Colors.bold(Colors.gray("*"))} Waiting for typecheck...`));
306
302
  return {
307
303
  rolldownResult: rolldownResult.result,
308
304
  tsPromise
@@ -169,16 +169,6 @@ const rolldown = async (args) => {
169
169
  for (const dependency of Object.keys(pkg.peerDependencies || {})) external.push(dependency);
170
170
  for (const dependency of Object.keys(pkg.optionalDependencies || {})) external.push(dependency);
171
171
  }
172
- const absoluteImportPlugin = {
173
- name: "absolute-import-resolver",
174
- resolveId(source) {
175
- if (external.includes(source)) return {
176
- id: source,
177
- external: true
178
- };
179
- return null;
180
- }
181
- };
182
172
  const tsconfig = await findNearestTsconfig(baseDir);
183
173
  const relativeOutputDir = args.out;
184
174
  const outputDir = join(baseDir, relativeOutputDir);
@@ -187,8 +177,12 @@ const rolldown = async (args) => {
187
177
  input: entrypointPath,
188
178
  cwd: baseDir,
189
179
  platform: "node",
190
- external: /node_modules/,
191
- plugins: [absoluteImportPlugin],
180
+ external: (source) => {
181
+ if (source.startsWith(".") || source.startsWith("/")) return false;
182
+ return external.some((pkg$1) => {
183
+ return source === pkg$1 || source.startsWith(pkg$1 + "/");
184
+ });
185
+ },
192
186
  tsconfig,
193
187
  output: {
194
188
  dir: outputDir,
@@ -292,6 +286,11 @@ const getBuildSummary = async (outputDir) => {
292
286
  };
293
287
  const build = async (args) => {
294
288
  const entrypoint = args.entrypoint || await findEntrypoint(args.cwd);
289
+ const tsPromise = typescript({
290
+ ...args,
291
+ entrypoint,
292
+ workPath: args.cwd
293
+ });
295
294
  const rolldownResult = await rolldown({
296
295
  ...args,
297
296
  entrypoint,
@@ -300,12 +299,9 @@ const build = async (args) => {
300
299
  out: args.out
301
300
  });
302
301
  await writeFile(join(args.cwd, args.out, ".cervel.json"), JSON.stringify({ handler: rolldownResult.result.handler }, null, 2));
303
- const tsPromise = typescript({
304
- ...args,
305
- entrypoint,
306
- workPath: args.cwd
307
- });
308
302
  console.log(Colors.gray(`${Colors.bold(Colors.cyan("✓"))} Build complete`));
303
+ const typecheckComplete = true;
304
+ if (!await Promise.race([tsPromise.then(() => typecheckComplete), Promise.resolve(false)])) console.log(Colors.gray(`${Colors.bold(Colors.gray("*"))} Waiting for typecheck...`));
309
305
  return {
310
306
  rolldownResult: rolldownResult.result,
311
307
  tsPromise
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/cervel",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://vercel.com/docs",
6
6
  "publishConfig": {
@@ -14,10 +14,12 @@
14
14
  "sideEffects": false,
15
15
  "type": "module",
16
16
  "exports": {
17
- "./cli": "./dist/cli.js",
18
- ".": "./dist/index.js"
17
+ "./cli": "./dist/cli.mjs",
18
+ ".": {
19
+ "import": "./dist/index.mjs",
20
+ "types": "./dist/index.d.mts"
21
+ }
19
22
  },
20
- "types": "./dist/index.d.ts",
21
23
  "bin": {
22
24
  "cervel": "./bin/cervel.mjs"
23
25
  },
@@ -29,7 +31,6 @@
29
31
  "execa": "3.2.0",
30
32
  "rolldown": "1.0.0-beta.35",
31
33
  "srvx": "0.8.9",
32
- "tsdown": "0.15.6",
33
34
  "tsx": "4.19.2"
34
35
  },
35
36
  "peerDependencies": {
@@ -38,6 +39,7 @@
38
39
  "devDependencies": {
39
40
  "@types/node": "24.7.0",
40
41
  "typescript": "4.9.5",
42
+ "tsdown": "0.16.3",
41
43
  "vitest": "^2.0.1"
42
44
  },
43
45
  "scripts": {
File without changes
File without changes