@financial-times/dotcom-server-asset-loader 7.3.0 → 7.3.1

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.
@@ -0,0 +1,58 @@
1
+ export interface AssetLoaderOptions {
2
+ /**
3
+ * The name of the asset manifest file
4
+ * @default "manifest.json"
5
+ */
6
+ manifestFileName?: string;
7
+ /**
8
+ * The public-facing URL for the static assets
9
+ */
10
+ publicPath?: string;
11
+ /**
12
+ * The absolute path to the directory of static assets
13
+ * @default path.resolve('./public')
14
+ */
15
+ fileSystemPath?: string;
16
+ /**
17
+ * Store files in memory when accessed
18
+ * @default false
19
+ */
20
+ cacheFileContents?: boolean;
21
+ /**
22
+ * The asset manifest
23
+ */
24
+ manifest?: {
25
+ [asset: string]: string;
26
+ };
27
+ }
28
+ declare type TEntrypoint = {
29
+ [type: string]: string[];
30
+ };
31
+ declare type TEntrypoints = {
32
+ entrypoints?: {
33
+ [name: string]: TEntrypoint;
34
+ };
35
+ };
36
+ declare type TFiles = {
37
+ [name: string]: string;
38
+ };
39
+ export declare type TManifest = TEntrypoints & TFiles;
40
+ export declare class AssetLoader {
41
+ options: AssetLoaderOptions;
42
+ manifest: TManifest;
43
+ constructor(userOptions?: AssetLoaderOptions);
44
+ getHashedAsset(asset: string): string;
45
+ getFileContents(asset: string): string;
46
+ getFileSystemPath(asset: string): string;
47
+ getPublicURL(asset: string): string;
48
+ formatPublicURL(hashedAsset: string): string;
49
+ formatFileSystemPath(hashedAsset: string): string;
50
+ getFilesFor(entrypoint: string): TEntrypoint;
51
+ getScriptFilesFor(entrypoint: string): string[];
52
+ getStylesheetFilesFor(entrypoint: string): string[];
53
+ getScriptPathsFor(entrypoint: string): string[];
54
+ getStylesheetPathsFor(entrypoint: string): string[];
55
+ getScriptURLsFor(entrypoint: string): string[];
56
+ getStylesheetURLsFor(entrypoint: string): string[];
57
+ }
58
+ export {};
@@ -0,0 +1 @@
1
+ export declare function loadFile(fullPath: string, cache?: boolean): string;
@@ -0,0 +1 @@
1
+ export declare function loadManifest(filePath: string): any;
@@ -0,0 +1 @@
1
+ export * from './AssetLoader';