@remix-run/assets 0.4.3 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +322 -56
  2. package/dist/assets.d.ts +2 -1
  3. package/dist/assets.d.ts.map +1 -1
  4. package/dist/assets.js +2 -2
  5. package/dist/lib/access.d.ts +6 -2
  6. package/dist/lib/access.d.ts.map +1 -1
  7. package/dist/lib/access.js +300 -5
  8. package/dist/lib/asset-server.d.ts +118 -5
  9. package/dist/lib/asset-server.d.ts.map +1 -1
  10. package/dist/lib/asset-server.js +260 -24
  11. package/dist/lib/compilation-error.d.ts +1 -1
  12. package/dist/lib/compilation-error.d.ts.map +1 -1
  13. package/dist/lib/file-matcher.js +1 -1
  14. package/dist/lib/files/compiler.d.ts.map +1 -1
  15. package/dist/lib/files/compiler.js +7 -6
  16. package/dist/lib/files/config.js +1 -1
  17. package/dist/lib/hmr.d.ts +37 -0
  18. package/dist/lib/hmr.d.ts.map +1 -0
  19. package/dist/lib/hmr.js +357 -0
  20. package/dist/lib/injected-packages.d.ts.map +1 -1
  21. package/dist/lib/injected-packages.js +36 -13
  22. package/dist/lib/loaders.d.ts +57 -0
  23. package/dist/lib/loaders.d.ts.map +1 -0
  24. package/dist/lib/loaders.js +1 -0
  25. package/dist/lib/module-store.d.ts +24 -0
  26. package/dist/lib/module-store.d.ts.map +1 -1
  27. package/dist/lib/module-store.js +136 -11
  28. package/dist/lib/routes.d.ts.map +1 -1
  29. package/dist/lib/routes.js +13 -13
  30. package/dist/lib/scripts/compiler.d.ts +24 -1
  31. package/dist/lib/scripts/compiler.d.ts.map +1 -1
  32. package/dist/lib/scripts/compiler.js +183 -29
  33. package/dist/lib/scripts/conditions.d.ts +2 -0
  34. package/dist/lib/scripts/conditions.d.ts.map +1 -0
  35. package/dist/lib/scripts/conditions.js +1 -0
  36. package/dist/lib/scripts/emit.d.ts +3 -0
  37. package/dist/lib/scripts/emit.d.ts.map +1 -1
  38. package/dist/lib/scripts/emit.js +24 -5
  39. package/dist/lib/scripts/resolve.d.ts +4 -0
  40. package/dist/lib/scripts/resolve.d.ts.map +1 -1
  41. package/dist/lib/scripts/resolve.js +70 -5
  42. package/dist/lib/scripts/transform.d.ts +9 -0
  43. package/dist/lib/scripts/transform.d.ts.map +1 -1
  44. package/dist/lib/scripts/transform.js +222 -18
  45. package/dist/lib/source-maps.js +1 -1
  46. package/dist/lib/styles/compiler.d.ts +14 -1
  47. package/dist/lib/styles/compiler.d.ts.map +1 -1
  48. package/dist/lib/styles/compiler.js +78 -14
  49. package/dist/lib/styles/emit.js +4 -4
  50. package/dist/lib/styles/resolve.d.ts.map +1 -1
  51. package/dist/lib/styles/resolve.js +8 -7
  52. package/dist/lib/styles/transform.js +3 -3
  53. package/dist/lib/target.d.ts +1 -1
  54. package/dist/lib/target.d.ts.map +1 -1
  55. package/dist/lib/watch.js +1 -1
  56. package/dist/types/hmr.d.ts +36 -0
  57. package/package.json +17 -11
  58. package/src/assets.ts +2 -1
  59. package/src/lib/access.ts +386 -5
  60. package/src/lib/asset-server.ts +429 -18
  61. package/src/lib/compilation-error.ts +1 -0
  62. package/src/lib/files/compiler.ts +7 -3
  63. package/src/lib/hmr.ts +397 -0
  64. package/src/lib/injected-packages.ts +41 -11
  65. package/src/lib/loaders.ts +80 -0
  66. package/src/lib/module-store.ts +190 -9
  67. package/src/lib/routes.ts +24 -14
  68. package/src/lib/scripts/compiler.ts +248 -24
  69. package/src/lib/scripts/conditions.ts +1 -0
  70. package/src/lib/scripts/emit.ts +50 -5
  71. package/src/lib/scripts/resolve.ts +124 -2
  72. package/src/lib/scripts/transform.ts +290 -19
  73. package/src/lib/styles/compiler.ts +108 -8
  74. package/src/lib/styles/emit.ts +1 -1
  75. package/src/lib/styles/resolve.ts +11 -7
  76. package/src/types/hmr.d.ts +36 -0
@@ -3,14 +3,14 @@ import * as os from 'node:os';
3
3
  import * as path from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import { IfNoneMatch } from '@remix-run/headers/if-none-match';
6
- import { createAssetServerCompilationError } from "../compilation-error.js";
7
- import { createFileMatcher } from "../file-matcher.js";
8
- import { formatFingerprintedPathname, getFingerprintRequestCacheControl, parseFingerprintSuffix, } from "../fingerprint.js";
9
- import { emitResolvedModule } from "./emit.js";
10
- import { normalizeFilePath, resolveFilePath } from "../paths.js";
11
- import { resolveModule, resolverExtensionAlias, resolverExtensions, supportedScriptExtensions, } from "./resolve.js";
12
- import { createModuleStore } from "../module-store.js";
13
- import { createTsconfigTransformOptionsResolver, transformModule } from "./transform.js";
6
+ import { createAssetServerCompilationError } from '../compilation-error.js';
7
+ import { createFileMatcher } from '../file-matcher.js';
8
+ import { formatFingerprintedPathname, getFingerprintRequestCacheControl, parseFingerprintSuffix, } from '../fingerprint.js';
9
+ import { emitResolvedModule } from './emit.js';
10
+ import { normalizeFilePath, resolveFilePath } from '../paths.js';
11
+ import { resolveModule, resolverExtensionAlias, resolverExtensions, supportedScriptExtensions, } from './resolve.js';
12
+ import { createModuleStore } from '../module-store.js';
13
+ import { createTsconfigTransformOptionsResolver, transformModule } from './transform.js';
14
14
  import { ResolverFactory } from 'oxc-resolver';
15
15
  const supportedScriptExtensionSet = new Set(supportedScriptExtensions);
16
16
  const preloadConcurrency = Math.max(1, Math.min(8, os.availableParallelism() - 1));
@@ -21,7 +21,14 @@ export function createScriptCompiler(options) {
21
21
  watchIgnoreMatchers: (options.watchIgnore ?? []).map((pattern) => createFileMatcher(pattern, options.rootDir)),
22
22
  };
23
23
  let scriptStore = createModuleStore({
24
+ getAcceptedDependencies(resolvedModule) {
25
+ return resolvedModule.hmr.acceptedDeps.map((acceptedDep) => acceptedDep.depPath);
26
+ },
27
+ getDependencies(resolvedModule) {
28
+ return resolvedModule.deps;
29
+ },
24
30
  onWatchDirectoriesChange: options.onWatchDirectoriesChange,
31
+ onWatchFilesChange: options.onWatchFilesChange,
25
32
  });
26
33
  let tsconfigTransformOptionsResolver = createTsconfigTransformOptionsResolver();
