@netlify/dev-utils
Advanced tools
Comparing version
@@ -157,2 +157,9 @@ import { FSWatcher } from 'chokidar'; | ||
withFile(path: string, contents: string): this; | ||
withHeadersFile({ headers, pathPrefix, }: { | ||
headers?: { | ||
headers: string[]; | ||
path: string; | ||
}[]; | ||
pathPrefix?: string; | ||
}): this; | ||
withStateFile(state: object): this; | ||
@@ -163,2 +170,4 @@ writeFile(path: string, contents: string): Promise<void>; | ||
export { type DevEvent, type DevEventHandler, EventInspector, Fixture, HTTPServer, type Handler, LocalState, type Logger, type MemoizeCache, MockFetch, ensureNetlifyIgnore, getAPIToken, globalConfig, headers, memoize, shouldBase64Encode, toMultiValueHeaders, watchDebounced }; | ||
declare const createMockLogger: () => Logger; | ||
export { type DevEvent, type DevEventHandler, EventInspector, Fixture, HTTPServer, type Handler, LocalState, type Logger, type MemoizeCache, MockFetch, createMockLogger, ensureNetlifyIgnore, getAPIToken, globalConfig, headers, memoize, shouldBase64Encode, toMultiValueHeaders, watchDebounced }; |
@@ -14,5 +14,5 @@ var __defProp = Object.defineProperty; | ||
}); | ||
import fs from "node:fs/promises"; | ||
import fss from "node:fs"; | ||
import path2 from "node:path"; | ||
import fs from "fs/promises"; | ||
import fss from "fs"; | ||
import path2 from "path"; | ||
import * as dot from "dot-prop"; | ||
@@ -304,3 +304,3 @@ import { v4 as uuidv4 } from "uuid"; | ||
// src/server/http_server.ts | ||
import http from "node:http"; | ||
import http from "http"; | ||
import { createServerAdapter } from "@whatwg-node/server"; | ||
@@ -344,3 +344,3 @@ var HTTPServer = class { | ||
// src/lib/watch-debounced.ts | ||
import { once } from "node:events"; | ||
import { once } from "events"; | ||
import chokidar from "chokidar"; | ||
@@ -392,3 +392,3 @@ import decache from "decache"; | ||
// src/test/event_inspector.ts | ||
import { EventEmitter } from "node:events"; | ||
import { EventEmitter } from "events"; | ||
var DEFAULT_TIMEOUT = 5e3; | ||
@@ -425,4 +425,4 @@ var EventInspector = class extends EventEmitter { | ||
// src/test/fetch.ts | ||
import assert from "node:assert"; | ||
import { Readable } from "node:stream"; | ||
import assert from "assert"; | ||
import { Readable } from "stream"; | ||
var MockFetch = class { | ||
@@ -532,6 +532,7 @@ originalFetch; | ||
// src/test/fixture.ts | ||
import { exec } from "node:child_process"; | ||
import { promises as fs3 } from "node:fs"; | ||
import { dirname, join } from "node:path"; | ||
import { promisify } from "node:util"; | ||
import { exec } from "child_process"; | ||
import { promises as fs3 } from "fs"; | ||
import { EOL } from "os"; | ||
import { dirname, join } from "path"; | ||
import { promisify } from "util"; | ||
import tmp from "tmp-promise"; | ||
@@ -599,2 +600,12 @@ var run = promisify(exec); | ||
} | ||
withHeadersFile({ | ||
headers: headers2 = [], | ||
pathPrefix = "" | ||
}) { | ||
const dest = join(pathPrefix, "_headers"); | ||
const contents = headers2.map( | ||
({ headers: headersValues, path: headerPath }) => `${headerPath}${EOL}${headersValues.map((header) => ` ${header}`).join(EOL)}` | ||
).join(EOL); | ||
return this.withFile(dest, contents); | ||
} | ||
withStateFile(state) { | ||
@@ -613,2 +624,12 @@ this.files[".netlify/state.json"] = JSON.stringify(state); | ||
}; | ||
// src/test/logger.ts | ||
var createMockLogger = () => ({ | ||
log: () => { | ||
}, | ||
warn: () => { | ||
}, | ||
error: () => { | ||
} | ||
}); | ||
export { | ||
@@ -620,2 +641,3 @@ EventInspector, | ||
MockFetch, | ||
createMockLogger, | ||
ensureNetlifyIgnore, | ||
@@ -622,0 +644,0 @@ getAPIToken, |
{ | ||
"name": "@netlify/dev-utils", | ||
"version": "2.2.0", | ||
"version": "3.0.0", | ||
"description": "TypeScript utilities for the local emulation of the Netlify environment", | ||
"type": "module", | ||
"engines": { | ||
"node": "^14.16.0 || >=16.0.0" | ||
"node": "^18.14.0 || >=20" | ||
}, | ||
@@ -59,3 +59,3 @@ "main": "./dist/main.cjs", | ||
"dependencies": { | ||
"@whatwg-node/server": "^0.9.60", | ||
"@whatwg-node/server": "^0.10.0", | ||
"chokidar": "^4.0.1", | ||
@@ -67,3 +67,2 @@ "decache": "^4.6.2", | ||
"lodash.debounce": "^4.0.8", | ||
"netlify": "^13.3.5", | ||
"parse-gitignore": "^2.0.0", | ||
@@ -70,0 +69,0 @@ "uuid": "^11.1.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
52600
3.07%10
-9.09%1450
3.72%13
30%4
100%+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated