mirror of
https://github.com/denoland/deno.git
synced 2025-01-20 20:42:19 -05:00
Merge branch 'main' into aes-ctr
This commit is contained in:
commit
917e52c882
10 changed files with 289 additions and 21 deletions
|
@ -4509,11 +4509,12 @@ fn op_release(
|
|||
|
||||
#[op2]
|
||||
#[serde]
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn op_resolve(
|
||||
state: &mut OpState,
|
||||
#[string] base: String,
|
||||
#[serde] specifiers: Vec<(bool, String)>,
|
||||
) -> Result<Vec<Option<(String, String)>>, deno_core::url::ParseError> {
|
||||
) -> Result<Vec<Option<(String, Option<String>)>>, deno_core::url::ParseError> {
|
||||
op_resolve_inner(state, ResolveArgs { base, specifiers })
|
||||
}
|
||||
|
||||
|
@ -4595,10 +4596,11 @@ async fn op_poll_requests(
|
|||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn op_resolve_inner(
|
||||
state: &mut OpState,
|
||||
args: ResolveArgs,
|
||||
) -> Result<Vec<Option<(String, String)>>, deno_core::url::ParseError> {
|
||||
) -> Result<Vec<Option<(String, Option<String>)>>, deno_core::url::ParseError> {
|
||||
let state = state.borrow_mut::<State>();
|
||||
let mark = state.performance.mark_with_args("tsc.op.op_resolve", &args);
|
||||
let referrer = state.specifier_map.normalize(&args.base)?;
|
||||
|
@ -4611,7 +4613,11 @@ fn op_resolve_inner(
|
|||
o.map(|(s, mt)| {
|
||||
(
|
||||
state.specifier_map.denormalize(&s),
|
||||
mt.as_ts_extension().to_string(),
|
||||
if matches!(mt, MediaType::Unknown) {
|
||||
None
|
||||
} else {
|
||||
Some(mt.as_ts_extension().to_string())
|
||||
},
|
||||
)
|
||||
})
|
||||
})
|
||||
|
@ -6461,7 +6467,7 @@ mod tests {
|
|||
resolved,
|
||||
vec![Some((
|
||||
temp_dir.url().join("b.ts").unwrap().to_string(),
|
||||
MediaType::TypeScript.as_ts_extension().to_string()
|
||||
Some(MediaType::TypeScript.as_ts_extension().to_string())
|
||||
))]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -723,7 +723,7 @@ delete Object.prototype.__proto__;
|
|||
}
|
||||
: arg;
|
||||
if (fileReference.fileName.startsWith("npm:")) {
|
||||
/** @type {[string, ts.Extension] | undefined} */
|
||||
/** @type {[string, ts.Extension | null] | undefined} */
|
||||
const resolved = ops.op_resolve(
|
||||
containingFilePath,
|
||||
[
|
||||
|
@ -735,7 +735,7 @@ delete Object.prototype.__proto__;
|
|||
],
|
||||
],
|
||||
)?.[0];
|
||||
if (resolved) {
|
||||
if (resolved && resolved[1]) {
|
||||
return {
|
||||
resolvedTypeReferenceDirective: {
|
||||
primary: true,
|
||||
|
@ -785,7 +785,7 @@ delete Object.prototype.__proto__;
|
|||
debug(` base: ${base}`);
|
||||
debug(` specifiers: ${specifiers.map((s) => s[1]).join(", ")}`);
|
||||
}
|
||||
/** @type {Array<[string, ts.Extension] | undefined>} */
|
||||
/** @type {Array<[string, ts.Extension | null] | undefined>} */
|
||||
const resolved = ops.op_resolve(
|
||||
base,
|
||||
specifiers,
|
||||
|
@ -793,7 +793,7 @@ delete Object.prototype.__proto__;
|
|||
if (resolved) {
|
||||
/** @type {Array<ts.ResolvedModuleWithFailedLookupLocations>} */
|
||||
const result = resolved.map((item) => {
|
||||
if (item) {
|
||||
if (item && item[1]) {
|
||||
const [resolvedFileName, extension] = item;
|
||||
return {
|
||||
resolvedModule: {
|
||||
|
|
|
@ -746,7 +746,7 @@ fn op_resolve(
|
|||
state: &mut OpState,
|
||||
#[string] base: String,
|
||||
#[serde] specifiers: Vec<(bool, String)>,
|
||||
) -> Result<Vec<(String, &'static str)>, ResolveError> {
|
||||
) -> Result<Vec<(String, Option<&'static str>)>, ResolveError> {
|
||||
op_resolve_inner(state, ResolveArgs { base, specifiers })
|
||||
}
|
||||
|
||||
|
@ -754,9 +754,9 @@ fn op_resolve(
|
|||
fn op_resolve_inner(
|
||||
state: &mut OpState,
|
||||
args: ResolveArgs,
|
||||
) -> Result<Vec<(String, &'static str)>, ResolveError> {
|
||||
) -> Result<Vec<(String, Option<&'static str>)>, ResolveError> {
|
||||
let state = state.borrow_mut::<State>();
|
||||
let mut resolved: Vec<(String, &'static str)> =
|
||||
let mut resolved: Vec<(String, Option<&'static str>)> =
|
||||
Vec::with_capacity(args.specifiers.len());
|
||||
let referrer = if let Some(remapped_specifier) =
|
||||
state.maybe_remapped_specifier(&args.base)
|
||||
|
@ -770,14 +770,14 @@ fn op_resolve_inner(
|
|||
if specifier.starts_with("node:") {
|
||||
resolved.push((
|
||||
MISSING_DEPENDENCY_SPECIFIER.to_string(),
|
||||
MediaType::Dts.as_ts_extension(),
|
||||
Some(MediaType::Dts.as_ts_extension()),
|
||||
));
|
||||
continue;
|
||||
}
|
||||
|
||||
if specifier.starts_with("asset:///") {
|
||||
let ext = MediaType::from_str(&specifier).as_ts_extension();
|
||||
resolved.push((specifier, ext));
|
||||
resolved.push((specifier, Some(ext)));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -857,14 +857,15 @@ fn op_resolve_inner(
|
|||
(
|
||||
specifier_str,
|
||||
match media_type {
|
||||
MediaType::Css => ".js", // surface these as .js for typescript
|
||||
media_type => media_type.as_ts_extension(),
|
||||
MediaType::Css => Some(".js"), // surface these as .js for typescript
|
||||
MediaType::Unknown => None,
|
||||
media_type => Some(media_type.as_ts_extension()),
|
||||
},
|
||||
)
|
||||
}
|
||||
None => (
|
||||
MISSING_DEPENDENCY_SPECIFIER.to_string(),
|
||||
MediaType::Dts.as_ts_extension(),
|
||||
Some(MediaType::Dts.as_ts_extension()),
|
||||
),
|
||||
};
|
||||
log::debug!("Resolved {} from {} to {:?}", specifier, referrer, result);
|
||||
|
@ -1441,7 +1442,10 @@ mod tests {
|
|||
},
|
||||
)
|
||||
.expect("should have invoked op");
|
||||
assert_eq!(actual, vec![("https://deno.land/x/b.ts".into(), ".ts")]);
|
||||
assert_eq!(
|
||||
actual,
|
||||
vec![("https://deno.land/x/b.ts".into(), Some(".ts"))]
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
@ -1460,7 +1464,10 @@ mod tests {
|
|||
},
|
||||
)
|
||||
.expect("should have not errored");
|
||||
assert_eq!(actual, vec![(MISSING_DEPENDENCY_SPECIFIER.into(), ".d.ts")]);
|
||||
assert_eq!(
|
||||
actual,
|
||||
vec![(MISSING_DEPENDENCY_SPECIFIER.into(), Some(".d.ts"))]
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
|
|
@ -1224,15 +1224,20 @@ export class Socket extends Duplex {
|
|||
|
||||
super(options);
|
||||
|
||||
// Note: If the socket is created from @npmcli/agent, the 'socket' event
|
||||
// on ClientRequest object happens after 'connect' event on Socket object.
|
||||
// Note: If the socket is created from one of:
|
||||
// - @npmcli/agent
|
||||
// - npm-check-updates (bundles @npmcli/agent as a dependency)
|
||||
// the 'socket' event on ClientRequest object happens after 'connect' event on Socket object.
|
||||
// That swaps the sequence of op_node_http_request_with_conn() call and
|
||||
// initial socket read. That causes op_node_http_request_with_conn() not
|
||||
// working.
|
||||
// To avoid the above situation, we detect the socket created from
|
||||
// @npmcli/agent and pause the socket (and also skips the startTls call
|
||||
// if it's TLSSocket)
|
||||
this._isNpmAgent = new Error().stack?.includes("@npmcli/agent") || false;
|
||||
// TODO(kt3k): Remove this workaround
|
||||
const errorStack = new Error().stack;
|
||||
this._isNpmAgent = errorStack?.includes("@npmcli/agent") ||
|
||||
errorStack?.includes("npm-check-updates") || false;
|
||||
if (this._isNpmAgent) {
|
||||
this.pause();
|
||||
}
|
||||
|
|
|
@ -17221,3 +17221,38 @@ fn lsp_wasm_module() {
|
|||
);
|
||||
client.shutdown();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wildcard_augment() {
|
||||
let context = TestContextBuilder::new().use_temp_cwd().build();
|
||||
let mut client = context.new_lsp_command().build();
|
||||
let temp_dir = context.temp_dir().path();
|
||||
let source = source_file(
|
||||
temp_dir.join("index.ts"),
|
||||
r#"
|
||||
import styles from "./hello_world.scss";
|
||||
|
||||
function bar(v: string): string {
|
||||
return v;
|
||||
}
|
||||
|
||||
bar(styles);
|
||||
"#,
|
||||
);
|
||||
temp_dir.join("index.d.ts").write(
|
||||
r#"
|
||||
declare module '*.scss' {
|
||||
const content: string;
|
||||
export default content;
|
||||
}
|
||||
"#,
|
||||
);
|
||||
temp_dir
|
||||
.join("hello_world.scss")
|
||||
.write("body { color: red; }");
|
||||
|
||||
client.initialize_default();
|
||||
|
||||
let diagnostics = client.did_open_file(&source);
|
||||
assert_eq!(diagnostics.all().len(), 0);
|
||||
}
|
||||
|
|
Binary file not shown.
201
tests/registry/npm/npm-check-updates/registry.json
Normal file
201
tests/registry/npm/npm-check-updates/registry.json
Normal file
|
@ -0,0 +1,201 @@
|
|||
{
|
||||
"name": "npm-check-updates",
|
||||
"dist-tags": {
|
||||
"latest": "17.1.13"
|
||||
},
|
||||
"versions": {
|
||||
"17.1.13": {
|
||||
"name": "npm-check-updates",
|
||||
"version": "17.1.13",
|
||||
"author": {
|
||||
"name": "Tomas Junnonen",
|
||||
"email": "tomas1@gmail.com"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"description": "Find newer versions of dependencies than what your package.json allows",
|
||||
"engines": {
|
||||
"node": "^18.18.0 || >=20.0.0",
|
||||
"npm": ">=8.12.1"
|
||||
},
|
||||
"main": "build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "rimraf build && npm run build:options && vite build",
|
||||
"build:options": "vite-node src/scripts/build-options.ts",
|
||||
"build:analyze": "rimraf build && npm run build:options && ANALYZER=true vite build",
|
||||
"lint": "cross-env FORCE_COLOR=1 npm-run-all --parallel --aggregate-output lint:*",
|
||||
"lint:lockfile": "lockfile-lint",
|
||||
"lint:markdown": "markdownlint \"**/*.md\" --ignore \"**/node_modules/**/*.md\" --ignore build --config .markdownlint.js",
|
||||
"lint:src": "eslint --cache --cache-location node_modules/.cache/.eslintcache --ignore-path .gitignore --report-unused-disable-directives .",
|
||||
"prepare": "src/scripts/install-hooks",
|
||||
"prepublishOnly": "npm run build",
|
||||
"prettier": "prettier . --check",
|
||||
"test": "npm run test:unit && npm run test:e2e",
|
||||
"test:bun": "test/bun-install.sh && mocha test/bun",
|
||||
"test:unit": "mocha test test/package-managers/*",
|
||||
"test:e2e": "./test/e2e.sh",
|
||||
"ncu": "node build/cli.js"
|
||||
},
|
||||
"bin": {
|
||||
"npm-check-updates": "build/cli.js",
|
||||
"ncu": "build/cli.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/raineorshine/npm-check-updates.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/raineorshine/npm-check-updates/issues"
|
||||
},
|
||||
"overrides": {
|
||||
"ip": "2.0.1",
|
||||
"jsonparse": "https://github.com/ARitz-Cracker/jsonparse/tree/patch-1",
|
||||
"@yarnpkg/parsers": "2.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
||||
"@types/chai": "^4.3.19",
|
||||
"@types/chai-as-promised": "^8.0.0",
|
||||
"@types/chai-string": "^1.4.5",
|
||||
"@types/cli-table": "^0.3.4",
|
||||
"@types/hosted-git-info": "^3.0.5",
|
||||
"@types/ini": "^4.1.1",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/json-parse-helpfulerror": "^1.0.3",
|
||||
"@types/jsonlines": "^0.1.5",
|
||||
"@types/lodash": "^4.17.10",
|
||||
"@types/mocha": "^10.0.9",
|
||||
"@types/node": "^22.7.5",
|
||||
"@types/npm-registry-fetch": "^8.0.7",
|
||||
"@types/parse-github-url": "^1.0.3",
|
||||
"@types/picomatch": "^3.0.1",
|
||||
"@types/progress": "^2.0.7",
|
||||
"@types/prompts": "^2.4.9",
|
||||
"@types/remote-git-tags": "^4.0.2",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@types/semver-utils": "^1.1.3",
|
||||
"@types/sinon": "^17.0.3",
|
||||
"@types/update-notifier": "^6.0.8",
|
||||
"@typescript-eslint/eslint-plugin": "^8.9.0",
|
||||
"@typescript-eslint/parser": "^8.9.0",
|
||||
"camelcase": "^6.3.0",
|
||||
"chai": "^4.3.10",
|
||||
"chai-as-promised": "^7.1.2",
|
||||
"chai-string": "^1.5.0",
|
||||
"chalk": "^5.3.0",
|
||||
"cli-table3": "^0.6.5",
|
||||
"commander": "^12.1.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"dequal": "^2.0.3",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-config-raine": "^0.5.0",
|
||||
"eslint-config-standard": "^17.1.0",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-plugin-jsdoc": "^50.4.1",
|
||||
"eslint-plugin-n": "^16.6.2",
|
||||
"eslint-plugin-promise": "^6.6.0",
|
||||
"fast-glob": "^3.3.2",
|
||||
"fast-memoize": "^2.5.2",
|
||||
"find-up": "5.0.0",
|
||||
"fp-and-or": "^1.0.2",
|
||||
"hosted-git-info": "^8.0.0",
|
||||
"ini": "^5.0.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"json-parse-helpfulerror": "^1.0.3",
|
||||
"jsonlines": "^0.1.1",
|
||||
"lockfile-lint": "^4.14.0",
|
||||
"lodash": "^4.17.21",
|
||||
"markdownlint-cli": "^0.42.0",
|
||||
"mocha": "^10.7.3",
|
||||
"npm-registry-fetch": "^18.0.2",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"p-map": "^4.0.0",
|
||||
"parse-github-url": "^1.0.3",
|
||||
"picomatch": "^4.0.2",
|
||||
"prettier": "^3.3.3",
|
||||
"progress": "^2.0.3",
|
||||
"prompts-ncu": "^3.0.2",
|
||||
"rc-config-loader": "^4.1.3",
|
||||
"remote-git-tags": "^3.0.0",
|
||||
"rfdc": "^1.4.1",
|
||||
"rimraf": "^6.0.1",
|
||||
"rollup-plugin-node-externals": "^7.1.3",
|
||||
"semver": "^7.6.3",
|
||||
"semver-utils": "^1.1.4",
|
||||
"should": "^13.2.3",
|
||||
"sinon": "^19.0.2",
|
||||
"source-map-support": "^0.5.21",
|
||||
"spawn-please": "^3.0.0",
|
||||
"strip-ansi": "^7.1.0",
|
||||
"strip-json-comments": "^5.0.1",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.6.3",
|
||||
"typescript-json-schema": "^0.65.1",
|
||||
"untildify": "^4.0.0",
|
||||
"update-notifier": "^7.3.1",
|
||||
"verdaccio": "^6.0.1",
|
||||
"vite": "^5.4.9",
|
||||
"vite-bundle-analyzer": "^0.12.1",
|
||||
"vite-node": "^2.1.3",
|
||||
"vite-plugin-dts": "^4.2.4",
|
||||
"yarn": "^1.22.22"
|
||||
},
|
||||
"lockfile-lint": {
|
||||
"allowed-schemes": [
|
||||
"https:",
|
||||
"git+ssh:"
|
||||
],
|
||||
"allowed-hosts": [
|
||||
"npm",
|
||||
"github.com"
|
||||
],
|
||||
"empty-hostname": false,
|
||||
"type": "npm ",
|
||||
"path": "package-lock.json"
|
||||
},
|
||||
"mocha": {
|
||||
"check-leaks": true,
|
||||
"extension": [
|
||||
"test.ts"
|
||||
],
|
||||
"require": [
|
||||
"source-map-support/register",
|
||||
"ts-node/register"
|
||||
],
|
||||
"timeout": 60000,
|
||||
"trace-deprecation": true,
|
||||
"trace-warnings": true,
|
||||
"use_strict": true
|
||||
},
|
||||
"_id": "npm-check-updates@17.1.13",
|
||||
"gitHead": "f514093647f1833c83653765493c694372d14fea",
|
||||
"_nodeVersion": "22.0.0",
|
||||
"_npmVersion": "10.9.1",
|
||||
"dist": {
|
||||
"integrity": "sha512-m9Woo2J5XVab0VcQpYvrQ0hx3ySI1mGbiHR595mc6Lr1/FIaTWvv+oU+T1WKSfXRiluKC/V5P6Bdk5agaYpqqg==",
|
||||
"shasum": "93e1c5fa5b8e11bca0bd143650b14ffcf9fc6b5a",
|
||||
"tarball": "http://localhost:4260/npm-check-updates/npm-check-updates-17.1.13.tgz",
|
||||
"fileCount": 19,
|
||||
"unpackedSize": 5336239
|
||||
},
|
||||
"directories": {},
|
||||
"_hasShrinkwrap": false
|
||||
}
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/raineorshine/npm-check-updates/issues"
|
||||
},
|
||||
"author": {
|
||||
"name": "Tomas Junnonen",
|
||||
"email": "tomas1@gmail.com"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"homepage": "https://github.com/raineorshine/npm-check-updates",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/raineorshine/npm-check-updates.git"
|
||||
},
|
||||
"description": "Find newer versions of dependencies than what your package.json allows",
|
||||
"readmeFilename": "README.md"
|
||||
}
|
7
tests/specs/npm/npm_check_updates/__test__.jsonc
Normal file
7
tests/specs/npm/npm_check_updates/__test__.jsonc
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"tempDir": true,
|
||||
"steps": [{
|
||||
"args": "run -A npm:npm-check-updates",
|
||||
"output": "output.out"
|
||||
}]
|
||||
}
|
2
tests/specs/npm/npm_check_updates/output.out
Normal file
2
tests/specs/npm/npm_check_updates/output.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
[WILDCARD]
|
||||
All dependencies match the latest package versions[WILDCARD]
|
5
tests/specs/npm/npm_check_updates/package.json
Normal file
5
tests/specs/npm/npm_check_updates/package.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"chalk": "^5.0.1"
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue