securenow 7.6.0 → 7.6.1
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/SKILL-API.md +8 -12
- package/cli/init.js +5 -8
- package/cli.js +1 -1
- package/docs/NEXTJS-QUICKSTART.md +4 -6
- package/nextjs.js +2 -1
- package/package.json +1 -1
package/SKILL-API.md
CHANGED
|
@@ -151,15 +151,13 @@ For Next.js < 15, add `securenow` to `experimental.serverComponentsExternalPacka
|
|
|
151
151
|
**2. `instrumentation.ts`** (or `.js`, can be in `src/`):
|
|
152
152
|
|
|
153
153
|
```typescript
|
|
154
|
-
import { createRequire } from 'node:module';
|
|
155
|
-
|
|
156
|
-
const require = createRequire(import.meta.url);
|
|
157
|
-
|
|
158
154
|
export async function register() {
|
|
159
155
|
if (process.env.NEXT_RUNTIME !== 'nodejs') return;
|
|
160
|
-
|
|
156
|
+
|
|
157
|
+
const securenowNext = await import(/* webpackIgnore: true */ 'securenow/nextjs');
|
|
158
|
+
const registerSecureNow = securenowNext.registerSecureNow || securenowNext.default?.registerSecureNow;
|
|
161
159
|
registerSecureNow({ captureBody: true });
|
|
162
|
-
|
|
160
|
+
await import(/* webpackIgnore: true */ 'securenow/nextjs-auto-capture');
|
|
163
161
|
}
|
|
164
162
|
```
|
|
165
163
|
|
|
@@ -202,15 +200,13 @@ Local development and production do not need `.env.local`; `npx securenow login`
|
|
|
202
200
|
Add to your `instrumentation.ts`:
|
|
203
201
|
|
|
204
202
|
```typescript
|
|
205
|
-
import { createRequire } from 'node:module';
|
|
206
|
-
|
|
207
|
-
const require = createRequire(import.meta.url);
|
|
208
|
-
|
|
209
203
|
export async function register() {
|
|
210
204
|
if (process.env.NEXT_RUNTIME !== 'nodejs') return;
|
|
211
|
-
|
|
205
|
+
|
|
206
|
+
const securenowNext = await import(/* webpackIgnore: true */ 'securenow/nextjs');
|
|
207
|
+
const registerSecureNow = securenowNext.registerSecureNow || securenowNext.default?.registerSecureNow;
|
|
212
208
|
registerSecureNow({ captureBody: true });
|
|
213
|
-
|
|
209
|
+
await import(/* webpackIgnore: true */ 'securenow/nextjs-auto-capture');
|
|
214
210
|
}
|
|
215
211
|
```
|
|
216
212
|
|
package/cli/init.js
CHANGED
|
@@ -5,16 +5,13 @@ const path = require('path');
|
|
|
5
5
|
const ui = require('./ui');
|
|
6
6
|
const config = require('./config');
|
|
7
7
|
|
|
8
|
-
const INSTRUMENTATION = `
|
|
9
|
-
|
|
10
|
-
const require = createRequire(import.meta.url);
|
|
11
|
-
|
|
12
|
-
export async function register() {
|
|
8
|
+
const INSTRUMENTATION = `export async function register() {
|
|
13
9
|
if (process.env.NEXT_RUNTIME !== 'nodejs') return;
|
|
14
10
|
|
|
15
|
-
const
|
|
11
|
+
const securenowNext = await import(/* webpackIgnore: true */ 'securenow/nextjs');
|
|
12
|
+
const registerSecureNow = securenowNext.registerSecureNow || securenowNext.default?.registerSecureNow;
|
|
16
13
|
registerSecureNow({ captureBody: true });
|
|
17
|
-
|
|
14
|
+
await import(/* webpackIgnore: true */ 'securenow/nextjs-auto-capture');
|
|
18
15
|
}
|
|
19
16
|
`;
|
|
20
17
|
|
|
@@ -190,7 +187,7 @@ function printAgentPrompt(kind, filename, major) {
|
|
|
190
187
|
'Set up SecureNow in this existing Next.js project without using .env files.',
|
|
191
188
|
'Use .securenow/credentials.json for local and production configuration; do not add .env files.',
|
|
192
189
|
kind === 'instrumentation'
|
|
193
|
-
? `Merge this into ${filename}: in register(), return unless process.env.NEXT_RUNTIME === "nodejs";
|
|
190
|
+
? `Merge this into ${filename}: in register(), return unless process.env.NEXT_RUNTIME === "nodejs"; then dynamically import "securenow/nextjs" and "securenow/nextjs-auto-capture" with /* webpackIgnore: true */ so Next does not bundle OpenTelemetry internals. Preserve all existing instrumentation.`
|
|
194
191
|
: null,
|
|
195
192
|
kind === 'next-config' && major >= 15
|
|
196
193
|
? `Update ${filename} while preserving existing config: add securenow to serverExternalPackages, e.g. serverExternalPackages: [...(existing || []), "securenow"].`
|
package/cli.js
CHANGED
|
@@ -25,15 +25,13 @@ No `.env.local` edits. No API key copy-paste. The app you picked in step 2 is wh
|
|
|
25
25
|
**`instrumentation.ts`** (or `.js`, auto-detected):
|
|
26
26
|
|
|
27
27
|
```typescript
|
|
28
|
-
import { createRequire } from 'node:module';
|
|
29
|
-
|
|
30
|
-
const require = createRequire(import.meta.url);
|
|
31
|
-
|
|
32
28
|
export async function register() {
|
|
33
29
|
if (process.env.NEXT_RUNTIME !== 'nodejs') return;
|
|
34
|
-
|
|
30
|
+
|
|
31
|
+
const securenowNext = await import(/* webpackIgnore: true */ 'securenow/nextjs');
|
|
32
|
+
const registerSecureNow = securenowNext.registerSecureNow || securenowNext.default?.registerSecureNow;
|
|
35
33
|
registerSecureNow({ captureBody: true });
|
|
36
|
-
|
|
34
|
+
await import(/* webpackIgnore: true */ 'securenow/nextjs-auto-capture');
|
|
37
35
|
}
|
|
38
36
|
```
|
|
39
37
|
|
package/nextjs.js
CHANGED
|
@@ -131,6 +131,7 @@ function registerSecureNow(options = {}) {
|
|
|
131
131
|
|
|
132
132
|
// Detect environment outside try block for error handling
|
|
133
133
|
const isVercel = !!(env('VERCEL') || env('VERCEL_ENV') || env('VERCEL_URL'));
|
|
134
|
+
let deploymentEnvironment = appConfig.resolveDeploymentEnvironment();
|
|
134
135
|
|
|
135
136
|
try {
|
|
136
137
|
console.log('[securenow] Next.js integration loading (pid=%d)', process.pid);
|
|
@@ -145,7 +146,7 @@ function registerSecureNow(options = {}) {
|
|
|
145
146
|
// and the dashboard does exact match). opts.noUuid or SECURENOW_NO_UUID
|
|
146
147
|
// override.
|
|
147
148
|
const noUuid = appConfig.resolveNoUuid({ noUuid: options.noUuid });
|
|
148
|
-
|
|
149
|
+
deploymentEnvironment = appConfig.normalizeDeploymentEnvironment(
|
|
149
150
|
options.environment || resolvedApp.deploymentEnvironment || env('VERCEL_ENV')
|
|
150
151
|
);
|
|
151
152
|
|
package/package.json
CHANGED