@rollup-extras/plugin-html 1.4.0 → 1.4.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.
- package/dist/index.cjs +7 -8
- package/dist/index.mjs +7 -8
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -69,7 +69,7 @@ function index (options$1 = {}) {
|
|
|
69
69
|
const baseAddInstance = instance.api.addInstance;
|
|
70
70
|
instance.renderStart = function (outputOptions, inputOptions) {
|
|
71
71
|
logger('started collecting information', 0 /* LogLevel.verbose */);
|
|
72
|
-
initialDir = outputOptions.dir
|
|
72
|
+
initialDir = outputOptions.dir ?? '';
|
|
73
73
|
fileNameInInitialDir = path.join(initialDir, outputFile);
|
|
74
74
|
return baseRenderStart.call(this, outputOptions, inputOptions);
|
|
75
75
|
};
|
|
@@ -100,7 +100,7 @@ function index (options$1 = {}) {
|
|
|
100
100
|
.map(({ key, count }) => `${key}: ${count}`)
|
|
101
101
|
.join(', ');
|
|
102
102
|
logger(`assets collected: [${statistics}], remaining: ${remainingOutputsCount} outputs, ${remainingConfigsCount} configs`, 0 /* LogLevel.verbose */);
|
|
103
|
-
const dir = options.dir
|
|
103
|
+
const dir = options.dir ?? '', fileName = path.relative(dir, fileNameInInitialDir);
|
|
104
104
|
if (fileName in bundle) {
|
|
105
105
|
if (useEmittedTemplate) {
|
|
106
106
|
logger(`using exiting emitted ${fileName} as an input for out templateFactory`, 0 /* LogLevel.verbose */);
|
|
@@ -148,7 +148,7 @@ function index (options$1 = {}) {
|
|
|
148
148
|
async function generateBundle(options) {
|
|
149
149
|
logger.start('generating html', logLevel);
|
|
150
150
|
try {
|
|
151
|
-
const dir = options.dir
|
|
151
|
+
const dir = options.dir ?? '', fileName = path.relative(dir, fileNameInInitialDir);
|
|
152
152
|
const depromisifiedTemplateString = await templateString, source = await templateFactory(depromisifiedTemplateString, assets, defaultTemplateFactory);
|
|
153
153
|
if (!emitFile || fileName.startsWith('..') || useWriteBundle) {
|
|
154
154
|
if (emitFile && emitFile !== 'auto') {
|
|
@@ -174,19 +174,19 @@ function index (options$1 = {}) {
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
async function getAssets(options, bundle) {
|
|
177
|
-
const dir = options.dir
|
|
177
|
+
const dir = options.dir ?? '';
|
|
178
178
|
for (const fileName of Object.keys(bundle)) {
|
|
179
179
|
const relativeToRootAssetPath = path.join(dir, fileName);
|
|
180
|
+
const assetPath = path.relative(initialDir, relativeToRootAssetPath);
|
|
180
181
|
if (ignore(relativeToRootAssetPath) || processedFiles.has(relativeToRootAssetPath)) {
|
|
181
182
|
continue;
|
|
182
183
|
}
|
|
183
184
|
processedFiles.add(relativeToRootAssetPath);
|
|
184
185
|
if (bundle[fileName].type === 'asset') {
|
|
185
|
-
if (await useAssetFactory(
|
|
186
|
+
if (await useAssetFactory(assetPath, relativeToRootAssetPath, bundle[fileName].source, 'asset')) {
|
|
186
187
|
continue;
|
|
187
188
|
}
|
|
188
189
|
if (fileName.endsWith(cssExtention)) {
|
|
189
|
-
const assetPath = path.relative(initialDir, relativeToRootAssetPath);
|
|
190
190
|
assets.asset.push({
|
|
191
191
|
html: shared.getLinkElement(assetPath),
|
|
192
192
|
head: injectIntoHead(relativeToRootAssetPath),
|
|
@@ -198,11 +198,10 @@ function index (options$1 = {}) {
|
|
|
198
198
|
else if (bundle[fileName].type === 'chunk') {
|
|
199
199
|
const chunk = bundle[fileName];
|
|
200
200
|
if (chunk.isEntry) {
|
|
201
|
-
if (await useAssetFactory(
|
|
201
|
+
if (await useAssetFactory(assetPath, relativeToRootAssetPath, chunk.code, options.format)) {
|
|
202
202
|
continue;
|
|
203
203
|
}
|
|
204
204
|
if (options.format === 'es' || options.format === 'iife' || options.format === 'umd') {
|
|
205
|
-
const assetPath = path.relative(initialDir, relativeToRootAssetPath);
|
|
206
205
|
assets[options.format].push({
|
|
207
206
|
html: (assets) => {
|
|
208
207
|
let useConditionalLoading = conditionalLoading;
|
package/dist/index.mjs
CHANGED
|
@@ -67,7 +67,7 @@ function index (options = {}) {
|
|
|
67
67
|
const baseAddInstance = instance.api.addInstance;
|
|
68
68
|
instance.renderStart = function (outputOptions, inputOptions) {
|
|
69
69
|
logger('started collecting information', 0 /* LogLevel.verbose */);
|
|
70
|
-
initialDir = outputOptions.dir
|
|
70
|
+
initialDir = outputOptions.dir ?? '';
|
|
71
71
|
fileNameInInitialDir = path.join(initialDir, outputFile);
|
|
72
72
|
return baseRenderStart.call(this, outputOptions, inputOptions);
|
|
73
73
|
};
|
|
@@ -98,7 +98,7 @@ function index (options = {}) {
|
|
|
98
98
|
.map(({ key, count }) => `${key}: ${count}`)
|
|
99
99
|
.join(', ');
|
|
100
100
|
logger(`assets collected: [${statistics}], remaining: ${remainingOutputsCount} outputs, ${remainingConfigsCount} configs`, 0 /* LogLevel.verbose */);
|
|
101
|
-
const dir = options.dir
|
|
101
|
+
const dir = options.dir ?? '', fileName = path.relative(dir, fileNameInInitialDir);
|
|
102
102
|
if (fileName in bundle) {
|
|
103
103
|
if (useEmittedTemplate) {
|
|
104
104
|
logger(`using exiting emitted ${fileName} as an input for out templateFactory`, 0 /* LogLevel.verbose */);
|
|
@@ -146,7 +146,7 @@ function index (options = {}) {
|
|
|
146
146
|
async function generateBundle(options) {
|
|
147
147
|
logger.start('generating html', logLevel);
|
|
148
148
|
try {
|
|
149
|
-
const dir = options.dir
|
|
149
|
+
const dir = options.dir ?? '', fileName = path.relative(dir, fileNameInInitialDir);
|
|
150
150
|
const depromisifiedTemplateString = await templateString, source = await templateFactory(depromisifiedTemplateString, assets, defaultTemplateFactory);
|
|
151
151
|
if (!emitFile || fileName.startsWith('..') || useWriteBundle) {
|
|
152
152
|
if (emitFile && emitFile !== 'auto') {
|
|
@@ -172,19 +172,19 @@ function index (options = {}) {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
async function getAssets(options, bundle) {
|
|
175
|
-
const dir = options.dir
|
|
175
|
+
const dir = options.dir ?? '';
|
|
176
176
|
for (const fileName of Object.keys(bundle)) {
|
|
177
177
|
const relativeToRootAssetPath = path.join(dir, fileName);
|
|
178
|
+
const assetPath = path.relative(initialDir, relativeToRootAssetPath);
|
|
178
179
|
if (ignore(relativeToRootAssetPath) || processedFiles.has(relativeToRootAssetPath)) {
|
|
179
180
|
continue;
|
|
180
181
|
}
|
|
181
182
|
processedFiles.add(relativeToRootAssetPath);
|
|
182
183
|
if (bundle[fileName].type === 'asset') {
|
|
183
|
-
if (await useAssetFactory(
|
|
184
|
+
if (await useAssetFactory(assetPath, relativeToRootAssetPath, bundle[fileName].source, 'asset')) {
|
|
184
185
|
continue;
|
|
185
186
|
}
|
|
186
187
|
if (fileName.endsWith(cssExtention)) {
|
|
187
|
-
const assetPath = path.relative(initialDir, relativeToRootAssetPath);
|
|
188
188
|
assets.asset.push({
|
|
189
189
|
html: getLinkElement(assetPath),
|
|
190
190
|
head: injectIntoHead(relativeToRootAssetPath),
|
|
@@ -196,11 +196,10 @@ function index (options = {}) {
|
|
|
196
196
|
else if (bundle[fileName].type === 'chunk') {
|
|
197
197
|
const chunk = bundle[fileName];
|
|
198
198
|
if (chunk.isEntry) {
|
|
199
|
-
if (await useAssetFactory(
|
|
199
|
+
if (await useAssetFactory(assetPath, relativeToRootAssetPath, chunk.code, options.format)) {
|
|
200
200
|
continue;
|
|
201
201
|
}
|
|
202
202
|
if (options.format === 'es' || options.format === 'iife' || options.format === 'umd') {
|
|
203
|
-
const assetPath = path.relative(initialDir, relativeToRootAssetPath);
|
|
204
203
|
assets[options.format].push({
|
|
205
204
|
html: (assets) => {
|
|
206
205
|
let useConditionalLoading = conditionalLoading;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.4.
|
|
2
|
+
"version": "1.4.1",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"name": "@rollup-extras/plugin-html",
|
|
5
5
|
"author": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@niceties/logger": "^1.1.4",
|
|
56
|
-
"@rollup-extras/utils": "^1.4.
|
|
56
|
+
"@rollup-extras/utils": "^1.4.1"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "pkgbld-internal",
|