27
34
  let resolverFactory = new ResolverFactory({
@@ -40,6 +47,7 @@ export function createScriptCompiler(options) {
40
47
  externalSet: resolvedOptions.externalSet,
41
48
  isWatchIgnored,
42
49
  minify: resolvedOptions.minify,
50
+ loaders: resolvedOptions.loaders,
43
51
  resolveActualPath,
44
52
  routes: resolvedOptions.routes,
45
53
  sourceMapSourcePaths: resolvedOptions.sourceMapSourcePaths,
@@ -101,23 +109,27 @@ export function createScriptCompiler(options) {
101
109
  let resolvedModule = resolveServedScriptOrThrow(resolveInputFilePath(filePath));
102
110
  return getServedUrl(resolvedModule.identityPath);
103
111
  },
104
- async handleFileEvent(filePath, event) {
112
+ async classifyHmrFileEvent(filePath, event) {
105
113
  let normalizedFilePath = normalizeFilePath(filePath);
106
114
  if (isWatchIgnored(normalizedFilePath))
107
- return;
108
- if (shouldClearResolverCacheForFileEvent(normalizedFilePath, event)) {
109
- resolverFactory.clearCache();
110
- }
111
- if (isTsconfigPath(normalizedFilePath)) {
112
- tsconfigTransformOptionsResolver.clear();
113
- scriptStore.invalidateAll();
114
- return;
115
- }
116
- if (isPackageJsonPath(normalizedFilePath)) {
117
- scriptStore.invalidateAll();
118
- return;
115
+ return [];
116
+ let timestamp = Date.now();
117
+ let previousResolvedModule = scriptStore.getLastResolved(normalizedFilePath);
118
+ let updatePathname = previousResolvedModule?.stableUrlPathname;
119
+ invalidateScriptFileEvent(normalizedFilePath, event);
120
+ let resolvedModule = event === 'change' && updatePathname
121
+ ? await tryGetOrCreateResolvedScript(scriptStore.get(normalizedFilePath))
122
+ : undefined;
123
+ let hmrUpdate = event === 'change' && updatePathname
124
+ ? getHmrUpdatesForChange(resolvedModule ?? previousResolvedModule, previousResolvedModule, updatePathname, timestamp)
125
+ : [];
126
+ if (hmrUpdate.length > 0) {
127
+ resolvedOptions.hmr?.send(hmrUpdate);
119
128
  }
120
- scriptStore.invalidateForFileEvent(normalizedFilePath, event);
129
+ return hmrUpdate;
130
+ },
131
+ invalidateFileEvent(filePath, event) {
132
+ invalidateScriptFileEvent(normalizeFilePath(filePath), event);
121
133
  },
122
134
  parseRequestPathname(pathname) {
123
135
  let parsedPathname = parseServedPathname(pathname);
@@ -143,6 +155,23 @@ export function createScriptCompiler(options) {
143
155
  }
144
156
  return resolveFilePath(resolvedOptions.rootDir, filePath);
145
157
  }
158
+ function invalidateScriptFileEvent(normalizedFilePath, event) {
159
+ if (isWatchIgnored(normalizedFilePath))
160
+ return;
161
+ if (shouldClearResolverCacheForFileEvent(normalizedFilePath, event)) {
162
+ resolverFactory.clearCache();
163
+ }
164
+ if (isTsconfigPath(normalizedFilePath)) {
165
+ tsconfigTransformOptionsResolver.clear();
166
+ scriptStore.invalidateAll();
167
+ return;
168
+ }
169
+ if (isPackageJsonPath(normalizedFilePath)) {
170
+ scriptStore.invalidateAll();
171
+ return;
172
+ }
173
+ scriptStore.invalidateForFileEvent(normalizedFilePath, event);
174
+ }
146
175
  function resolveServedScriptOrThrow(absolutePath) {
147
176
  let resolvedModule = resolveModulePath(absolutePath);
148
177
  if (!resolvedModule) {
@@ -151,16 +180,22 @@ export function createScriptCompiler(options) {
151
180
  });
152
181
  }
153
182
  if (!resolvedOptions.isAllowed(resolvedModule.identityPath)) {
154
- throw createAssetServerCompilationError(`File is not allowed: ${resolvedModule.identityPath}`, {
183
+ throw createAssetServerCompilationError(`File "${resolvedModule.identityPath}" is not allowed by the asset server access configuration. ` +
184
+ `Add a matching allowFiles or allowPackages rule, or remove a conflicting denyFiles rule.`, {
155
185
  code: 'FILE_NOT_ALLOWED',
156
186
  });
157
187
  }
158
188
  return resolvedModule;
159
189
  }
160
190
  function getNotModifiedScript(record, options) {
161
- let current = getNotModifiedResult(record.emitted, options);
162
- if (current)
163
- return current;
191
+ if (hasHmrTimestampedDependency(record.resolved)) {
192
+ return null;
193
+ }
194
+ if (scriptStore.isEmittedFresh(record)) {
195
+ let current = getNotModifiedResult(record.emitted, options);
196
+ if (current)
197
+ return current;
198
+ }
164
199
  if (!record.staleEmittedSnapshot || !isModuleSnapshotFresh(record.staleEmittedSnapshot)) {
165
200
  return null;
166
201
  }
@@ -170,7 +205,7 @@ export function createScriptCompiler(options) {
170
205
  return mapWithConcurrency(records, preloadConcurrency, (record) => getOrCreateResolvedScript(record));
171
206
  }
172
207
  async function getOrCreateResolvedScript(record) {
173
- if (record.resolved)
208
+ if (record.resolved && scriptStore.isResolvedFresh(record))
174
209
  return record.resolved;
175
210
  let cacheKey = getRecordCacheKey(record);
176
211
  let existing = resolveInFlightByCacheKey.get(cacheKey);
@@ -207,8 +242,16 @@ export function createScriptCompiler(options) {
207
242
  }
208
243
  }
209
244
  }
245
+ async function tryGetOrCreateResolvedScript(record) {
246
+ try {
247
+ return await getOrCreateResolvedScript(record);
248
+ }
249
+ catch {
250
+ return undefined;
251
+ }
252
+ }
210
253
  async function getOrCreateTransformedScript(record) {
211
- if (record.transformed)
254
+ if (record.transformed && scriptStore.isTransformedFresh(record))
212
255
  return record.transformed;
213
256
  let startedVersion = record.invalidationVersion;
214
257
  let transformModuleResult = await transformModule(record, transformArgs);
@@ -226,8 +269,11 @@ export function createScriptCompiler(options) {
226
269
  return transformModuleResult.value;
227
270
  }
228
271
  async function getOrCreateEmittedScript(record) {
229
- if (record.emitted)
272
+ if (record.emitted &&
273
+ scriptStore.isEmittedFresh(record) &&
274
+ !hasHmrTimestampedDependency(record.resolved)) {
230
275
  return record.emitted;
276
+ }
231
277
  let cacheKey = getRecordCacheKey(record);
232
278
  let existing = emitInFlightByCacheKey.get(cacheKey);
233
279
  if (existing)
@@ -237,6 +283,9 @@ export function createScriptCompiler(options) {
237
283
  let resolvedModule = await getOrCreateResolvedScript(record);
238
284
  let emitResolvedModuleResult = await emitResolvedModule(resolvedModule, {
239
285
  getServedUrl,
286
+ getStableUrl,
287
+ getHmrImportTimestamp,
288
+ hmrClientPathname: resolvedOptions.hmr?.clientPathname,
240
289
  sourceMaps: resolvedOptions.sourceMaps,
241
290
  });
242
291
  if (!emitResolvedModuleResult.ok) {
@@ -263,10 +312,115 @@ export function createScriptCompiler(options) {
263
312
  function getServedUrlForResolvedScript(resolvedModule) {
264
313
  return formatFingerprintedPathname(resolvedModule.stableUrlPathname, resolvedOptions.fingerprintAssets ? resolvedModule.fingerprint : null);
265
314
  }
315
+ function getStableUrl(identityPath) {
316
+ let stableUrlPathname = resolvedOptions.routes.toUrlPathname(identityPath);
317
+ if (!stableUrlPathname) {
318
+ throw createAssetServerCompilationError(`File ${identityPath} is outside all configured fileMap entries.`, {
319
+ code: 'FILE_OUTSIDE_FILE_MAP',
320
+ });
321
+ }
322
+ return stableUrlPathname;
323
+ }
324
+ function getHmrImportTimestamp(identityPath) {
325
+ return scriptStore.getHmrUpdateTimestamp(identityPath) ?? null;
326
+ }
327
+ function hasHmrTimestampedDependency(resolvedModule) {
328
+ return resolvedModule?.deps.some((depPath) => getHmrImportTimestamp(depPath) !== null) === true;
329
+ }
330
+ function getHmrUpdatesForChange(resolvedModule, previousResolvedModule, updatePathname, timestamp) {
331
+ if (resolvedModule) {
332
+ scriptStore.setHmrUpdateTimestamp(resolvedModule.identityPath, timestamp);
333
+ }
334
+ if (resolvedModule?.hmr.selfAccepting === true) {
335
+ return [
336
+ {
337
+ accepted: true,
338
+ acceptedPath: updatePathname,
339
+ filePath: resolvedModule.identityPath,
340
+ path: updatePathname,
341
+ timestamp,
342
+ },
343
+ ];
344
+ }
345
+ let sourceFilePath = resolvedModule?.identityPath;
346
+ let boundaries = findHmrBoundaries(sourceFilePath);
347
+ if (sourceFilePath !== undefined && boundaries) {
348
+ return dedupeHmrBoundaries(boundaries).map(({ acceptedModule, boundaryModule }) => ({
349
+ accepted: true,
350
+ acceptedPath: acceptedModule.stableUrlPathname,
351
+ filePath: sourceFilePath,
352
+ path: boundaryModule.stableUrlPathname,
353
+ timestamp,
354
+ }));
355
+ }
356
+ return [
357
+ {
358
+ accepted: false,
359
+ filePath: resolvedModule?.identityPath ?? previousResolvedModule?.identityPath ?? updatePathname,
360
+ path: updatePathname,
361
+ timestamp,
362
+ },
363
+ ];
364
+ }
365
+ function findHmrBoundaries(identityPath) {
366
+ if (identityPath === undefined)
367
+ return null;
368
+ return propagateHmrUpdate(identityPath, new Set());
369
+ }
370
+ function propagateHmrUpdate(identityPath, traversed) {
371
+ if (traversed.has(identityPath))
372
+ return [];
373
+ traversed.add(identityPath);
374
+ let resolvedModule = scriptStore.getLastResolved(identityPath);
375
+ if (!resolvedModule)
376
+ return null;
377
+ if (resolvedModule.hmr.selfAccepting) {
378
+ return [
379
+ {
380
+ acceptedModule: resolvedModule,
381
+ boundaryModule: resolvedModule,
382
+ },
383
+ ];
384
+ }
385
+ let importerPaths = scriptStore.getImporters(identityPath);
386
+ if (!importerPaths || importerPaths.size === 0)
387
+ return null;
388
+ let acceptedImporterPaths = scriptStore.getAcceptedImporters(identityPath);
389
+ let boundaries = [];
390
+ for (let importerPath of importerPaths) {
391
+ let importer = scriptStore.getLastResolved(importerPath);
392
+ if (!importer)
393
+ return null;
394
+ if (acceptedImporterPaths?.has(importerPath)) {
395
+ boundaries.push({
396
+ acceptedModule: resolvedModule,
397
+ boundaryModule: importer,
398
+ });
399
+ continue;
400
+ }
401
+ let importerBoundaries = propagateHmrUpdate(importerPath, traversed);
402
+ if (!importerBoundaries)
403
+ return null;
404
+ boundaries.push(...importerBoundaries);
405
+ }
406
+ return boundaries;
407
+ }
266
408
  function isWatchIgnored(filePath) {
267
409
  return resolvedOptions.watchIgnoreMatchers.some((matcher) => matcher(filePath));
268
410
  }
269
411
  }
412
+ function dedupeHmrBoundaries(boundaries) {
413
+ let seen = new Set();
414
+ let result = [];
415
+ for (let boundary of boundaries) {
416
+ let key = `${boundary.boundaryModule.identityPath}\0${boundary.acceptedModule.identityPath}`;
417
+ if (seen.has(key))
418
+ continue;
419
+ seen.add(key);
420
+ result.push(boundary);
421
+ }
422
+ return result;
423
+ }
270
424
  function getRecordCacheKey(record) {
271
425
  return `${record.identityPath}\0${record.invalidationVersion}`;
272
426
  }
@@ -0,0 +1,2 @@
1
+ export declare const scriptLoaderConditions: readonly ['browser', 'import', 'module', 'default'];
2
+ //# sourceMappingURL=conditions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["../../../src/lib/scripts/conditions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,YAAI,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAA"}
@@ -0,0 +1 @@
1
+ export const scriptLoaderConditions = ['browser', 'import', 'module', 'default'];
@@ -18,7 +18,10 @@ type EmitResult = {
18
18
  error: AssetServerCompilationError;
19
19
  };
20
20
  export declare function emitResolvedModule(resolvedModule: ResolvedModule, options: {
21
+ getHmrImportTimestamp(identityPath: string): number | null;
21
22
  getServedUrl(identityPath: string): Promise<string>;
23
+ getStableUrl(identityPath: string): string;
24
+ hmrClientPathname?: string;
22
25
  sourceMaps?: 'external' | 'inline';
23
26
  }): Promise<EmitResult>;
24
27
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../../src/lib/scripts/emit.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAElD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAA;AAE1E,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,YAAY,CAAA;IAClB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,SAAS,EAAE,YAAY,GAAG,IAAI,CAAA;CAC/B,CAAA;AAED,KAAK,UAAU,GACX;IACE,EAAE,EAAE,IAAI,CAAA;IACR,KAAK,EAAE,aAAa,CAAA;CACrB,GACD;IACE,EAAE,E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AAM,CAAA;IAC1B,UAAU,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAA;CACnC,GACA,OAAO,CAAC,UAAU,CAAC,CAkCrB"}
@@ -1,12 +1,12 @@
1
1
  import MagicString from 'magic-string';
2
- import { createAssetServerCompilationError, isAssetServerCompilationError, } from "../compilation-error.js";
3
- import { hashContent } from "../fingerprint.js";
4
- import { composeSourceMaps } from "../source-maps.js";
2
+ import { createAssetServerCompilationError, isAssetServerCompilationError, } from '../compilation-error.js';
3
+ import { hashContent } from '../fingerprint.js';
4
+ import { composeSourceMaps } from '../source-maps.js';
5
5
  export async function emitResolvedModule(resolvedModule, options) {
6
6
  try {
7
7
  let importUrls = await Promise.all(resolvedModule.deps.map((depPath) => options.getServedUrl(depPath)));
8
8
  let rewriteResult = await rewriteImports(resolvedModule, options);
9
- let finalCode = rewriteResult.code;
9
+ let finalCode = prependHmrContext(resolvedModule, rewriteResult.code, options);
10
10
  if (rewriteResult.sourceMap) {
11
11
  if (options.sourceMaps === 'inline') {
12
12
  let encoded = Buffer.from(rewriteResult.sourceMap).toString('base64');
@@ -39,14 +39,33 @@ async function rewriteImports(resolvedModule, options) {
39
39
  let rewrittenSource = new MagicString(resolvedModule.rawCode);
40
40
  for (let imported of resolvedModule.imports) {
41
41
  let url = await options.getServedUrl(imported.depPath);
42
+ let hmrImportTimestamp = options.getHmrImportTimestamp(imported.depPath);
43
+ if (hmrImportTimestamp !== null) {
44
+ url = addTimestampQuery(url, hmrImportTimestamp);
45
+ }
42
46
  rewrittenSource.overwrite(imported.start, imported.end, imported.quote ? `${imported.quote}${url}${imported.quote}` : url);
43
47
  }
48
+ for (let acceptedDep of resolvedModule.hmr.acceptedDeps) {
49
+ let url = options.getStableUrl(acceptedDep.depPath);
50
+ rewrittenSource.overwrite(acceptedDep.start, acceptedDep.end, acceptedDep.quote ? `${acceptedDep.quote}${url}${acceptedDep.quote}` : url);
51
+ }
44
52
  let code = rewrittenSource.toString();
45
- let sourceMap = resolvedModule.sourceMap && resolvedModule.imports.length > 0
53
+ let sourceMap = resolvedModule.sourceMap &&
54
+ (resolvedModule.imports.length > 0 || resolvedModule.hmr.acceptedDeps.length > 0)
46
55
  ? composeSourceMaps(rewrittenSource.generateMap({ hires: true }).toString(), resolvedModule.sourceMap)
47
56
  : resolvedModule.sourceMap;
48
57
  return { code, sourceMap };
49
58
  }
59
+ function addTimestampQuery(pathname, timestamp) {
60
+ return `${pathname}${pathname.includes('?') ? '&' : '?'}t=${timestamp}`;
61
+ }
62
+ function prependHmrContext(resolvedModule, code, options) {
63
+ if (!options.hmrClientPathname || !resolvedModule.hmr.usesImportMetaHot)
64
+ return code;
65
+ return (`import { createHotContext as __remixCreateHotContext } from ${JSON.stringify(options.hmrClientPathname)};\n` +
66
+ `import.meta.hot = __remixCreateHotContext(${JSON.stringify(resolvedModule.stableUrlPathname)});\n` +
67
+ code);
68
+ }
50
69
  async function createEmittedAsset(content) {
51
70
  return {
52
71
  content,
@@ -18,9 +18,13 @@ type ResolvedImport = {
18
18
  quote?: '"' | "'" | '`';
19
19
  start: number;
20
20
  };
21
+ type ResolvedHmrAcceptedDependency = ResolvedImport;
21
22
  export type ResolvedModule = {
22
23
  deps: string[];
23
24
  fingerprint: string | null;
25
+ hmr: Omit<TransformedModule['hmr'], 'acceptedDeps'> & {
26
+ acceptedDeps: ResolvedHmrAcceptedDependency[];
27
+ };
24
28
  identityPath: string;
25
29
  imports: ResolvedImport[];
26
30
  trackedFiles: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/lib/scripts/resolve.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAMnD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAA;AAM1E,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,c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A;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,GAAG,EAAE,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC,GAAG;QACpD,YAAY,EAAE,6BAA6B,EAAE,CAAA;KAC9C,CAAA;IACD,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,cAAc,EAAE,CAAA;IACzB,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,iBAAiB,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,cAAc,CAAA;CACzB,GAAG,CACA;IACE,EAAE,EAAE,IAAI,CAAA;IACR,KAAK,EAAE,cAAc,CAAA;CACtB,GACD;IACE,EAAE,EAAE,KAAK,CAAA;IACT,KAAK,EAAE,2BAA2B,CAAA;CACnC,CACJ,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAA;IACxC,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAA;IACzC,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI,CAAA;IACnE,eAAe,EAAE,eAAe,CAAA;IAChC,MAAM,EAAE,cAAc,CAAA;CACvB,CAAA;AAaD,wBAAsB,aAAa,CACjC,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,iBAAiB,EAC9B,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,aAAa,CAAC,CA2PxB"}
@@ -1,8 +1,8 @@
1
1
  import * as fs from 'node:fs';
2
2
  import * as path from 'node:path';
3
- import { createAssetServerCompilationError, isAssetServerCompilationError, } from "../compilation-error.js";
4
- import { getInjectedPackageNameForSpecifier, getInjectedPackageImporterPath, restoreAuthoredInjectedPackageSpecifier, } from "../injected-packages.js";
5
- import { normalizeFilePath } from "../paths.js";
3
+ import { createAssetServerCompilationError, isAssetServerCompilationError, } from '../compilation-error.js';
4
+ import { getInjectedPackageNameForSpecifier, getInjectedPackageImporterPath, restoreAuthoredInjectedPackageSpecifier, } from '../injected-packages.js';
5
+ import { normalizeFilePath } from '../paths.js';
6
6
  export const resolverExtensionAlias = {
7
7
  '.js': ['.js', '.ts', '.tsx', '.jsx'],
8
8
  '.jsx': ['.jsx', '.tsx'],
@@ -27,6 +27,7 @@ export async function resolveModule(record, transformed, args) {
27
27
  });
28
28
  }
29
29
  let importsWithPaths = [];
30
+ let acceptedDepsWithPaths = [];
30
31
  let deps = new Set();
31
32
  for (let unresolved of transformed.unresolvedImports) {
32
33
  let displaySpecifier = getDisplayImportSpecifier(unresolved.specifier);
@@ -46,8 +47,8 @@ export async function resolveModule(record, transformed, args) {
46
47
  }), trackedFiles, trackedResolutions, transformed.resolvedPath, { isWatchIgnored: args.isWatchIgnored, trackedResolution });
47
48
  }
48
49
  if (!args.isAllowed(resolvedImport.identityPath)) {
49
- return failResolve(createAssetServerCompilationError(`Import "${displaySpecifier}" in ${transformed.resolvedPath}, resolved to "${resolvedImport.identityPath}", is not allowed by the asset server allow/deny configuration. ` +
50
- `Add a matching allow rule for this file path, remove a conflicting deny rule for this file path, or mark this import as external.`, {
50
+ return failResolve(createAssetServerCompilationError(`Import "${displaySpecifier}" in ${transformed.resolvedPath}, resolved to "${resolvedImport.identityPath}", is not allowed by the asset server access configuration. ` +
51
+ `Add a matching allowFiles or allowPackages rule, remove a conflicting denyFiles rule, or mark this import as external.`, {
51
52
  code: 'IMPORT_NOT_ALLOWED',
52
53
  }), trackedFiles, trackedResolutions, transformed.resolvedPath, { isWatchIgnored: args.isWatchIgnored, trackedResolution });
53
54
  }
@@ -78,12 +79,73 @@ export async function resolveModule(record, transformed, args) {
78
79
  start: unresolved.start,
79
80
  });
80
81
  }
82
+ for (let unresolved of transformed.hmr.acceptedDeps) {
83
+ if (isBrowserExternalModuleUrl(unresolved.specifier))
84
+ continue;
85
+ let displaySpecifier = getDisplayImportSpecifier(unresolved.specifier);
86
+ let trackedResolution = getTrackedRelativeImportResolution(transformed.importerDir, displaySpecifier, args.isWatchIgnored);
87
+ let resolvedSpec = resolvedImports.get(unresolved.specifier);
88
+ if (!resolvedSpec?.absolutePath) {
89
+ try {
90
+ resolvedSpec = await batchResolveSpecifiers([unresolved.specifier], transformed.resolvedPath, args.resolverFactory).then((resolved) => resolved.get(unresolved.specifier));
91
+ }
92
+ catch (error) {
93
+ return failResolve(error, trackedFiles, trackedResolutions, transformed.resolvedPath, {
94
+ isWatchIgnored: args.isWatchIgnored,
95
+ trackedResolution,
96
+ });
97
+ }
98
+ }
99
+ if (!resolvedSpec?.absolutePath) {
100
+ return failResolve(createAssetServerCompilationError(`Failed to resolve accepted HMR dependency "${displaySpecifier}" in ${transformed.resolvedPath}. ` +
101
+ `Ensure it resolves to a file within the configured asset server fileMap, or mark it as external.`, {
102
+ code: 'IMPORT_RESOLUTION_FAILED',
103
+ }), trackedFiles, trackedResolutions, transformed.resolvedPath, { isWatchIgnored: args.isWatchIgnored, trackedResolution });
104
+ }
105
+ let resolvedImport = args.resolveModulePath(resolvedSpec.absolutePath);
106
+ if (!resolvedImport) {
107
+ return failResolve(createAssetServerCompilationError(`Accepted HMR dependency "${displaySpecifier}" in ${transformed.resolvedPath}, resolved to "${resolvedSpec.absolutePath}", is not a supported script file. ` +
108
+ `Supported extensions are ${supportedScriptExtensions.join(', ')}.`, {
109
+ code: 'IMPORT_NOT_SUPPORTED',
110
+ }), trackedFiles, trackedResolutions, transformed.resolvedPath, { isWatchIgnored: args.isWatchIgnored, trackedResolution });
111
+ }
112
+ if (!args.isAllowed(resolvedImport.identityPath)) {
113
+ return failResolve(createAssetServerCompilationError(`Accepted HMR dependency "${displaySpecifier}" in ${transformed.resolvedPath}, resolved to "${resolvedImport.identityPath}", is not allowed by the asset server allow/deny configuration. ` +
114
+ `Add a matching allow rule for this file path, remove a conflicting deny rule for this file path, or mark this import as external.`, {
115
+ code: 'IMPORT_NOT_ALLOWED',
116
+ }), trackedFiles, trackedResolutions, transformed.resolvedPath, { isWatchIgnored: args.isWatchIgnored, trackedResolution });
117
+ }
118
+ let stableUrlPathname = args.routes.toUrlPathname(resolvedImport.identityPath);
119
+ if (!stableUrlPathname) {
120
+ return failResolve(createAssetServerCompilationError(`Accepted HMR dependency "${displaySpecifier}" in ${transformed.resolvedPath}, resolved to "${resolvedImport.identityPath}", is outside all configured fileMap entries. ` +
121
+ `Add a matching fileMap entry for this file path, or mark this import as external.`, {
122
+ code: 'IMPORT_OUTSIDE_FILE_MAP',
123
+ }), trackedFiles, trackedResolutions, transformed.resolvedPath, { isWatchIgnored: args.isWatchIgnored, trackedResolution });
124
+ }
125
+ if (trackedResolution) {
126
+ trackedResolutions.push({
127
+ ...trackedResolution,
128
+ resolvedIdentityPath: resolvedImport.identityPath,
129
+ });
130
+ }
131
+ acceptedDepsWithPaths.push({
132
+ depPath: resolvedImport.identityPath,
133
+ end: unresolved.end,
134
+ quote: unresolved.quote,
135
+ start: unresolved.start,
136
+ });
137
+ }
81
138
  return {
82
139
  ok: true,
83
140
  tracking: toResolveTracking(trackedFiles, trackedResolutions),
84
141
  value: {
85
142
  deps: [...deps],
86
143
  fingerprint: transformed.fingerprint,
144
+ hmr: {
145
+ acceptedDeps: acceptedDepsWithPaths,
146
+ selfAccepting: transformed.hmr.selfAccepting,
147
+ usesImportMetaHot: transformed.hmr.usesImportMetaHot,
148
+ },
87
149
  identityPath: record.identityPath,
88
150
  imports: importsWithPaths,
89
151
  trackedFiles: [...trackedFiles],
@@ -226,6 +288,9 @@ function normalizeSpecifierResolution(specifier, importerPath) {
226
288
  function getDisplayImportSpecifier(specifier) {
227
289
  return restoreAuthoredInjectedPackageSpecifier(specifier) ?? specifier;
228
290
  }
291
+ function isBrowserExternalModuleUrl(url) {
292
+ return url.startsWith('data:') || url.startsWith('http://') || url.startsWith('https://');
293
+ }
229
294
  function failResolve(error, trackedFiles, trackedResolutions, importerPath, options = {}) {
230
295
  return {
231
296
  ok: false,
@@ -1,6 +1,7 @@
1
1
  import type { TsConfigJsonResolved } from 'get-tsconfig';
2
2
  import type { AssetServerCompilationError } from '../compilation-error.ts';
3
3
  import type { ModuleRecord, ModuleTracking } from '../module-store.ts';
4
+ import type { ModuleLoader } from '../loaders.ts';
4
5
  import type { CompiledRoutes } from '../routes.ts';
5
6
  import type { EmittedModule } from './emit.ts';
6
7
  import type { ResolvedScriptTarget } from '../target.ts';
@@ -16,8 +17,14 @@ type UnresolvedImport = {
16
17
  specifier: string;
17
18
  start: number;
18
19
  };
20
+ type HmrAcceptedDependency = UnresolvedImport;
19
21
  export type TransformedModule = {
20
22
  fingerprint: string | null;
23
+ hmr: {
24
+ acceptedDeps: HmrAcceptedDependency[];
25
+ selfAccepting: boolean;
26
+ usesImportMetaHot: boolean;
27
+ };
21
28
  identityPath: string;
22
29
  importerDir: string;
23
30
  packageSpecifiers: string[];
@@ -48,6 +55,7 @@ export type TransformArgs = {
48
55
  externalSet: ReadonlySet<string>;
49
56
  isWatchIgnored(filePath: string): boolean;
50
57
  minify: boolean;
58
+ loaders: readonly ModuleLoader[];
51
59
  resolveActualPath(identityPath: string): string | null;
52
60
  routes: CompiledRoutes;
53
61
  sourceMapSourcePaths: 'absolute' | 'url';
@@ -60,5 +68,6 @@ export declare function createTsconfigTransformOptionsResolver(): {
60
68
  getTransformOptions(filePath: string, isWatchIgnored: (filePath: string) => boolean): TsconfigTransformOptions;
61
69
  };
62
70
  export declare function transformModule(record: ScriptRecord, args: TransformArgs): Promise<TransformResult>;
71
+ export declare function getHmrAnalysis(rawCode: string): TransformedModule['hmr'];
63
72
  export {};
64
73
  //# sourceMappingURL=transform.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/lib/scripts/transform.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAS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