@patchstack/connect 0.5.24 → 0.5.26
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/AGENT-INSTALL.md +117 -9
- package/README.md +30 -0
- package/dist/cli.js +522 -153
- package/dist/cli.js.map +1 -1
- package/dist/protect/templates/next-guard.ts +54 -0
- package/dist/protect.cjs +11 -3
- package/dist/protect.cjs.map +1 -1
- package/dist/protect.edge.js +12 -4
- package/dist/protect.edge.js.map +1 -1
- package/dist/protect.js +11 -3
- package/dist/protect.js.map +1 -1
- package/package.json +9 -1
package/dist/protect.js
CHANGED
|
@@ -7082,7 +7082,7 @@ async function createProtection(options = {}) {
|
|
|
7082
7082
|
allowHosts
|
|
7083
7083
|
});
|
|
7084
7084
|
}
|
|
7085
|
-
const cwd = options
|
|
7085
|
+
const cwd = workingDirectory(options);
|
|
7086
7086
|
const live = Boolean(options.siteUuid || options.token);
|
|
7087
7087
|
const refreshSecret = options.refreshSecret ?? (typeof process !== "undefined" ? process.env.PATCHSTACK_REFRESH_SECRET : void 0);
|
|
7088
7088
|
const refreshable = live && (options.refreshMs > 0 || Boolean(refreshSecret));
|
|
@@ -7176,8 +7176,17 @@ function resolveMode(options, bundle) {
|
|
|
7176
7176
|
return "dry-run";
|
|
7177
7177
|
}
|
|
7178
7178
|
var CREDENTIAL_FILES = [".patchstackrc.local.json", ".patchstackrc.json"];
|
|
7179
|
+
function workingDirectory(options) {
|
|
7180
|
+
if (options?.cwd !== void 0) return options.cwd;
|
|
7181
|
+
try {
|
|
7182
|
+
return typeof process !== "undefined" && typeof process.cwd === "function" ? process.cwd() : void 0;
|
|
7183
|
+
} catch {
|
|
7184
|
+
return void 0;
|
|
7185
|
+
}
|
|
7186
|
+
}
|
|
7179
7187
|
async function readCredentialField(options, field) {
|
|
7180
|
-
|
|
7188
|
+
const cwd = workingDirectory(options);
|
|
7189
|
+
if (!cwd) return void 0;
|
|
7181
7190
|
let readFileSync;
|
|
7182
7191
|
let join;
|
|
7183
7192
|
try {
|
|
@@ -7187,7 +7196,6 @@ async function readCredentialField(options, field) {
|
|
|
7187
7196
|
} catch {
|
|
7188
7197
|
return void 0;
|
|
7189
7198
|
}
|
|
7190
|
-
const cwd = options?.cwd ?? process.cwd();
|
|
7191
7199
|
for (const filename of CREDENTIAL_FILES) {
|
|
7192
7200
|
try {
|
|
7193
7201
|
const value = JSON.parse(readFileSync(join(cwd, filename), "utf8"))?.[field];
|