index.js
/**
		 * Resolve an import's full filepath.
		 */
Resolve an import's full filepath.
Resolve an import ' s full filepath .
resolveId(importee, importer) {
			if (cache_emit.has(importee)) return importee;
			if (!importer || importee[0] === '.' || importee[0] === '\0' || path.isAbsolute(importee)) return null;
			const parts = importee.split('/');
			let dir, pkg, name = parts.shift();
			if (name && name[0] === '@') {
				name += `/${parts.shift()}`;
			}
			try {
				const file = `${name}/package.json`;
				const resolved = relative.resolve(file, path.dirname(importer));
				dir = path.dirname(resolved);
				pkg = require(resolved);
			} catch (err) {
				if (err.code === 'MODULE_NOT_FOUND') return null;
				if (err.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED') {
					pkg_export_errors.add(name);
					return null;
				}
				throw err;
			}
			if (parts.length === 0 && pkg.svelte) {
				return path.resolve(dir, pkg.svelte);
			}
		}
resolveId ( importee , importer ) { if ( cache_emit . has ( importee ) ) return importee ; if ( ! importer || importee [ 0 ] === '.' || importee [ 0 ] === '\0' || path . isAbsolute ( importee ) ) return null ; const parts = importee . split ( '/' ) ; let dir , pkg , name = parts . shift ( ) ; if ( name && name [ 0 ] === '@' ) { name += ` ${ parts . shift ( ) } ` ; } try { const file = ` ${ name } ` ; const resolved = relative . resolve ( file , path . dirname ( importer ) ) ; dir = path . dirname ( resolved ) ; pkg = require ( resolved ) ; } catch ( err ) { if ( err . code === 'MODULE_NOT_FOUND' ) return null ; if ( err . code === 'ERR_PACKAGE_PATH_NOT_EXPORTED' ) { pkg_export_errors . add ( name ) ; return null ; } throw err ; } if ( parts . length === 0 && pkg . svelte ) { return path . resolve ( dir , pkg . svelte ) ; } }
Resolve an import's full filepath.
Resolve an import ' s full filepath .
// if this is a bare import, see if there's a valid pkg.svelte // use pkg.svelte