- support for deno and node workspaces.
- support for
scopes
indeno.json
(I haven't got a clue as to what it does anyway). -
add a plugin that add support for custom mime type declaration viaimport "xyz" with { mime: "my-mime/type" }
.better yet, see the generalized approach in the task below:
- add a custom build-options/load-options plugin that can set a custom loader (or perform a separate bundle-build) based on the "with" import attributes.
- create a stub
esbuild.PluginBuild
object that can be used for testing theonResolve
calls of individual plugins. this would allow for the creation of unit tests, and also provide the plugin users with a better understanding of how the resource resolution works.
- add granulated tests for each plugin, and combination of plugins (for intertwined path resolution)
- npm-package download plugin (it will probably need access to the filesystem, for esbuild to discover it natively)
- optional global import map config at top level of the "all-in-one" plugin config
- a function to detect the current runtime, so that it can be later used for predicting the base-project-level scope's
runtimePackage: RuntimePackage
(i.e. is it apackage.json(c)
ordeno.json(c)
orjsr.json(c)
). -
rename old cached fetch tomemCachedFetch
will not implement right now (maybe in the future).
-
create a filesystem based cached fetch namedfsCachedFetch
will not implement right now (maybe in the future).
- the jsr plugin setup should accept
runtimePackage: DenoPackage | URL | string
configuration option for specifying the current scope/project'sdeno.json
file (if there's one). - in either the
jsrPlugin
or a newnpmPlugin
, we should install npm packages via deno, by tricking it into importing the package and storing it into localnode_modules
folder (which WILL require"nodeModulesDir": "auto"
in the top-level package'sdeno.json
) in the following way:on the other hand, if theconst dynamic_export_script = `export * as myLib from "npm:@${pkg.scope}/${pkg.name}@${pkg.version}"` const dynamic_export_script_blob = new Blob([dynamic_export_script], { type: "text/javascript" }) const dynamic_export_script_url = URL.createObjectURL(dynamic_export_script_blob) const phony_importer = await import(dynamic_export_script_url)
npm
command is available on the host system, then we can also executenpm install pkg-name --save-optional
(viaimport { exec } from "node:child_process"; await exec("...")
) if it is not already present inpackage.json
, or justnpm install pkg-name
if it is present inpackage.json
.
- create an
npmSpecifierPlugin
that only strips away the"npm:"
prefix from an import path, and leaves it up to esbuild to take care of the full-path resolution and loading.but if we do end up having to do the full-path resolution ourselves (to replicate esbuild's operation), we will need to assume thatnode_modules
exists in the current-working-directory (i.e.getCwd()
), and NOT esbuild'sabsWorkingDir
build option.most of this concern does not matter, since esbuild happily resolves the node-resolution-path starting with the
resolveDir
path argument provided to the built-in resolver function, and it works its way upwards, searching for thenode_modules
folder, and then searching for the package in each. - the
denoPlugins
should accept agetCwd: () => string
configuration option, and base its path resolver function around it. - if
DenoPluginsConfig.getCwd
isundefined
, then, by default, it will try detecting the runtime environment to pick from one of:() => process.cwd()
(for node and bun)() => Deno.cwd()
(for deno)() => window.location.href
(for browsers)() => request.origin
(for cloudflare workers (but how will we provide it arequest: Request
object statically?))
this got implemented in
jsr:@oazmi/[email protected]/crossenv
, and was imported here as a dependency. - add the jsr
"@std/*"
dependencies to thepackageJson.bundledDependencies
field ofdeno.json
, because npm does not permit packing of the.npmrc
file, no matter what. as a result, the client downloading our package will never be able to resolve installation of@std/jsonc
and@std/semver
. thus, we bundle these dependencies in our packed npm-distribution. one unfortunate consequence is that it explodes the number of distribution files to450+
, instead of just55
files.
- create an "all-in-one" plugin that is a combination of all of the plugins.
- implement cached fetch for resource caching.
I'm just using
{ cache: "force-cache" }
in everyfetch
call. but I may need a more abstract caching strategy if I plan on caching on the filesystem as well viamemCachedFetch
that I may or may not introduce in version0.2.0
. -
cached fetch should also retry due to timeout (up to 10 times)I don't see the need for this, since http is designed to retry in case of a corrupted response.
- cached fetch should also follow redirects
(up to 10 times)(or just set{ redirect: "follow" }
infetch
options)
- import map in
PluginData
- inside of
resolvePathFromImportMap
, we should normalize the inputpath
first (see MDN). moreover, I think we are supposed to also normalize the import keys, except for the initial dot-slash "./" (or lack-thereof). but I'll have to look into the specification carefully to deduce that, since it isn't made clear at the surface level. - http plugin
- jsr plugin
- import-map plugin
- contemplate which factory functions could potentially require information on
build.initialOptions.absWorkingDir