@lwrjs/asset-transformer 0.11.0-alpha.8 → 0.11.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/build/cjs/index.cjs +4 -3
- package/build/es/index.js +2 -1
- package/package.json +6 -5
package/build/cjs/index.cjs
CHANGED
|
@@ -26,6 +26,7 @@ __markAsModule(exports);
|
|
|
26
26
|
__export(exports, {
|
|
27
27
|
default: () => defaultAssetTransformer
|
|
28
28
|
});
|
|
29
|
+
var import_diagnostics = __toModule(require("@lwrjs/diagnostics"));
|
|
29
30
|
var import_shared_utils = __toModule(require("@lwrjs/shared-utils"));
|
|
30
31
|
var import_css = __toModule(require("./metadata-collectors/css.cjs"));
|
|
31
32
|
var import_path = __toModule(require("path"));
|
|
@@ -42,7 +43,7 @@ function defaultAssetTransformer(_options, lwrGlobalContext) {
|
|
|
42
43
|
const hash = immutableAssets ? ownHash : "latest";
|
|
43
44
|
const relativePath = basePath ? (0, import_path.relative)(basePath, existingUri) : existingUri;
|
|
44
45
|
const uri = (0, import_path.join)(`${basePath}/${apiVersion}/${type}/${immutable}s/${hash}`, encodeURI(relativePath));
|
|
45
|
-
|
|
46
|
+
import_diagnostics.logger.debug(`[${this.name}] normalized url ${entry} -> ${uri}`);
|
|
46
47
|
return {
|
|
47
48
|
...assetUri,
|
|
48
49
|
uri,
|
|
@@ -53,7 +54,7 @@ function defaultAssetTransformer(_options, lwrGlobalContext) {
|
|
|
53
54
|
},
|
|
54
55
|
async transformSource(assetSource, runtimeEnvironment) {
|
|
55
56
|
if (assetSource.mime === CSS_MIME) {
|
|
56
|
-
|
|
57
|
+
import_diagnostics.logger.debug(`[${this.name}] extract metadata ${assetSource.entry}`);
|
|
57
58
|
const code = assetSource.content("utf-8");
|
|
58
59
|
const metadata = await (0, import_css.linkCss)(code.toString(), assetSource.entry);
|
|
59
60
|
const linkedAsset = await linkAsset(code, {
|
|
@@ -88,7 +89,7 @@ async function linkAsset(source, assetSource, runtimeEnvironment, resolveUri) {
|
|
|
88
89
|
const overrideUrl = assetRef.override?.uri;
|
|
89
90
|
codeStringBuilder.overwrite(startOffset, endOffset, overrideUrl || url);
|
|
90
91
|
} catch (err) {
|
|
91
|
-
|
|
92
|
+
import_diagnostics.logger.warn(`Failed to resolve reference '${url}' in asset '${importer}'`);
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
}
|
package/build/es/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { logger } from '@lwrjs/diagnostics';
|
|
2
|
+
import { createStringBuilder, mimeLookup } from '@lwrjs/shared-utils';
|
|
2
3
|
import { linkCss } from './metadata-collectors/css.js';
|
|
3
4
|
import { join, relative } from 'path';
|
|
4
5
|
const CSS_MIME = mimeLookup('.css');
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.11.0
|
|
7
|
+
"version": "0.11.0",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -39,13 +39,14 @@
|
|
|
39
39
|
"test": "jest"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@lwrjs/
|
|
42
|
+
"@lwrjs/diagnostics": "0.11.0",
|
|
43
|
+
"@lwrjs/shared-utils": "0.11.0",
|
|
43
44
|
"fs-extra": "^11.1.1",
|
|
44
|
-
"postcss": "^8.4.
|
|
45
|
+
"postcss": "^8.4.31",
|
|
45
46
|
"postcss-value-parser": "^4.2.0"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
|
-
"@lwrjs/types": "0.11.0
|
|
49
|
+
"@lwrjs/types": "0.11.0",
|
|
49
50
|
"jest": "^26.6.3",
|
|
50
51
|
"ts-jest": "^26.5.6"
|
|
51
52
|
},
|
|
@@ -55,5 +56,5 @@
|
|
|
55
56
|
"volta": {
|
|
56
57
|
"extends": "../../../package.json"
|
|
57
58
|
},
|
|
58
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "fbc883ea90a12672ce6f1adc2201144fda8762bd"
|
|
59
60
|
}
|