MCPcopy Create free account
hub / github.com/stenciljs/core / parseDevModuleUrl

Function parseDevModuleUrl

src/compiler/bundle/dev-module.ts:154–180  ·  view source on GitHub ↗
(config: d.ValidatedConfig, u: string)

Source from the content-addressed store, hash-verified

152};
153
154const parseDevModuleUrl = (config: d.ValidatedConfig, u: string) => {
155 const parsedUrl: ParsedDevModuleUrl = {
156 nodeModuleId: null,
157 nodeModuleVersion: null,
158 nodeResolvedPath: null,
159 };
160
161 if (u && u.includes(DEV_MODULE_DIR) && u.endsWith('.js')) {
162 const url = new URL(u, 'https://stenciljs.com');
163 let reqPath = basename(url.pathname);
164 reqPath = reqPath.substring(0, reqPath.length - 3);
165
166 const splt = reqPath.split('@');
167 if (splt.length === 2) {
168 parsedUrl.nodeModuleId = decodeURIComponent(splt[0]);
169 parsedUrl.nodeModuleVersion = decodeURIComponent(splt[1]);
170
171 parsedUrl.nodeResolvedPath = url.searchParams.get('p');
172 if (parsedUrl.nodeResolvedPath) {
173 parsedUrl.nodeResolvedPath = decodeURIComponent(parsedUrl.nodeResolvedPath);
174 parsedUrl.nodeResolvedPath = join(config.rootDir, parsedUrl.nodeResolvedPath);
175 }
176 }
177 }
178
179 return parsedUrl;
180};
181
182const getDevModuleCachePath = (config: d.ValidatedConfig, parsedUrl: ParsedDevModuleUrl) => {
183 return join(

Callers 1

compilerRequestFunction · 0.85

Calls 2

joinFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected