1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-31 19:44:10 -05:00
denoland-deno/cli/tests/testdata/npm
Bartek Iwańczuk 930ce20870
feat: deprecate window global (#22057)
This commit deprecates `window` global and adds deprecation
notice on each use of `window`.

We decided to proceed with removal of `window` global variable in Deno
2.0. There's a lot of code
in the wild that uses pattern like this:
```
if (typeof window !== "undefined) {
  ...
}
```
to check if the code is being run in browser. However, this check passes
fine in Deno and
most often libraries that do this check try to access some browser API
that is not available
in Deno, or use DOM APIs (which are also not available in Deno).

This situation has occurred multiple times already
and it's unfeasible to expect the whole ecosystem to migrate to new
check (and even if that
happened there's a ton of code that's already shipped and won't change).

The migration is straightfoward - replace all usages of `window` with
`globalThis` or `self`.
When Deno encounters use of `window` global it will now issue a warning,
steering users
towards required changes:

```
Warning
├ Use of deprecated "window" API.
│
├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then.
│
├ Suggestion: Use `globalThis` or `self` instead.
│
├ Suggestion: You can provide `window` in the current scope with: `const window = globalThis`.
│
└ Stack trace:
  └─ at file:///Users/ib/dev/deno/foo.js:7:1
```

Ref https://github.com/denoland/deno/issues/13367.
2024-01-24 14:20:51 +01:00
..
binary_package fix(npm): improved optional dependency support (#19135) 2023-05-17 17:38:50 -04:00
builtin_module_module fix(ext/node): fix builtin module module (#15904) 2022-09-17 20:35:32 +09:00
cached_only refactor: use deno_graph for npm specifiers (#17858) 2023-02-22 14:15:25 -05:00
cached_only_after_first_run
check_errors feat(unstable/npm): initial type checking of npm specifiers (#16332) 2022-10-21 15:20:18 +00:00
child_process_fork_test feat(npm): functionality to support child_process.fork (#15891) 2022-09-28 13:04:16 -04:00
cjs-invalid-name-exports fix(npm): escape export identifier in double quoted string (#19694) 2023-07-03 18:41:09 +00:00
cjs_local_global_decls fix: avoid global declaration collisions in cjs (#15608) 2022-08-25 20:24:18 -04:00
cjs_module_export_assignment refactor: merge Deno & Node inspectors (#18691) 2023-04-30 07:24:13 +00:00
cjs_module_export_assignment_number refactor: merge Deno & Node inspectors (#18691) 2023-04-30 07:24:13 +00:00
cjs_reexport_collision fix(npm): align Deno importing Node cjs with Node esm importing cjs (#15879) 2022-09-12 14:28:51 -04:00
cjs_require_esm_error chore: bump deno_core and update tests (#21467) 2023-12-06 17:02:52 -07:00
cjs_require_esm_mjs_error chore: bump deno_core and update tests (#21467) 2023-12-06 17:02:52 -07:00
cjs_sub_path refactor: remove DENO_UNSTABLE_NPM_SYNC_DOWNLOAD and custom sync functionality (#20504) 2023-09-14 17:51:28 +00:00
cjs_this_in_exports chore: bump deno_core and update tests (#21467) 2023-12-06 17:02:52 -07:00
cjs_with_deps refactor: remove DENO_UNSTABLE_NPM_SYNC_DOWNLOAD and custom sync functionality (#20504) 2023-09-14 17:51:28 +00:00
cjs_yargs refactor: remove DENO_UNSTABLE_NPM_SYNC_DOWNLOAD and custom sync functionality (#20504) 2023-09-14 17:51:28 +00:00
compare_globals feat: deprecate window global (#22057) 2024-01-24 14:20:51 +01:00
conditional_exports refactor: remove DENO_UNSTABLE_NPM_SYNC_DOWNLOAD and custom sync functionality (#20504) 2023-09-14 17:51:28 +00:00
create_require fix(ext/node): allow absolute path in createRequire (#16853) 2022-11-29 14:13:14 +09:00
d_ext fix(node): resolve file.d specifiers in npm packages (#20918) 2023-10-17 00:26:38 +09:00
different_nested_dep fix(byonm): correct resolution for scoped packages (#21083) 2023-11-06 08:35:26 -05:00
directory_import fix(npm): improve error message on directory import in npm package (#19538) 2023-07-14 16:47:18 +00:00
dual_cjs_esm feat(unstable/npm): support providing npm dist-tag in npm package specifier (#16293) 2022-10-17 09:16:19 -04:00
dynamic_import fix(unstable): various resolution bugs for npm: specifiers (#15546) 2022-08-24 14:54:20 +02:00
dynamic_import_deno_ts_from_npm fix(npm): support dynamic import of Deno TS from npm package (#19858) 2023-07-17 17:17:58 -04:00
dynamic_import_invalid_package_name fix(cli): avoid crash on import of invalid module names (#19523) 2023-06-15 18:36:33 +00:00
dynamic_import_json fix(ext/node): fix import json using npm specifier (#19723) 2023-08-01 23:20:08 +00:00
dynamic_import_reload_same_package fix(npm): ensure npm package downloaded once per run when using --reload (#16842) 2022-11-27 13:25:08 -05:00
env_var_re_export fix(npm): recursive translation of reexports, remove window global in node code (#15806) 2022-09-08 22:01:48 +02:00
error_version_after_subpath fix(npm): better error is version is specified after subpath (#16131) 2022-10-03 19:10:53 +02:00
esm chore: fix flaky tests checking ms when CI is slow (#18559) 2023-04-06 23:48:07 +02:00
esm_import_cjs_default refactor: merge Deno & Node inspectors (#18691) 2023-04-30 07:24:13 +00:00
file_dts_dmts_dcts fix(npm): improve declaration resolution for filename with different extensions (#19966) 2023-07-28 11:24:22 -04:00
import_json fix(ext/node): fix import json using npm specifier (#19723) 2023-08-01 23:20:08 +00:00
import_map refactor: remove DENO_UNSTABLE_NPM_SYNC_DOWNLOAD and custom sync functionality (#20504) 2023-09-14 17:51:28 +00:00
imports_package_json fix(node): support resolving a package.json import to a builtin node module (#21576) 2023-12-14 15:09:05 +00:00
info refactor: upgrade deno_ast 0.28 and deno_semver 0.4 (#20193) 2023-08-21 09:53:52 +00:00
invalid_package_name refactor: upgrade deno_ast 0.28 and deno_semver 0.4 (#20193) 2023-08-21 09:53:52 +00:00
local_dir_resolves_symlinks fix(npm): canonicalize filename before returning (#18948) 2023-05-02 02:35:33 +02:00
lock_file feat(lockfile): track JSR and npm dependencies in config file (#22004) 2024-01-22 22:31:12 +01:00
mixed_case_package_name refactor: remove DENO_UNSTABLE_NPM_SYNC_DOWNLOAD and custom sync functionality (#20504) 2023-09-14 17:51:28 +00:00
no_npm_after_first_run feat: add --no-npm flag to disable npm: imports (#15673) 2022-09-07 15:33:51 +02:00
no_types_cjs fix(npm): don't resolve JS files when resolving types (#16854) 2022-11-28 17:48:56 -05:00
no_types_in_conditional_exports fix(npm/check): prioritize exports over types entry (#16788) 2022-11-24 17:07:36 +00:00
node_modules_deno_node_modules fix(npm): create node_modules/.deno/node_modules folder (#19242) 2023-05-24 15:04:21 -04:00
node_modules_import fix(npm): support bare specifiers in package.json having a path (#17903) 2023-02-23 17:33:23 +00:00
nonexistent_file fix(npm): improve error message importing non-existent file in a node_modules npm package (#19835) 2023-07-14 17:47:15 +00:00
peer_deps_with_copied_folders refactor: remove DENO_UNSTABLE_NPM_SYNC_DOWNLOAD and custom sync functionality (#20504) 2023-09-14 17:51:28 +00:00
permissions_outside_package fix(npm): allow to read package.json if permissions are granted (#17209) 2023-01-10 14:35:44 +01:00
registry feat: warn when using --unstable, prefer granular flags (#21452) 2024-01-23 15:33:07 +01:00
reload feat(npm): add support for --reload=npm: and --reload=npm:<package> (#15972) 2022-09-22 10:39:58 -04:00
remote_npm_specifier feat(npm): support npm specifiers in remote modules without --unstable (#17889) 2023-02-23 09:48:29 -05:00
require_added_nm_folder feat(npm): add flag for creating and resolving npm packages to a local node_modules folder (#15971) 2022-09-22 11:17:02 -04:00
require_json fix(npm): handle json files in require (#16125) 2022-10-01 22:21:19 +02:00
require_main fix(ext/node): fix unable to resolve fraction.js (#18544) 2023-04-06 16:12:50 +02:00
require_resolve_url fix(npm): do not panic providing file url to require.resolve paths (#20182) 2023-08-17 10:39:06 -04:00
reserved_word_exports fix: allow reserved word 'mod' in exports (#21537) 2023-12-11 17:23:50 +01:00
run_existing_npm_package fix(cli): for main-module that exists in package.json, use the version defined in package.json directly (#20328) 2023-09-18 20:02:58 +00:00
run_existing_npm_package_with_subpath fix(cli): for main-module that exists in package.json, use the version defined in package.json directly (#20328) 2023-09-18 20:02:58 +00:00
sub_paths feat: support subpaths in npm package references (#15578) 2022-08-24 11:25:32 -04:00
tarball_with_global_header refactor: merge Deno & Node inspectors (#18691) 2023-04-30 07:24:13 +00:00
translate_cjs_to_esm fix(npm): probing for files that have a file stem (#16641) 2022-11-15 13:58:04 +01:00
types fix(npm): handle declaration file resolution where packages incorrectly define "types" last in "exports" (#17290) 2023-01-06 12:57:52 -05:00
types_ambient_module feat(unstable/npm): initial type checking of npm specifiers (#16332) 2022-10-21 15:20:18 +00:00
types_entry_value_not_exists chore(npm): fix types tests (#16882) 2022-12-01 12:26:33 -05:00
types_exports_import_types chore(npm): fix types tests (#16882) 2022-12-01 12:26:33 -05:00
types_no_types_entry refactor: remove DENO_UNSTABLE_NPM_SYNC_DOWNLOAD and custom sync functionality (#20504) 2023-09-14 17:51:28 +00:00
typescript_file_in_package refactor: use deno_graph for npm specifiers (#17858) 2023-02-22 14:15:25 -05:00
deno_cache.out refactor: remove DENO_UNSTABLE_NPM_SYNC_DOWNLOAD and custom sync functionality (#20504) 2023-09-14 17:51:28 +00:00
deno_run_cjs.out fix(npm): binary entrypoint for .js or no extension (#15900) 2022-09-14 10:41:47 -04:00
deno_run_cowsay.out feat(npm): support packages with multiple command names (#15565) 2022-08-23 22:01:21 -04:00
deno_run_cowsay_no_permissions.out fix(compile): implicit read permission to npm vfs (#19281) 2023-05-26 13:33:38 -04:00
deno_run_cowthink.out feat(npm): support packages with multiple command names (#15565) 2022-08-23 22:01:21 -04:00
deno_run_esm.out chore(npm): add test for esm npm binary package (#15609) 2022-08-26 09:17:48 -04:00
deno_run_no_bin_entrypoint.out refactor(ext/node): remove dependency on deno_npm and deno_semver (#20718) 2023-09-28 22:43:45 +02:00
deno_run_no_bin_entrypoint_non_existent_subpath.out refactor(ext/node): remove dependency on deno_npm and deno_semver (#20718) 2023-09-28 22:43:45 +02:00
deno_run_no_ext.out fix(npm): binary entrypoint for .js or no extension (#15900) 2022-09-14 10:41:47 -04:00
deno_run_non_existent.out fix(npm): reload an npm package's dependency's information when version not found (#18622) 2023-04-06 21:41:19 -04:00
deno_run_special_chars_in_bin_name.out fix(ext/node): json encode binary command name (#18596) 2023-04-06 01:46:21 +02:00
README.md fix: avoid global declaration collisions in cjs (#15608) 2022-08-25 20:24:18 -04:00

npm test data

This folder contains test data for npm specifiers.

Registry

The registry is served by the test server (server in test_util) at http://localhost:4545/npm/registry/ via the ./registry folder.

Updating with real npm packages

  1. Set the DENO_TEST_UTIL_UPDATE_NPM=1 environment variable
  2. Run the test and it should download the packages.

Using a custom npm package

  1. Add the custom package to ./registry/@denotest
  2. Reference npm:@denotest/<your-package-name> in the tests.