@rollup-extras/plugin-html 1.4.5 → 2.0.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 +2 -2
- package/{dist/asset-factories.mjs → asset-factories.js} +18 -12
- package/index.d.ts +67 -0
- package/index.d.ts.map +31 -0
- package/index.js +346 -0
- package/package.json +15 -24
- package/shared.js +24 -0
- package/asset-factories/package.json +0 -5
- package/dist/asset-factories.cjs +0 -61
- package/dist/asset-factories.d.ts +0 -6
- package/dist/index.cjs +0 -280
- package/dist/index.d.ts +0 -7
- package/dist/index.mjs +0 -278
- package/dist/shared.cjs +0 -31
- package/dist/shared.d.ts +0 -5
- package/dist/shared.mjs +0 -26
- package/dist/types.d.ts +0 -37
package/dist/shared.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
function getLinkElement(fileName) {
|
|
2
|
-
return `<link rel="stylesheet" href="${fileName}" type="text/css">`;
|
|
3
|
-
}
|
|
4
|
-
function getNonModuleScriptElement(fileName, conditionalLoading) {
|
|
5
|
-
return `<script src="${fileName}" type="text/javascript"${conditionalLoading ? ' nomodule' : ''}></script>`;
|
|
6
|
-
}
|
|
7
|
-
function getModuleScriptElement(fileName) {
|
|
8
|
-
return `<script src="${fileName}" type="module"></script>`;
|
|
9
|
-
}
|
|
10
|
-
function toAssetPredicate(sourceOption) {
|
|
11
|
-
if (typeof sourceOption === 'boolean') {
|
|
12
|
-
return () => sourceOption;
|
|
13
|
-
}
|
|
14
|
-
else if (typeof sourceOption === 'function') {
|
|
15
|
-
return sourceOption;
|
|
16
|
-
}
|
|
17
|
-
else if (sourceOption instanceof RegExp) {
|
|
18
|
-
return (fileName) => sourceOption.test(fileName);
|
|
19
|
-
}
|
|
20
|
-
else if (typeof sourceOption === 'string') {
|
|
21
|
-
return (fileName) => fileName.endsWith(sourceOption);
|
|
22
|
-
}
|
|
23
|
-
return undefined;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { getNonModuleScriptElement as a, getModuleScriptElement as b, getLinkElement as g, toAssetPredicate as t };
|
package/dist/types.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { InternalModuleFormat } from 'rollup';
|
|
2
|
-
export type PredicateSource = boolean | AssetPredicate | RegExp | string;
|
|
3
|
-
export type AssetType = 'asset' | InternalModuleFormat;
|
|
4
|
-
export type Assets = {
|
|
5
|
-
[key in AssetType]?: AssetDescriptor[];
|
|
6
|
-
};
|
|
7
|
-
export type AssetPredicate = (fileName: string) => boolean;
|
|
8
|
-
export type AssetDescriptor = {
|
|
9
|
-
html: string | ((assets: Assets, context?: unknown) => string | unknown);
|
|
10
|
-
head: boolean;
|
|
11
|
-
type: 'asset' | InternalModuleFormat;
|
|
12
|
-
};
|
|
13
|
-
export type SimpleAssetDescriptor = {
|
|
14
|
-
html: string;
|
|
15
|
-
head: boolean;
|
|
16
|
-
type: 'asset' | InternalModuleFormat;
|
|
17
|
-
};
|
|
18
|
-
export type AssetFactory = (fileName: string, content: string | Uint8Array, type: 'asset' | InternalModuleFormat) => AssetDescriptor | string | undefined | Promise<AssetDescriptor | string | undefined>;
|
|
19
|
-
export type DefaultTemplateFactory = (initialTemplate: string, assets: Assets) => string;
|
|
20
|
-
export type TemplateFactory = (initialTemplate: string, assets: Assets, defaultTemplateFactory: DefaultTemplateFactory) => string | Uint8Array | Promise<string | Uint8Array>;
|
|
21
|
-
export type HtmlPluginOptions = {
|
|
22
|
-
pluginName?: string;
|
|
23
|
-
outputFile?: string;
|
|
24
|
-
template?: string;
|
|
25
|
-
watch?: boolean;
|
|
26
|
-
emitFile?: boolean | 'auto';
|
|
27
|
-
verbose?: boolean;
|
|
28
|
-
useWriteBundle?: boolean;
|
|
29
|
-
useEmittedTemplate?: boolean;
|
|
30
|
-
conditionalLoading?: boolean;
|
|
31
|
-
injectIntoHead?: PredicateSource;
|
|
32
|
-
ignore?: PredicateSource;
|
|
33
|
-
assetsFactory?: AssetFactory;
|
|
34
|
-
templateFactory?: TemplateFactory;
|
|
35
|
-
};
|
|
36
|
-
export type Extends<T1, T2> = T1 extends T2 ? true : false;
|
|
37
|
-
export type Expect<T extends true> = T;
|