Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement nodeNextResolve. #3

Open
lemanschik opened this issue Dec 2, 2022 · 0 comments
Open

implement nodeNextResolve. #3

lemanschik opened this issue Dec 2, 2022 · 0 comments

Comments

@lemanschik
Copy link
Owner

lemanschik commented Dec 2, 2022

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/[email protected]/dist/es/index.js

shim strip

// get it without the imports on top we supply that 
fetch('https://unpkg.com/@rollup/[email protected]/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';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant