@remix-run/assets 0.5.0 → 0.7.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.
- package/README.md +185 -104
- package/dist/assets.d.ts +4 -1
- package/dist/assets.d.ts.map +1 -1
- package/dist/lib/access.d.ts +29 -2
- package/dist/lib/access.d.ts.map +1 -1
- package/dist/lib/access.js +52 -26
- package/dist/lib/asset-server.d.ts +61 -25
- package/dist/lib/asset-server.d.ts.map +1 -1
- package/dist/lib/asset-server.js +127 -55
- package/dist/lib/compilation-error.d.ts +1 -1
- package/dist/lib/compilation-error.d.ts.map +1 -1
- package/dist/lib/files/compiler.d.ts +1 -1
- package/dist/lib/files/compiler.d.ts.map +1 -1
- package/dist/lib/files/compiler.js +28 -31
- package/dist/lib/files/config.d.ts +6 -0
- package/dist/lib/files/config.d.ts.map +1 -1
- package/dist/lib/files/config.js +9 -0
- package/dist/lib/fingerprint.d.ts +0 -4
- package/dist/lib/fingerprint.d.ts.map +1 -1
- package/dist/lib/fingerprint.js +0 -4
- package/dist/lib/hmr.d.ts +7 -0
- package/dist/lib/hmr.d.ts.map +1 -1
- package/dist/lib/hmr.js +198 -25
- package/dist/lib/injected-packages.d.ts +3 -2
- package/dist/lib/injected-packages.d.ts.map +1 -1
- package/dist/lib/injected-packages.js +11 -8
- package/dist/lib/inspection.d.ts +39 -0
- package/dist/lib/inspection.d.ts.map +1 -0
- package/dist/lib/inspection.js +160 -0
- package/dist/lib/routes.d.ts +12 -3
- package/dist/lib/routes.d.ts.map +1 -1
- package/dist/lib/routes.js +124 -80
- package/dist/lib/scripts/compiler.d.ts +8 -2
- package/dist/lib/scripts/compiler.d.ts.map +1 -1
- package/dist/lib/scripts/compiler.js +188 -38
- package/dist/lib/scripts/emit.d.ts +2 -1
- package/dist/lib/scripts/emit.d.ts.map +1 -1
- package/dist/lib/scripts/emit.js +25 -16
- package/dist/lib/scripts/resolve.d.ts +7 -1
- package/dist/lib/scripts/resolve.d.ts.map +1 -1
- package/dist/lib/scripts/resolve.js +119 -12
- package/dist/lib/scripts/specifiers.d.ts +2 -0
- package/dist/lib/scripts/specifiers.d.ts.map +1 -0
- package/dist/lib/scripts/specifiers.js +9 -0
- package/dist/lib/scripts/transform.d.ts +2 -3
- package/dist/lib/scripts/transform.d.ts.map +1 -1
- package/dist/lib/scripts/transform.js +4 -18
- package/dist/lib/styles/compiler.d.ts +0 -1
- package/dist/lib/styles/compiler.d.ts.map +1 -1
- package/dist/lib/styles/compiler.js +105 -25
- package/dist/lib/styles/emit.d.ts +2 -1
- package/dist/lib/styles/emit.d.ts.map +1 -1
- package/dist/lib/styles/emit.js +12 -10
- package/dist/lib/styles/resolve.d.ts +0 -1
- package/dist/lib/styles/resolve.d.ts.map +1 -1
- package/dist/lib/styles/resolve.js +8 -9
- package/dist/lib/styles/transform.d.ts +0 -2
- package/dist/lib/styles/transform.d.ts.map +1 -1
- package/dist/lib/styles/transform.js +2 -9
- package/dist/lib/virtual-store.d.ts +8 -0
- package/dist/lib/virtual-store.d.ts.map +1 -0
- package/dist/lib/virtual-store.js +100 -0
- package/package.json +6 -6
- package/src/assets.ts +9 -1
- package/src/lib/access.ts +83 -30
- package/src/lib/asset-server.ts +224 -94
- package/src/lib/compilation-error.ts +4 -3
- package/src/lib/files/compiler.ts +32 -42
- package/src/lib/files/config.ts +17 -0
- package/src/lib/fingerprint.ts +0 -9
- package/src/lib/hmr.ts +210 -26
- package/src/lib/injected-packages.ts +16 -10
- package/src/lib/inspection.ts +229 -0
- package/src/lib/routes.ts +158 -126
- package/src/lib/scripts/compiler.ts +240 -54
- package/src/lib/scripts/emit.ts +34 -19
- package/src/lib/scripts/resolve.ts +175 -13
- package/src/lib/scripts/specifiers.ts +11 -0
- package/src/lib/scripts/transform.ts +6 -25
- package/src/lib/styles/compiler.ts +137 -39
- package/src/lib/styles/emit.ts +18 -13
- package/src/lib/styles/resolve.ts +8 -10
- package/src/lib/styles/transform.ts +2 -12
- package/src/lib/virtual-store.ts +124 -0
package/dist/lib/access.js
CHANGED
|
@@ -15,9 +15,15 @@ const packageStateFileNames = new Set([
|
|
|
15
15
|
const packageManagerRootFileNames = packageStateFileNames;
|
|
16
16
|
const packageNamePartPattern = /^[A-Za-z0-9._~-]+$/;
|
|
17
17
|
export function createAccessPolicy(options) {
|
|
18
|
-
let allowMatchers = options.allowFiles.map((pattern) =>
|
|
18
|
+
let allowMatchers = options.allowFiles.map((pattern) => ({
|
|
19
|
+
matcher: createFileMatcher(pattern, options.rootDir),
|
|
20
|
+
pattern,
|
|
21
|
+
}));
|
|
19
22
|
let allowPackageNames = normalizePackageNames(options.allowPackages, 'allowPackages');
|
|
20
|
-
let denyMatchers = (options.denyFiles ?? []).map((pattern) =>
|
|
23
|
+
let denyMatchers = (options.denyFiles ?? []).map((pattern) => ({
|
|
24
|
+
matcher: createFileMatcher(pattern, options.rootDir),
|
|
25
|
+
pattern,
|
|
26
|
+
}));
|
|
21
27
|
let packageSearchRoots = [options.rootDir, ...(options.packageSearchRoots ?? [])];
|
|
22
28
|
let packageRootPaths = createPackageRootPaths({
|
|
23
29
|
allowPackageNames,
|
|
@@ -36,13 +42,40 @@ export function createAccessPolicy(options) {
|
|
|
36
42
|
allowPackageRootPathTrie = createPackageRootPathTrie(packageRootPaths);
|
|
37
43
|
packageRootsDirty = false;
|
|
38
44
|
}
|
|
39
|
-
function
|
|
45
|
+
function getAllowedPackageName(filePath) {
|
|
40
46
|
if (allowPackageNames.size === 0)
|
|
41
|
-
return
|
|
47
|
+
return undefined;
|
|
42
48
|
refreshPackageRootPathTries();
|
|
43
|
-
return
|
|
49
|
+
return getPackageNameFromRootPathTrie(filePath, allowPackageRootPathTrie);
|
|
50
|
+
}
|
|
51
|
+
function inspect(filePath) {
|
|
52
|
+
if (isInjectedPackageFilePath(filePath)) {
|
|
53
|
+
return { allowed: true, allowedBy: { kind: 'injected', value: '@remix-run/assets' } };
|
|
54
|
+
}
|
|
55
|
+
let allowedBy;
|
|
56
|
+
let allowMatch = allowMatchers.find(({ matcher }) => matcher(filePath));
|
|
57
|
+
if (allowMatch) {
|
|
58
|
+
allowedBy = { kind: 'file', value: allowMatch.pattern };
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
let packageName = getAllowedPackageName(filePath);
|
|
62
|
+
if (packageName !== undefined) {
|
|
63
|
+
allowedBy = { kind: 'package', value: packageName };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (!allowedBy)
|
|
67
|
+
return { allowed: false };
|
|
68
|
+
let denyMatch = denyMatchers.find(({ matcher }) => matcher(filePath));
|
|
69
|
+
if (denyMatch) {
|
|
70
|
+
return { allowed: false, allowedBy, deniedBy: denyMatch.pattern };
|
|
71
|
+
}
|
|
72
|
+
return { allowed: true, allowedBy };
|
|
44
73
|
}
|
|
45
74
|
return {
|
|
75
|
+
getAllowedPackageRoots() {
|
|
76
|
+
refreshPackageRootPathTries();
|
|
77
|
+
return [...packageRootPaths.keys()];
|
|
78
|
+
},
|
|
46
79
|
getPackageWatchDirectories() {
|
|
47
80
|
if (allowPackageNames.size === 0)
|
|
48
81
|
return [];
|
|
@@ -55,15 +88,9 @@ export function createAccessPolicy(options) {
|
|
|
55
88
|
return;
|
|
56
89
|
packageRootsDirty = true;
|
|
57
90
|
},
|
|
91
|
+
inspect,
|
|
58
92
|
isAllowed(filePath) {
|
|
59
|
-
|
|
60
|
-
return true;
|
|
61
|
-
if (!allowMatchers.some((matcher) => matcher(filePath)) && !isAllowedPackage(filePath)) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
if (denyMatchers.length > 0 && denyMatchers.some((matcher) => matcher(filePath)))
|
|
65
|
-
return false;
|
|
66
|
-
return true;
|
|
93
|
+
return inspect(filePath).allowed;
|
|
67
94
|
},
|
|
68
95
|
};
|
|
69
96
|
}
|
|
@@ -87,7 +114,7 @@ function validatePackageName(packageName, message) {
|
|
|
87
114
|
}
|
|
88
115
|
}
|
|
89
116
|
function createPackageRootPaths(options) {
|
|
90
|
-
let allowPackageRootPaths = new
|
|
117
|
+
let allowPackageRootPaths = new Map();
|
|
91
118
|
let allowQueue = [];
|
|
92
119
|
let seenAllowedPackageRoots = new Set();
|
|
93
120
|
let searchRoots = normalizePackageSearchRoots(options.searchRoots);
|
|
@@ -105,13 +132,13 @@ function createPackageRootPaths(options) {
|
|
|
105
132
|
}
|
|
106
133
|
}
|
|
107
134
|
while (allowQueue.length > 0) {
|
|
108
|
-
let { packageJsonPath } = allowQueue.shift();
|
|
135
|
+
let { packageJsonPath, packageName } = allowQueue.shift();
|
|
109
136
|
let packageRootPath = normalizeFilePath(path.dirname(packageJsonPath));
|
|
110
137
|
if (seenAllowedPackageRoots.has(packageRootPath))
|
|
111
138
|
continue;
|
|
112
139
|
seenAllowedPackageRoots.add(packageRootPath);
|
|
113
140
|
let packageJson = readPackageJson(packageJsonPath);
|
|
114
|
-
allowPackageRootPaths.
|
|
141
|
+
allowPackageRootPaths.set(packageRootPath, packageName);
|
|
115
142
|
for (let dependencyName of Object.keys(packageJson.dependencies ?? {})) {
|
|
116
143
|
validatePackageName(dependencyName, `Dependency "${dependencyName}" from ${packageJsonPath} must be a package name.`);
|
|
117
144
|
let dependencyPackageJsonPath = findPackageJsonPath(dependencyName, packageRootPath);
|
|
@@ -138,7 +165,7 @@ function createPackageRootPaths(options) {
|
|
|
138
165
|
}
|
|
139
166
|
function createPackageRootPathTrie(packageRootPaths) {
|
|
140
167
|
let rootNode = createPackageRootPathTrieNode();
|
|
141
|
-
for (let packageRootPath of packageRootPaths) {
|
|
168
|
+
for (let [packageRootPath, packageName] of packageRootPaths) {
|
|
142
169
|
let node = rootNode;
|
|
143
170
|
for (let segment of getFilePathSegments(packageRootPath)) {
|
|
144
171
|
let childNode = node.children.get(segment);
|
|
@@ -148,29 +175,28 @@ function createPackageRootPathTrie(packageRootPaths) {
|
|
|
148
175
|
}
|
|
149
176
|
node = childNode;
|
|
150
177
|
}
|
|
151
|
-
node.
|
|
178
|
+
node.packageName = packageName;
|
|
152
179
|
}
|
|
153
180
|
return rootNode;
|
|
154
181
|
}
|
|
155
182
|
function createPackageRootPathTrieNode() {
|
|
156
183
|
return {
|
|
157
184
|
children: new Map(),
|
|
158
|
-
packageRoot: false,
|
|
159
185
|
};
|
|
160
186
|
}
|
|
161
|
-
function
|
|
187
|
+
function getPackageNameFromRootPathTrie(filePath, trie) {
|
|
162
188
|
let node = trie;
|
|
163
|
-
if (node.
|
|
164
|
-
return
|
|
189
|
+
if (node.packageName !== undefined)
|
|
190
|
+
return node.packageName;
|
|
165
191
|
for (let segment of getFilePathSegments(filePath)) {
|
|
166
192
|
let childNode = node.children.get(segment);
|
|
167
193
|
if (!childNode)
|
|
168
|
-
return
|
|
169
|
-
if (childNode.
|
|
170
|
-
return
|
|
194
|
+
return undefined;
|
|
195
|
+
if (childNode.packageName !== undefined)
|
|
196
|
+
return childNode.packageName;
|
|
171
197
|
node = childNode;
|
|
172
198
|
}
|
|
173
|
-
return
|
|
199
|
+
return undefined;
|
|
174
200
|
}
|
|
175
201
|
function getFilePathSegments(filePath) {
|
|
176
202
|
return normalizeFilePath(filePath).split('/');
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { AssetRequestTransformMap, AssetServerFilesOptions, AssetTransformInvocation } from './files/config.ts';
|
|
2
2
|
import type { HmrPayload } from './hmr.ts';
|
|
3
3
|
import type { ModuleLoader } from './loaders.ts';
|
|
4
|
-
import type { ScriptHmrUpdate } from './scripts/compiler.ts';
|
|
4
|
+
import type { ScriptHmrUpdate, ScriptImportMap } from './scripts/compiler.ts';
|
|
5
5
|
import type { AssetTarget } from './target.ts';
|
|
6
|
+
import { type AssetDetails } from './inspection.ts';
|
|
6
7
|
import type { ChokidarWatcher } from './watch.ts';
|
|
7
8
|
interface AssetServerWatchOptions {
|
|
8
9
|
/**
|
|
@@ -56,6 +57,17 @@ export interface BrowserHmrChannel {
|
|
|
56
57
|
* @returns A channel, no channel, or a promise for either result.
|
|
57
58
|
*/
|
|
58
59
|
export type BrowserHmrChannelFactory = () => BrowserHmrChannel | undefined | Promise<BrowserHmrChannel | undefined>;
|
|
60
|
+
/** Browser HMR integration options. */
|
|
61
|
+
export interface BrowserHmrOptions {
|
|
62
|
+
/** Creates the channel that delivers browser HMR events. */
|
|
63
|
+
channel: BrowserHmrChannelFactory;
|
|
64
|
+
/**
|
|
65
|
+
* Module specifier resolved relative to the asset server's root directory. It must point to a
|
|
66
|
+
* browser module exporting `importModule(specifier, parentUrl)` for evaluating JavaScript updates.
|
|
67
|
+
* The module and its dependencies must be allowed and reachable through configured mounts.
|
|
68
|
+
*/
|
|
69
|
+
moduleImporter?: string;
|
|
70
|
+
}
|
|
59
71
|
/**
|
|
60
72
|
* Converts a watcher batch into ordered browser update or reload events.
|
|
61
73
|
*
|
|
@@ -85,38 +97,30 @@ export type BrowserHmrFileEvent = {
|
|
|
85
97
|
* Browser HMR event emitted to connected clients.
|
|
86
98
|
*/
|
|
87
99
|
export type BrowserHmrEvent = {
|
|
100
|
+
/** Consumer-owned data keyed by a stable, versioned namespace. */
|
|
101
|
+
data: Record<string, BrowserHmrData>;
|
|
88
102
|
/** Absolute source file paths that triggered this update. */
|
|
89
103
|
files?: string[];
|
|
90
|
-
/** Update time used to bypass browser module and stylesheet caches. */
|
|
91
|
-
timestamp: number;
|
|
92
104
|
/** Browser update event. */
|
|
93
105
|
type: 'update';
|
|
94
|
-
/** Accepted JavaScript and CSS module updates for the browser to apply in place. */
|
|
95
|
-
updates: Extract<HmrPayload, {
|
|
96
|
-
type: 'browser:update';
|
|
97
|
-
}>['updates'];
|
|
98
106
|
} | {
|
|
99
107
|
/** Absolute source file paths that could not be handled in place. */
|
|
100
108
|
files?: string[];
|
|
101
109
|
/** Browser reload event. */
|
|
102
110
|
type: 'reload';
|
|
103
111
|
};
|
|
104
|
-
interface FingerprintOptions {
|
|
105
|
-
/**
|
|
106
|
-
* Per-build invalidation token that must change whenever fingerprinted asset URLs
|
|
107
|
-
* should be invalidated together.
|
|
108
|
-
*/
|
|
109
|
-
buildId: string;
|
|
110
|
-
}
|
|
111
112
|
type AssetSourceMaps = 'inline' | 'external';
|
|
112
113
|
type AssetSourceMapSourcePaths = 'url' | 'absolute';
|
|
114
|
+
type BrowserHmrData = null | boolean | number | string | BrowserHmrData[] | {
|
|
115
|
+
[key: string]: BrowserHmrData;
|
|
116
|
+
};
|
|
113
117
|
interface AssetServerScriptOptions {
|
|
114
118
|
/**
|
|
115
119
|
* Replace global expressions with constant values during transform, e.g.
|
|
116
120
|
* `{ 'process.env.NODE_ENV': '"production"' }`
|
|
117
121
|
*/
|
|
118
122
|
define?: Record<string, string>;
|
|
119
|
-
/** Import specifiers to
|
|
123
|
+
/** Import specifiers to treat as external dependencies (CDN URLs, import map entries, etc.) */
|
|
120
124
|
external?: string[];
|
|
121
125
|
/**
|
|
122
126
|
* Synchronous loaders that post-process compiled JavaScript.
|
|
@@ -135,8 +139,14 @@ interface AssetServerScriptOptions {
|
|
|
135
139
|
export interface AssetServerOptions<transforms extends AssetRequestTransformMap = {}> {
|
|
136
140
|
/** Public mount path for this asset server, e.g. `'/assets'`. */
|
|
137
141
|
basePath: string;
|
|
138
|
-
/**
|
|
139
|
-
|
|
142
|
+
/**
|
|
143
|
+
* Directories to mount at public URL paths.
|
|
144
|
+
*
|
|
145
|
+
* Each key is a public URL path and its value is a directory relative to `rootDir`. Defaults to
|
|
146
|
+
* `{ app: 'app', npm: 'node_modules' }`. Public paths must not contain query strings, fragments,
|
|
147
|
+
* or encoded dot segments.
|
|
148
|
+
*/
|
|
149
|
+
mounts?: Readonly<Record<string, string>>;
|
|
140
150
|
/**
|
|
141
151
|
* Root directory used to resolve relative file paths. Defaults to `process.cwd()`.
|
|
142
152
|
*/
|
|
@@ -147,7 +157,7 @@ export interface AssetServerOptions<transforms extends AssetRequestTransformMap
|
|
|
147
157
|
allowFiles: readonly string[];
|
|
148
158
|
/**
|
|
149
159
|
* Exact package names whose files are allowed to be served. Dependencies and installed optional
|
|
150
|
-
* dependencies are allowed automatically. Package files must still
|
|
160
|
+
* dependencies are allowed automatically. Package files must still be within a configured mount.
|
|
151
161
|
*/
|
|
152
162
|
allowPackages?: readonly string[];
|
|
153
163
|
/**
|
|
@@ -155,12 +165,12 @@ export interface AssetServerOptions<transforms extends AssetRequestTransformMap
|
|
|
155
165
|
*/
|
|
156
166
|
denyFiles?: readonly string[];
|
|
157
167
|
/**
|
|
158
|
-
* Controls optional
|
|
168
|
+
* Controls optional content-based URL fingerprinting for served asset URLs.
|
|
159
169
|
*
|
|
160
170
|
* When omitted, all served assets use stable non-fingerprinted URLs with `Cache-Control: no-cache`.
|
|
161
171
|
* Cannot be used together with active watch mode. Set `watch: false` when fingerprinting.
|
|
162
172
|
*/
|
|
163
|
-
fingerprint?:
|
|
173
|
+
fingerprint?: boolean;
|
|
164
174
|
/**
|
|
165
175
|
* Shared compatibility target for scripts and styles. Browser targets apply to both
|
|
166
176
|
* pipelines, and `es` only affects scripts.
|
|
@@ -198,7 +208,7 @@ export interface AssetServerOptions<transforms extends AssetRequestTransformMap
|
|
|
198
208
|
* HMR requires `watch` to be enabled. The factory is called once for this asset server. Returning
|
|
199
209
|
* `undefined` leaves HMR inactive; a returned channel is closed by `assetServer.close()`.
|
|
200
210
|
*/
|
|
201
|
-
hmr?: BrowserHmrChannelFactory;
|
|
211
|
+
hmr?: BrowserHmrChannelFactory | BrowserHmrOptions;
|
|
202
212
|
/**
|
|
203
213
|
* Enable filesystem-backed cache invalidation for long-lived server instances.
|
|
204
214
|
* Enabled by default. Pass `true` to use the default watcher options, an options
|
|
@@ -219,6 +229,17 @@ type AssetServerCreateOptions<transforms extends AssetRequestTransformMap> = Omi
|
|
|
219
229
|
export type AssetServerGetHrefOptions<transforms extends AssetRequestTransformMap> = undefined | {
|
|
220
230
|
transform: readonly AssetTransformInvocation<transforms>[];
|
|
221
231
|
};
|
|
232
|
+
/**
|
|
233
|
+
* Metadata needed to render or load a script entry module.
|
|
234
|
+
*/
|
|
235
|
+
export interface ScriptEntry {
|
|
236
|
+
/** Public URL for the script entry module. */
|
|
237
|
+
href: string;
|
|
238
|
+
/** Public URLs that should be emitted as `modulepreload` hints for this script graph. */
|
|
239
|
+
preloads: string[];
|
|
240
|
+
/** Import map entries required to resolve this script graph in the browser. */
|
|
241
|
+
importMap: ScriptImportMap;
|
|
242
|
+
}
|
|
222
243
|
/**
|
|
223
244
|
* Serves compiled scripts and styles for asset requests routed to it.
|
|
224
245
|
* Construct with {@link createAssetServer}.
|
|
@@ -233,10 +254,28 @@ export interface AssetServer<transforms extends AssetRequestTransformMap = {}> {
|
|
|
233
254
|
* Returns the request href for a served asset file.
|
|
234
255
|
*/
|
|
235
256
|
getHref(filePath: string, options?: AssetServerGetHrefOptions<transforms>): Promise<string>;
|
|
257
|
+
/**
|
|
258
|
+
* Returns the href, preload URLs, and import map for a script entry module.
|
|
259
|
+
*/
|
|
260
|
+
getScriptEntry(filePath: string): Promise<ScriptEntry>;
|
|
236
261
|
/**
|
|
237
262
|
* Returns preload URLs for one or more served asset files, ordered shallowest-first.
|
|
238
263
|
*/
|
|
239
264
|
getPreloads(filePath: string | readonly string[]): Promise<string[]>;
|
|
265
|
+
/**
|
|
266
|
+
* Returns an import map for one or more script entry modules.
|
|
267
|
+
*/
|
|
268
|
+
getImportMap(filePath: string | readonly string[]): Promise<ScriptImportMap>;
|
|
269
|
+
/**
|
|
270
|
+
* Returns diagnostic details about one public asset URL or file path, including the matched mount
|
|
271
|
+
* roots, access rules, file type, and browser-reachability status.
|
|
272
|
+
*/
|
|
273
|
+
getAssetDetails(input: string): Promise<AssetDetails>;
|
|
274
|
+
/**
|
|
275
|
+
* Returns every file currently reachable through this asset server, sorted by public URL and
|
|
276
|
+
* then absolute file path.
|
|
277
|
+
*/
|
|
278
|
+
getAssets(): Promise<AssetDetails[]>;
|
|
240
279
|
/**
|
|
241
280
|
* Closes this server's filesystem watcher and browser HMR channel.
|
|
242
281
|
*
|
|
@@ -250,7 +289,7 @@ export declare function getInternalWatchTargets<transforms extends AssetRequestT
|
|
|
250
289
|
* Create an asset server instance
|
|
251
290
|
*
|
|
252
291
|
* Compiles TypeScript/JavaScript scripts and CSS styles on demand with optional
|
|
253
|
-
*
|
|
292
|
+
* content-based URL fingerprinting, caching, and configurable directory mounts.
|
|
254
293
|
*
|
|
255
294
|
* @param options Server configuration
|
|
256
295
|
* @returns A {@link AssetServer} with `fetch()`, `getHref()`, and `getPreloads()` methods
|
|
@@ -259,9 +298,6 @@ export declare function getInternalWatchTargets<transforms extends AssetRequestT
|
|
|
259
298
|
* ```ts
|
|
260
299
|
* let assetServer = createAssetServer({
|
|
261
300
|
* basePath: '/assets',
|
|
262
|
-
* fileMap: {
|
|
263
|
-
* '/app/*path': 'app/*path',
|
|
264
|
-
* },
|
|
265
301
|
* allowFiles: ['app/routes.ts', 'app/**\/public/**'],
|
|
266
302
|
* allowPackages: ['remix'],
|
|
267
303
|
* denyFiles: ['app/**\/*.test.*'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-server.d.ts","sourceRoot":"","sources":["../../src/lib/asset-server.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EAEzB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAKhD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"asset-server.d.ts","sourceRoot":"","sources":["../../src/lib/asset-server.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EAEzB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc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