Skip to content

Commit

Permalink
refactor ~ replace JSDelivr/SkyPack imports with 'esm.sh'
Browse files Browse the repository at this point in the history
* Deno-v2.0.0-rc7+ is now requiring "import" permissions
  - JSDelivr and SkyPack are not on the Deno-2.0 default allowlist
  - esm.sh *is* included in the "allow-import" default domain list
  - ref: <denoland/deno#25469>

to comply with Deno-2.0 'import' permission defaults
  • Loading branch information
rivy committed Sep 29, 2024
1 parent 744b664 commit 4a24413
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
22 changes: 20 additions & 2 deletions src/lib/$deps.cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,26 @@
// Warning Implicitly using latest version (0.207.0) for https://deno.land/std/path/mod.ts
// Warning Implicitly using latest version (0.207.0) for https://deno.land/std/fmt/printf.ts
// ```
export { default as $yargs } from 'https://cdn.jsdelivr.net/gh/rivy-js/yargs@6be59a7fda/deno.ts'; // v17.7.2-deno-rivy
// * revise URL to use 'esm.sh' instead of 'cdn.jsdelivr.net' for compatibility with Deno-2.0 "import" permission defaults
// export { default as $yargs } from 'https://cdn.jsdelivr.net/gh/rivy-js/yargs@6be59a7fda/deno.ts'; // v17.7.2-deno-rivy
export { default as $yargs } from 'https://esm.sh/gh/rivy-js/yargs@f4b8034a75/deno.ts'; // v17.7.2-deno-rivy

//==== types

export type { Arguments as YargsArguments } from 'https://cdn.jsdelivr.net/gh/rivy-js/yargs@6be59a7fda/deno-types.ts'; // v17.7.2-deno-rivy
// export type { Arguments as YargsArguments } from 'https://esm.sh/gh/rivy-js/yargs@f4b8034a75/deno-types.ts'; // v17.7.2-deno-rivy

declare type ArgsOutput = (string | number)[];

// spell-checker:ignore () bcoe
// TODO(bcoe): attempt to get the types for YargsInstance working again.
export interface Arguments {
/** Non-option arguments */
_: ArgsOutput;
/** Arguments after the end-of-options flag `--` */
'--'?: ArgsOutput;
/** All remaining options */
// deno-lint-ignore no-explicit-any
[argName: string]: any;
}

export type { Arguments as YargsArguments };
10 changes: 8 additions & 2 deletions src/lib/$deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,20 @@ export const $fs = { exists, existsSync, expandGlob, expandGlobSync };

// export { default as $xdgAppPaths } from 'https://cdn.jsdelivr.net/gh/rivy/js.xdg-app-paths@9466e97/src/mod.deno.ts';

// export * as $lodash from 'https://cdn.skypack.dev/pin/[email protected]/lodash.js';
export * as $lodash from 'https://cdn.skypack.dev/[email protected]';
export * as $cliffyTable from 'https://deno.land/x/[email protected]/table/mod.ts'; // *pin*; [email protected] == last version to use [email protected] (or lower)
export { default as $osPaths } from 'https://deno.land/x/[email protected]/src/mod.deno.ts';
export * as $semver from 'https://deno.land/x/[email protected]/mod.ts';
export * as $tty from 'https://deno.land/x/[email protected]/mod.ts';
export { default as $xdgAppPaths } from 'https://deno.land/x/[email protected]/src/mod.deno.ts';

// export * as $lodash from 'https://cdn.skypack.dev/pin/[email protected]/lodash.js';
// export * as $lodash from 'https://cdn.skypack.dev/[email protected]';
// * revise URL to use 'esm.sh' instead of 'cdn.skypack.dev' for compatibility with Deno-2.0 "import" permission defaults
// export { default as $lodash } from 'https://esm.sh/[email protected]';
// export { _ as $lodash } from 'https://esm.sh/[email protected]';
// export * as $lodash from 'https://deno.land/x/[email protected]/dist/lodash.js';
export { default as $lodash } from 'npm:[email protected]'; // requires deno-v1.25.0+; recommend deno-v1.30.0+ for better results

// export { default as $yargs } from 'https://deno.land/x/[email protected]/deno.ts';

//=== features (functions, objects, and/or values)
Expand Down

0 comments on commit 4a24413

Please sign in to comment.