This commit is contained in:
Luca Casonato 2021-11-09 14:53:18 +01:00 committed by GitHub
parent 792e9a037e
commit 9d6d654a6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 87 additions and 25 deletions

View File

@ -1,3 +1,44 @@
### 0.114.0 / 2021.11.09
- BREAKING(http): update `serve`, add `serveListener`, deprecate
`listenAndServe` (#1506)
- BREAKING(std/collections): deprecate findLast (#1532)
- feat(http/file_server): add streaming support, fix empty file handling (#1479)
- feat(node): add readline module (#1453)
- feat(node): process.on and process.off for signals (#1466)
- feat(node/_fs): Add watchFile function (#1483)
- feat(node/http): HTTP Server/Response improvements (#1448)
- feat(node/querystring): implement qs.unescapeBuffer (#1516)
- feat(node): mock 'vm' module (#1501)
- feat(node): os.cpus() (#1500)
- feat(node): process.execArgv (#1499)
- fix(collections): prevent calling `Object.prototype.__proto__` in
collections/deep_merge.ts (#1504)
- fix(collections): remove default selector for `findSingle` (#1232)
- fix(crypto/digest): always return the underlying ArrayBuffer (#1515)
- fix(http/file_server): don't require --allow-read for showing help message
(#1521)
- fix(node): //@ts-ignore Error.captureStackTrace (#1533)
- fix(node): add proper module.export for 'module' (#1497)
- fix(node): child_process stdio for binary data (#1477)
- fix(node): fix flaky downloadFile test (#1460)
- fix(node): fix process.arch (#1498)
- fix(node): fix string representation of node errors (#1470)
- fix(node): isAlreadyClosed for child_process (#1469)
- fix(node/_tools): Better error and output logging (#1492)
- fix(node/_util): Deno.permissions is no longer called unless it exists.
(#1520)
- fix(node/events): enable remaining tests for EventEmitter (#1489)
- fix(node/events): make EventEmitter's public methods enumerable (#1530)
- fix(node/process): warn on not implemented event instead of throw (#1510)
- fix(node/querystring): improve `querystring.parse` (#1473)
- fix(node/querystring): Improve querystring.stringify (#1488)
- fix(node/querystring/stringify): invalid surrogate pair throws URIError
(#1505)
- fix(node/querystring/stringify): Remove initialValue (#1494)
- fix(signal): update signal module for canary API change (#1468)
- fix(testing): show special characters in assertEquals results (#1450)
### 0.113.0 / 2021.10.25
- feat(collections/running_reduce): support `currentIndex` (#1431)

View File

@ -175,7 +175,10 @@ function isNonNullObject(value: unknown): value is NonNullable<object> {
function getKeys<T extends object>(record: T): Array<keyof T> {
const ret = Object.getOwnPropertySymbols(record) as Array<keyof T>;
filterInPlace(ret, (key) => record.propertyIsEnumerable(key));
filterInPlace(
ret,
(key) => Object.prototype.propertyIsEnumerable.call(record, key),
);
ret.push(...(Object.keys(record) as Array<keyof T>));
return ret;

View File

@ -301,7 +301,7 @@ Deno.test("serveWithUnorthodoxFilename", async function () {
assert(res.headers.has("access-control-allow-origin"));
assert(res.headers.has("access-control-allow-headers"));
assertEquals(res.status, 200);
let _ = await res.text();
const _ = await res.text();
res = await fetch("http://localhost:4507/testdata/test%20file.txt");
assert(res.headers.has("access-control-allow-origin"));
assert(res.headers.has("access-control-allow-headers"));

View File

@ -2449,10 +2449,10 @@ export class ERR_INVALID_MODULE_SPECIFIER extends NodeTypeError {
}
export class ERR_INVALID_PACKAGE_TARGET extends NodeError {
// deno-lint-ignore no-explicit-any
constructor(
pkgPath: string,
key: string,
// deno-lint-ignore no-explicit-any
target: any,
isImport?: boolean,
base?: string,

View File

@ -1,3 +1,4 @@
// deno-lint-ignore-file
import foo from "./foo.js";
console.log(require);

View File

@ -61,7 +61,7 @@ for await (const file of dir) {
]);
test.close();
let stderr = decoder.decode(rawStderr);
const stderr = decoder.decode(rawStderr);
if (rawStderr.length) console.error(stderr);
if (rawOutput.length) console.log(decoder.decode(rawOutput));

View File

@ -181,7 +181,9 @@ export class EventEmitter {
try {
err = inspect(err);
} catch {}
} catch {
// pass
}
throw new ERR_UNHANDLED_ERROR(err);
}
return false;

View File

@ -1,4 +1,5 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore-file no-var
import processModule from "./process.ts";
import { Buffer as bufferModule } from "./buffer.ts";
import timers from "./timers.ts";

View File

@ -1371,7 +1371,7 @@ export function resolveMainPath(main: string): undefined | string {
// Note extension resolution for the main entry point can be deprecated in a
// future major.
// Module._findPath is monkey-patchable here.
let mainPath = Module._findPath(path.resolve(main), [], true);
const mainPath = Module._findPath(path.resolve(main), [], true);
if (!mainPath) {
return;
}

View File

@ -58,9 +58,9 @@ function throwInvalidSubpath(
);
}
// deno-lint-ignore no-explicit-any
function throwInvalidPackageTarget(
subpath: string,
// deno-lint-ignore no-explicit-any
target: any,
packageJSONUrl: string,
internal: boolean,
@ -155,31 +155,37 @@ function legacyMainResolve(
} else if (
fileExists(guess = new URL(`./${packageConfig.main}.js`, packageJSONUrl))
) {
// pass
} else if (
fileExists(
guess = new URL(`./${packageConfig.main}.json`, packageJSONUrl),
)
) {
// pass
} else if (
fileExists(
guess = new URL(`./${packageConfig.main}.node`, packageJSONUrl),
)
) {
// pass
} else if (
fileExists(
guess = new URL(`./${packageConfig.main}/index.js`, packageJSONUrl),
)
) {
// pass
} else if (
fileExists(
guess = new URL(`./${packageConfig.main}/index.json`, packageJSONUrl),
)
) {
// pass
} else if (
fileExists(
guess = new URL(`./${packageConfig.main}/index.node`, packageJSONUrl),
)
) {
// pass
} else guess = undefined;
if (guess) {
// TODO(bartlomieju):
@ -189,11 +195,14 @@ function legacyMainResolve(
}
// Fallthrough.
}
if (fileExists(guess = new URL("./index.js", packageJSONUrl))) {}
// So fs.
else if (fileExists(guess = new URL("./index.json", packageJSONUrl))) {}
else if (fileExists(guess = new URL("./index.node", packageJSONUrl))) {}
else guess = undefined;
if (fileExists(guess = new URL("./index.js", packageJSONUrl))) {
// pass
} // So fs.
else if (fileExists(guess = new URL("./index.json", packageJSONUrl))) {
// pass
} else if (fileExists(guess = new URL("./index.node", packageJSONUrl))) {
// pass
} else guess = undefined;
if (guess) {
// TODO(bartlomieju):
// emitLegacyIndexDeprecation(guess, packageJSONUrl, base, packageConfig.main);
@ -316,6 +325,8 @@ function packageResolve(
// Cross-platform root check.
} while (packageJSONPath.length !== lastPath.length);
// TODO(bartlomieju): this is false positive
// deno-lint-ignore no-unreachable
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base));
}
@ -345,7 +356,9 @@ function resolvePackageTargetString(
try {
new URL(target);
isURL = true;
} catch {}
} catch {
// pass
}
if (!isURL) {
const exportTarget = pattern
? target.replace(patternRegEx, () => subpath)
@ -389,9 +402,9 @@ function isArrayIndex(key: string): boolean {
return keyNum >= 0 && keyNum < 0xFFFF_FFFF;
}
// deno-lint-ignore no-explicit-any
function resolvePackageTarget(
packageJSONUrl: string,
// deno-lint-ignore no-explicit-any
target: any,
subpath: string,
packageSubpath: string,
@ -502,7 +515,7 @@ export function packageExportsResolve(
packageConfig: PackageConfig,
base: string,
conditions: Set<string>,
// @ts-ignore
// @ts-ignore `URL` needs to be forced due to control flow
): URL {
let exports = packageConfig.exports;
if (isConditionalExportsMainSugar(exports, packageJSONUrl, base)) {
@ -601,7 +614,6 @@ export interface PackageConfig {
exports?: any;
// deno-lint-ignore no-explicit-any
imports?: any;
// deno-lint-ignore no-explicit-any
type?: string;
}
@ -647,7 +659,7 @@ function getPackageConfig(
throw new ERR_INVALID_PACKAGE_CONFIG(
path,
(base ? `"${specifier}" from ` : "") + fileURLToPath(base || specifier),
// @ts-ignore
// @ts-ignore there's no assertion for type and `error` is thus `unknown`
error.message,
);
}
@ -711,7 +723,7 @@ export function packageImportsResolve(
name: string,
base: string,
conditions: Set<string>,
// @ts-ignore
// @ts-ignore `URL` needs to be forced due to control flow
): URL {
if (
name === "#" || name.startsWith("#/") ||
@ -794,8 +806,8 @@ export function packageImportsResolve(
throwImportNotDefined(name, packageJSONUrl, base);
}
// deno-lint-ignore no-explicit-any
function isConditionalExportsMainSugar(
// deno-lint-ignore no-explicit-any
exports: any,
packageJSONUrl: string,
base: string,

View File

@ -383,11 +383,12 @@ class Process extends EventEmitter {
nextTick = nextTick;
/** https://nodejs.org/api/process.html#process_process_events */
//deno-lint-ignore ban-types
on(event: "exit", listener: (code: number) => void): this;
// deno-lint-ignore no-explicit-any
on(event: string, listener: (...args: any[]) => void): this;
// deno-lint-ignore ban-types
on(event: typeof notImplementedEvents[number], listener: Function): this;
//deno-lint-ignore no-explicit-any
// deno-lint-ignore no-explicit-any
on(event: string, listener: (...args: any[]) => void): this {
if (notImplementedEvents.includes(event)) {
warnNotImplemented(`process.on("${event}")`);
@ -400,11 +401,12 @@ class Process extends EventEmitter {
return this;
}
//deno-lint-ignore ban-types
off(event: "exit", listener: (code: number) => void): this;
// deno-lint-ignore no-explicit-any
off(event: string, listener: (...args: any[]) => void): this;
// deno-lint-ignore ban-types
off(event: typeof notImplementedEvents[number], listener: Function): this;
//deno-lint-ignore no-explicit-any
// deno-lint-ignore no-explicit-any
off(event: string, listener: (...args: any[]) => void): this {
if (notImplementedEvents.includes(event)) {
warnNotImplemented(`process.off("${event}")`);

View File

@ -1,6 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore no-explicit-any
// deno-lint-ignore-file no-explicit-any
import { notImplemented } from "./_utils.ts";

View File

@ -5,4 +5,4 @@
* the cli's API is stable. In the future when std becomes stable, likely we
* will match versions with cli as we have in the past.
*/
export const VERSION = "0.113.0";
export const VERSION = "0.114.0";