resolvewithplus

resolves ESM paths relative to a given path

ISC License

Downloads
6.1K
Stars
4
Committers
4

Bot releases are hidden (Show)

resolvewithplus - improve wildcard nesting expansion Latest Release

Published by iambumblehead 8 months ago

Essentially, this release enables resolvewithplus to resolve the following esm export

{
  "exports": {
    "./*": {
      "require": "./*.js",
      "import": "./*.js"
    }
  }
}

Full list of changes,

resolvewithplus - resolve wildcard-using pattern resolution

Published by iambumblehead 9 months ago

resolve nested exports defined on named-properties with wildcards, eg exports: { './*': { default: './src/*/index.js' } } resolves this issue at esmock

resolvewithplus - resolves criticaal error

Published by iambumblehead 12 months ago

resolve full path from package.json "main", "browser" and "module" definitions. resolves this issue at esmock.

resolvewithplus - remove unused condition

Published by iambumblehead 12 months ago

remove unused condition and resolved error where fileurl path was not correctly resolved for package.json "main", "browser" and "module" definitions

resolvewithplus - support user-defined `priority` list

Published by iambumblehead almost 1 year ago

when user-defined priority list includes "import" return packagejson.module before packagejson.main

support user-defined priority list when resolving nested export expressions

resolvewithplus - resolve error preventing module resolution

Published by iambumblehead about 1 year ago

resolve error preventing module resolution. There is a condition that alters lookup paths for the situation when resolvewithplus is being developed and tested from inside another package's node_modules. The condition caused lookup errors. The condition was changed and a unit-test added

resolvewithplus - remove un-necessary sort

Published by iambumblehead about 1 year ago

remove un-necessary sorting to provide faster lookups

resolvewithplus - use package type to determine 'import' or 'require' lookup

Published by iambumblehead about 1 year ago

use package type to determine lookup: 'import' or 'require'

(wiki is updated with details)

resolvewithplus - prioritize module resolutions

Published by iambumblehead about 1 year ago

With this release resolvewithplus supports optional isbrowser, istypescript and isimport fields and when one of these is specified the resolver prioritizes browser-exported files, typecript and module files. By default, isimport is true

resolvewithplus('react-dom/server', '/resolvewith/test/', {
  isbrowser: true
}) // 'file:///resolvewith/node_modules/react-dom/server.browser.js'

resolvewithplus now also supports an advanced priority option. When a package.json is parsed, a default priority list determines the priority of named-exports in this order: browser (if isbrowser), then import then node then default. Define a custom priority list to specify a custom ordering. If you are using nodejs, this is probably not needed,

resolvewithplus('react-dom/server', '/resolvewith/test/', {
  priority: ['deno', 'default']
}) // 'file:///resolvewith/node_modules/react-dom/server.deno.js'

resolvewithplus('react-dom/server', '/resolvewith/test/', {
  priority: ['browser', 'default']
}) // 'file:///resolvewith/node_modules/react-dom/server.browser.js'

changelog:

resolvewithplus - improve typescript resolution

Published by iambumblehead about 1 year ago

this PR changes the location of isTypescript detection to occur in one place that is more widely used so that it can be engaged more frequently to improve typescript resolution.

resolvewithplus - detect typescript parent to apply typescript condtions

Published by iambumblehead about 1 year ago

When the resolver detects a typescript parent it can apply typescript conditions to resolve the moduleId. New conditions can be added for typescript situations as needed, this new behaviour is a starting point,

resolvewithplus - v2.0.2 use node v20 ci, increment dependencies

Published by iambumblehead over 1 year ago

v2.0.2 use node v20 ci, increment dependencies

resolvewithplus - @mshima windows drive letter patch

Published by iambumblehead almost 2 years ago

resolve windows modules with correct drive letter using patch from @mshima

resolvewithplus - return encoded url same as import.meta.resolve

Published by iambumblehead almost 2 years ago

return encoded url same as import.meta.resolve ,

  • this, 'file:///path/to/indexfile/file%20name%20with%20spaces.js'
  • rather than, 'file:///path/to/indexfile/file name with spaces.js'
resolvewithplus - add test and changes to support import.meta.url parent

Published by iambumblehead about 2 years ago

Add test and changes to support import.meta.url parent. While exploring changes at esmock, it was discovered that esmock slightly modifies import.meta.url from the callee before passing along when calling resolvewithplus,

resolvewithplus('../../index.js', import.meta.url)
resolvewithplus - reduce install size 1kB

Published by iambumblehead about 2 years ago

minified resolvewithplus.js is 50% smaller and total install size becomes 5.78kB, from 6.79kB

resolvewithplus - return fileurl-formatted paths, eg file:///path/to/module.js

Published by iambumblehead about 2 years ago

Returning fileurl-formatted paths allows esmock to be simplified, where esmock previously needed to detect and convert resolvewithplus paths to fileurl-formatted paths. Returning fileurl-formatted paths also makes resolvewithplus more interchangeable with import.meta.resolve, which also returns fileurl-formatted paths,

resolvewithplus - parse esm patterns from nodejs' documentation

Published by iambumblehead about 2 years ago

completed esm pattern parsing (big improvement)

resolvewithplus - resolve "pg" package's cjs package.main

Published by iambumblehead about 2 years ago

resolve "pg" package's cjs "main": "./lib"

resolvewithplus - support win32 drive-style module paths

Published by iambumblehead about 2 years ago

support win32 drive-style module-path