@vercel/build-utils 15.2.1 → 15.3.0-snapshot-801db9d533c3
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/CHANGELOG.md +23 -0
- package/dist/dockerfile-entrypoint.d.ts +14 -0
- package/dist/dockerfile-entrypoint.js +50 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +5 -5
- package/dist/prerender.d.ts +6 -2
- package/dist/prerender.js +8 -1
- package/dist/static-publish-filter.d.ts +33 -0
- package/dist/static-publish-filter.js +209 -0
- package/dist/types.d.ts +20 -0
- package/package.json +1 -1
- package/dist/daemon-static-publishing.d.ts +0 -10
- package/dist/daemon-static-publishing.js +0 -86
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @vercel/build-utils
|
|
2
2
|
|
|
3
|
+
## 15.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e29c83e: Container services and daemons can build one stage of a multi-stage Dockerfile by naming it after `#` in `entrypoint`, like `Dockerfile#worker` (`docker build --target worker`), so several of them can share one Dockerfile. Command schedules accept the same `entrypoint` form.
|
|
8
|
+
- e9320e2: Accept the keyless `method` rule in `experimentalBypassFor`.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
experimentalBypassFor: [{ type: 'method', value: 'POST' }];
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Like `host`, a `method` rule matches its `value` against the request itself and
|
|
15
|
+
takes no `key`. The proxy already honors it, which lets Next.js replace the
|
|
16
|
+
`next-action` / `content-type` header pair it emits for Server Actions with a
|
|
17
|
+
single method rule. `PrerenderExperimentalBypassFor` extends the existing bypass
|
|
18
|
+
rules with method matching while route `HasField` conditions stay unchanged.
|
|
19
|
+
Method rules must define a `value`; omitted or `undefined` values are rejected.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- a995013: Build Dockerfile command schedules as private container services rooted at the schedule's `root`, using existing schedule triggers and Build Output API targets. The service root is the schedule image's build context. Reject top-level `functions` keys that name a command schedule's Dockerfile, and exclude service files from unused-function matching. Keep command schedule sources out of static output like daemon sources, through a new `servicesContext` build meta field. `createStaticPublishFilter` replaces `createDaemonStaticFileFilter` and reads both fields from `meta`. Reject schedule roots and Dockerfiles that resolve outside the project.
|
|
24
|
+
- a7f771b: Prevent a static service from publishing other services' source files. Static publishing now skips files under the roots of the project's other services, for example a backend at `server/` when a static service publishes `.`, and warns which service roots were skipped. Publishing a directory that is another service's root fails the build with `INVALID_SERVICE_ROOT`, asking to set `outputDirectory`.
|
|
25
|
+
|
|
3
26
|
## 15.2.1
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Split a container entrypoint like `docker/Dockerfile#worker` into the
|
|
3
|
+
* Dockerfile path and the stage to build. Only a `#` in the last path segment
|
|
4
|
+
* starts a stage, so `#` in a directory name stays part of the path.
|
|
5
|
+
* `buildTarget` is `undefined` when the entrypoint names no stage.
|
|
6
|
+
*/
|
|
7
|
+
export declare function splitDockerfileEntrypoint(entrypoint: string): {
|
|
8
|
+
path: string;
|
|
9
|
+
buildTarget?: string;
|
|
10
|
+
};
|
|
11
|
+
/** Whether `stage` is a valid Dockerfile stage name to build. */
|
|
12
|
+
export declare function isValidDockerfileStage(stage: string): boolean;
|
|
13
|
+
/** User-facing rule for a valid stage, to append to error messages. */
|
|
14
|
+
export declare const DOCKERFILE_STAGE_HINT = "A stage after `#` must start with a lowercase letter and contain only lowercase letters, digits, `.`, `_` and `-`, up to 256 characters.";
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
var dockerfile_entrypoint_exports = {};
|
|
20
|
+
__export(dockerfile_entrypoint_exports, {
|
|
21
|
+
DOCKERFILE_STAGE_HINT: () => DOCKERFILE_STAGE_HINT,
|
|
22
|
+
isValidDockerfileStage: () => isValidDockerfileStage,
|
|
23
|
+
splitDockerfileEntrypoint: () => splitDockerfileEntrypoint
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(dockerfile_entrypoint_exports);
|
|
26
|
+
const DOCKERFILE_STAGE_RE = /^[a-z][a-z0-9_.-]{0,255}$/;
|
|
27
|
+
function splitDockerfileEntrypoint(entrypoint) {
|
|
28
|
+
const lastSeparator = Math.max(
|
|
29
|
+
entrypoint.lastIndexOf("/"),
|
|
30
|
+
entrypoint.lastIndexOf("\\")
|
|
31
|
+
);
|
|
32
|
+
const hash = entrypoint.indexOf("#", lastSeparator + 1);
|
|
33
|
+
if (hash === -1) {
|
|
34
|
+
return { path: entrypoint };
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
path: entrypoint.slice(0, hash),
|
|
38
|
+
buildTarget: entrypoint.slice(hash + 1)
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function isValidDockerfileStage(stage) {
|
|
42
|
+
return DOCKERFILE_STAGE_RE.test(stage);
|
|
43
|
+
}
|
|
44
|
+
const DOCKERFILE_STAGE_HINT = "A stage after `#` must start with a lowercase letter and contain only lowercase letters, digits, `.`, `_` and `-`, up to 256 characters.";
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
DOCKERFILE_STAGE_HINT,
|
|
48
|
+
isValidDockerfileStage,
|
|
49
|
+
splitDockerfileEntrypoint
|
|
50
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -23,8 +23,10 @@ import { hardLinkDir } from './hard-link-dir';
|
|
|
23
23
|
import { getNodeExecPath } from './get-node-exec-path';
|
|
24
24
|
import { validateNpmrc } from './validate-npmrc';
|
|
25
25
|
export type { NodejsLambdaOptions, PrerenderInitialMetadata, PrerenderOnMiss };
|
|
26
|
-
export {
|
|
26
|
+
export { createStaticPublishFilter } from './static-publish-filter';
|
|
27
|
+
export type { StaticPublishFilter } from './static-publish-filter';
|
|
27
28
|
export type { LambdaAffinity } from './lambda';
|
|
29
|
+
export type { PrerenderExperimentalBypassFor } from './prerender';
|
|
28
30
|
export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, type DownloadedFiles, getWriteableDirectory, glob, type GlobOptions, rename, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, getNodeBinPaths, getNodeExecPath, getSupportedNodeVersion, isBunVersion, getSupportedBunVersion, getOrCreateBunBinary, detectPackageManager, runNpmInstall, type NpmInstallOutput, type WorkspaceInstallTarget, runBundleInstall, runPipInstall, type PipInstallResult, runShellScript, runCustomInstallCommand, resetCustomInstallCommandSet, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, getServiceUrlEnvVars, getExperimentalServiceUrlEnvVars, streamToBuffer, streamToBufferChunks, debug, isSymbolicLink, isDirectory, isExternalSymlink, isExternalSymlinkTarget, getSymlinkTarget, findMatchingFunction, getLambdaOptionsFromFunction, sanitizeConsumerName, scanParentDirs, findPackageJson, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, type CliType, };
|
|
29
31
|
export { EdgeFunction } from './edge-function';
|
|
30
32
|
export { ContainerImage } from './container-image';
|
|
@@ -54,6 +56,7 @@ export { isNodeEntrypoint } from './node-entrypoint';
|
|
|
54
56
|
export * from './service-path-utils';
|
|
55
57
|
export * from './schedule-path-utils';
|
|
56
58
|
export * from './schedules';
|
|
59
|
+
export * from './dockerfile-entrypoint';
|
|
57
60
|
export { DAEMON_NAME_PATTERN, getDaemonImageRepository, getDaemonNames, type DaemonConfig, type DaemonOutput, type DaemonInstances, type DaemonLivenessProbe, type DaemonReplicas, type DaemonResources, type Daemons, } from './daemons';
|
|
58
61
|
export { streamToDigestAsync, sha256, type FileDigest, } from './fs/stream-to-digest-async';
|
|
59
62
|
export { EMPTY_DISCOVERY, NAVIGATION_ACCEPT_RE, promoteStaticFiles, staticBundleExclusions, staticDirectoryRedirects, staticFallbackRoutes, staticShadowRoutes, type ShadowRoute, type StaticBundleExclusions, type StaticFallback, type StaticDiscovery, type StaticMount, type StaticPromotionOptions, type StaticPromotionResult, } from './static-files';
|