Skip to content

implement nodeNextResolve. #3

Description

@lemanschik

nodeNextResolve

is a primitive string replace resolve based on unified string representations of specifiers. where a single asterisk in a string can occure and gets replaced with a instance of the unified representation of the importSpecifier.

const baseUrl = import.meta.url

const resolveId = (id, importedById) => {
  const Uri = new URL(id, baseURL);
  // change the base example keeps search parms and that 
  // new URL(Uri.href.replace(Uri.origin, baseURL)); 
  return Uri;
}

const loader = (resolvedId) => {
  return fetch(resolvedId).then((ok) =>{}, (err) =>{});
}

lets take: https://unpkg.com/@rollup/plugin-node-resolve@15.0.1/dist/es/index.js

shim strip

// get it without the imports on top we supply that 
fetch('https://unpkg.com/@rollup/plugin-node-resolve@15.0.1/dist/es/index.js').then(async res=> (await res.text()).split('\n').slice(10).join('\n'))
import path, { dirname, resolve, extname, normalize, sep } from 'path';
import isBuiltinModule from 'is-builtin-module';
import deepMerge from 'deepmerge';
import isModule from 'is-module';
import fs, { realpathSync } from 'fs';
import { promisify } from 'util';
import { pathToFileURL, fileURLToPath } from 'url';
import resolve$1 from 'resolve';
import { createFilter } from '@rollup/pluginutils';

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions