@payloadcms/figma 0.1.0-alpha.7 → 0.1.0-alpha.9
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/commands/init.js +1 -1
- package/dist/next/image-loader.d.ts +6 -0
- package/dist/next/image-loader.js +14 -0
- package/dist/oauth/components/LoginButton/index.js +66 -19
- package/dist/oauth/components/LoginButton/index.scss +121 -15
- package/dist/plugin/build-config.js +5 -1
- package/dist/plugin/cache-revalidation-hooks.d.ts +6 -0
- package/dist/plugin/cache-revalidation-hooks.js +69 -0
- package/dist/utils/adapters/nextjs.js +4 -3
- package/dist/utils/adapters/nitro.js +46 -25
- package/dist/utils/adapters/vite.js +2 -1
- package/dist/utils/asset-collection.d.ts +1 -1
- package/dist/utils/asset-collection.js +26 -6
- package/dist/utils/build-lambda-zip.js +49 -16
- package/dist/utils/configureNextjsCache.d.ts +7 -0
- package/dist/utils/configureNextjsCache.js +55 -0
- package/dist/utils/fs-utils.d.ts +31 -4
- package/dist/utils/fs-utils.js +95 -15
- package/dist/utils/lambda-config.js +14 -9
- package/dist/utils/lambda-runtime/nextjs-cache.d.ts +22 -0
- package/dist/utils/lambda-runtime/nextjs-cache.js +162 -0
- package/dist/utils/next-image-loader-config.d.ts +2 -0
- package/dist/utils/next-image-loader-config.js +63 -0
- package/dist/utils/next-image-loader-file.d.ts +2 -0
- package/dist/utils/next-image-loader-file.js +11 -0
- package/dist/utils/secret-files.d.ts +25 -0
- package/dist/utils/secret-files.js +50 -0
- package/package.json +6 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True when a forward-slash asset key holds no secret or private-history path
|
|
3
|
+
* segment.
|
|
4
|
+
*
|
|
5
|
+
* A deploy can point `--output` at a directory that also holds those files (a
|
|
6
|
+
* buildless static root, or a framework output folder that copied them in).
|
|
7
|
+
* Every collected asset becomes a publicly reachable route, so `node_modules`
|
|
8
|
+
* is excluded here too.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isPublishableAsset(key: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* True when a forward-slash bundle path belongs in a Lambda zip.
|
|
13
|
+
*
|
|
14
|
+
* A server bundle needs its `node_modules`, but never the project's `.env`
|
|
15
|
+
* files or credentials: a deployed function reads its configuration from
|
|
16
|
+
* deploy environment variables, and a packed secret only widens the blast
|
|
17
|
+
* radius of any later path that serves bundle files. `.env.production` is the
|
|
18
|
+
* deliberate exception, an escape hatch for configuration too large for the
|
|
19
|
+
* Lambda environment-variable limit.
|
|
20
|
+
*
|
|
21
|
+
* Paths inside `node_modules` are kept as-is. A dependency's own dotfiles are
|
|
22
|
+
* not the developer's secrets, and removing files a package may read at
|
|
23
|
+
* runtime would break the bundle.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isBundlableFile(relativePath: string): boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local secrets and private history that must never leave the developer's
|
|
3
|
+
* machine: environment files, git history, and credential files.
|
|
4
|
+
*/ const SECRET_NAMES = new Set([
|
|
5
|
+
'.git',
|
|
6
|
+
'.netrc',
|
|
7
|
+
'.npmrc',
|
|
8
|
+
'.ssh'
|
|
9
|
+
]);
|
|
10
|
+
/** Installed dependencies: private for static hosting, required by a server bundle. */ const DEPENDENCY_DIR = 'node_modules';
|
|
11
|
+
/**
|
|
12
|
+
* The one environment file a Lambda zip may carry. AWS caps a function's
|
|
13
|
+
* environment variables at 4 KB total, so a project with more configuration
|
|
14
|
+
* than that has no way to pass it except inside the bundle. It is still never
|
|
15
|
+
* publishable: `isPublishableAsset` rejects it like any other `.env` file.
|
|
16
|
+
*/ const BUNDLABLE_ENV_FILE = '.env.production';
|
|
17
|
+
/**
|
|
18
|
+
* True when a forward-slash asset key holds no secret or private-history path
|
|
19
|
+
* segment.
|
|
20
|
+
*
|
|
21
|
+
* A deploy can point `--output` at a directory that also holds those files (a
|
|
22
|
+
* buildless static root, or a framework output folder that copied them in).
|
|
23
|
+
* Every collected asset becomes a publicly reachable route, so `node_modules`
|
|
24
|
+
* is excluded here too.
|
|
25
|
+
*/ export function isPublishableAsset(key) {
|
|
26
|
+
return key.split('/').every((segment)=>segment !== DEPENDENCY_DIR && !isSecretName(segment));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* True when a forward-slash bundle path belongs in a Lambda zip.
|
|
30
|
+
*
|
|
31
|
+
* A server bundle needs its `node_modules`, but never the project's `.env`
|
|
32
|
+
* files or credentials: a deployed function reads its configuration from
|
|
33
|
+
* deploy environment variables, and a packed secret only widens the blast
|
|
34
|
+
* radius of any later path that serves bundle files. `.env.production` is the
|
|
35
|
+
* deliberate exception, an escape hatch for configuration too large for the
|
|
36
|
+
* Lambda environment-variable limit.
|
|
37
|
+
*
|
|
38
|
+
* Paths inside `node_modules` are kept as-is. A dependency's own dotfiles are
|
|
39
|
+
* not the developer's secrets, and removing files a package may read at
|
|
40
|
+
* runtime would break the bundle.
|
|
41
|
+
*/ export function isBundlableFile(relativePath) {
|
|
42
|
+
const segments = relativePath.split('/');
|
|
43
|
+
if (segments.includes(DEPENDENCY_DIR)) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
return segments.every((segment)=>segment === BUNDLABLE_ENV_FILE || !isSecretName(segment));
|
|
47
|
+
}
|
|
48
|
+
function isSecretName(segment) {
|
|
49
|
+
return SECRET_NAMES.has(segment) || segment.startsWith('.env');
|
|
50
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/figma",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.9",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
"types": "./dist/exports/client.d.ts",
|
|
15
15
|
"default": "./dist/exports/client.js"
|
|
16
16
|
},
|
|
17
|
+
"./next-image-loader": {
|
|
18
|
+
"import": "./dist/next/image-loader.js",
|
|
19
|
+
"types": "./dist/next/image-loader.d.ts",
|
|
20
|
+
"default": "./dist/next/image-loader.js"
|
|
21
|
+
},
|
|
17
22
|
"./views": {
|
|
18
23
|
"import": "./dist/exports/views.js",
|
|
19
24
|
"types": "./dist/exports/views.d.ts",
|