@lwc/metadata 2.43.0-0 → 2.45.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/dist/bundle-metadata.js
CHANGED
|
@@ -73,7 +73,7 @@ function rollupDiagnostics(files) {
|
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
} */
|
|
76
|
-
const version = '2.
|
|
76
|
+
const version = '2.45.0-0';
|
|
77
77
|
function collectBundleMetadata(config) {
|
|
78
78
|
// validateBundleConfig(config);
|
|
79
79
|
const { namespace, name, type, namespaceMapping, files, enableKomaci, strictCSSTokenCollection, enableLuvio, experimentalComplexExpressions, } = config;
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var postcssValueParser = require('postcss-value-parser');
|
|
4
4
|
var sfdcCompilerUtils = require('@lwc/sfdc-compiler-utils');
|
|
5
|
+
var errors$1 = require('@lwc/errors');
|
|
5
6
|
var utils = require('../shared/utils.js');
|
|
6
7
|
var utils$1 = require('../script-metadata/utils.js');
|
|
8
|
+
var utils$2 = require('../script-metadata/module-references/collectors/utils.js');
|
|
9
|
+
var errors = require('../errors/errors.js');
|
|
7
10
|
|
|
8
11
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
9
12
|
|
|
@@ -82,17 +85,42 @@ function getImportType(name) {
|
|
|
82
85
|
return 'external';
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
|
-
function createReference(name, references, namespaceMapping) {
|
|
88
|
+
function createReference(name, references, namespaceMapping, fileName, location) {
|
|
86
89
|
const type = getImportType(name);
|
|
87
90
|
const id = utils.generateReferenceId('ModuleReference', references.size, name);
|
|
88
91
|
const namespacedName = type === 'external' ? sfdcCompilerUtils.getNamespacedIdForResource(name, namespaceMapping) : undefined;
|
|
89
|
-
|
|
92
|
+
const reference = {
|
|
90
93
|
id,
|
|
91
94
|
name,
|
|
92
95
|
namespacedName,
|
|
93
96
|
type,
|
|
94
97
|
locations: [],
|
|
95
98
|
};
|
|
99
|
+
// Currently @salesforce/slds is the only allowed scoped module specifier that can be imported by a css file
|
|
100
|
+
// Note: @salesforce/slds is not publicly documented but we cannot rule out that it is not used by customers
|
|
101
|
+
// WI for deprecation/removal of @salesforce/slds: W-12023337
|
|
102
|
+
if (type === '@salesforce' && name.startsWith('@salesforce/slds/')) {
|
|
103
|
+
const id = utils$2.getId('@salesforce/slds', name);
|
|
104
|
+
if (utils.isEmpty(id)) {
|
|
105
|
+
throw new errors.MetadataCollectionError([
|
|
106
|
+
errors$1.generateCompilerDiagnostic(errors.Errors.MISSING_RESOURCE_VALUE, {
|
|
107
|
+
messageArgs: [name],
|
|
108
|
+
origin: {
|
|
109
|
+
filename: fileName,
|
|
110
|
+
location: {
|
|
111
|
+
line: location.startLine,
|
|
112
|
+
column: location.startColumn,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
}),
|
|
116
|
+
]);
|
|
117
|
+
}
|
|
118
|
+
reference.sfdcResource = {
|
|
119
|
+
id,
|
|
120
|
+
scoped: 'slds',
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return reference;
|
|
96
124
|
}
|
|
97
125
|
function collectImports(result, root, namespaceMapping) {
|
|
98
126
|
const references = new Map();
|
|
@@ -106,7 +134,7 @@ function collectImports(result, root, namespaceMapping) {
|
|
|
106
134
|
const importLocation = getLocation(rule, importInfo);
|
|
107
135
|
let reference = references.get(name);
|
|
108
136
|
if (utils.isUndefined(reference)) {
|
|
109
|
-
reference = createReference(name, references, namespaceMapping);
|
|
137
|
+
reference = createReference(name, references, namespaceMapping, result.fileName, importLocation);
|
|
110
138
|
result.imports.push(reference);
|
|
111
139
|
references.set(name, reference);
|
|
112
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.js","sources":["../../src/style-metadata/imports.ts"],"sourcesContent":[null],"names":["postcssValueParser","isUndefined","QUOTE_LENGTH","generateReferenceId","getNamespacedIdForResource"],"mappings":"
|
|
1
|
+
{"version":3,"file":"imports.js","sources":["../../src/style-metadata/imports.ts"],"sourcesContent":[null],"names":["postcssValueParser","isUndefined","QUOTE_LENGTH","generateReferenceId","getNamespacedIdForResource","getId","isEmpty","MetadataCollectionError","generateCompilerDiagnostic","Errors"],"mappings":";;;;;;;;;;;;;;AAAA;AAwBA,SAAS,aAAa,CAAC,KAAa,EAAA;AAChC,IAAA,IAAI,IAAiB,CAAC;IACtB,IAAI;AACA,QAAA,IAAI,GAAGA,mCAAkB,CAAC,KAAK,CAAC,CAAC;AACpC,KAAA;IAAC,MAAM;;QAEJ,OAAO;AACV,KAAA;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAE3B,IAAA,IAAIC,iBAAW,CAAC,IAAI,CAAC,EAAE;QACnB,OAAO;AACV,KAAA;;AAGD,IAAA,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE;QACxB,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,MAAM,EAAE,IAAI,CAAC,WAAW;SAC3B,CAAC;AACL,KAAA;;;IAID,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,EAAE;AAClD,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;AAE1B,QAAA,IAAIA,iBAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;YACxB,OAAO;AACV,SAAA;QAED,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE;YAC7B,OAAO;AACH,gBAAA,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK;gBACrB,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,GAAG,CAAC;aACpC,CAAC;AACL,SAAA;QAED,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,E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OAAO,SAAS,CAAC;AACrB,CAAC;SAEe,cAAc,CAAC,MAAe,EAAE,IAAU,EAAE,gBAAkC,EAAA;AAC1F,IAAA,MAAM,UAAU,GAAG,IAAI,GAAG,EAA2B,CAAC;IAEtD,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,IAAI,KAAI;QAChC,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;;AAG9C,QAAA,IAAIR,iBAAW,CAAC,UAAU,CAAC,EAAE;YACzB,OAAO;AACV,SAAA;AAED,QAAA,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC;QAC5B,MAAM,cAAc,GAAG,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAErD,IAAI,SAAS,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAErC,QAAA,IAAIA,iBAAW,CAAC,SAAS,CAAC,EAAE;AACxB,YAAA,SAAS,GAAG,eAAe,CACvB,IAAI,EACJ,UAAU,EACV,gBAAgB,EAChB,MAAM,CAAC,QAAQ,EACf,cAAc,CACjB,CAAC;AAEF,YAAA,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAC/B,YAAA,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AACnC,SAAA;AAED,QAAA,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AAC7C,KAAC,CAAC,CAAC;AACP;;;;"}
|
|
@@ -57,9 +57,21 @@ function collectCssMetadataFromSource(fileName, source, config) {
|
|
|
57
57
|
/** Internal API, optimization to reuse existing ast from compilation process **/
|
|
58
58
|
function collectCssMetadata(fileName, root, namespaceMapping, strictCSSTokenCollection) {
|
|
59
59
|
const result = generateEmptyResult(fileName);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
try {
|
|
61
|
+
imports.collectImports(result, root, namespaceMapping);
|
|
62
|
+
customProperties.collectCustomProperties(result, root, strictCSSTokenCollection);
|
|
63
|
+
componentReferences.collectComponentReferences(result, root, namespaceMapping);
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
if (e instanceof errors$1.MetadataCollectionError) {
|
|
67
|
+
// If a recognized error event occured, capture the diagnostics
|
|
68
|
+
result.diagnostics = e.diagnostics;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
// rethrow all other errors
|
|
72
|
+
throw e;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
63
75
|
return result;
|
|
64
76
|
}
|
|
65
77
|
/** End internal API **/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/style-metadata/index.ts"],"sourcesContent":[null],"names":["postcss","isUndefined","generateCompilerDiagnostic","Errors","collectImports","collectCustomProperties","collectComponentReferences"],"mappings":";;;;;;;;;;;;;;AAAA;AAkBA,SAAS,mBAAmB,CAAC,QAAgB,EAAA;IACzC,OAAO;AACH,QAAA,QAAQ,EAAE,KAAK;QACf,QAAQ;AACR,QAAA,OAAO,EAAE,EAAE;AACX,QAAA,mBAAmB,EAAE,EAAE;AACvB,QAAA,gBAAgB,EAAE,EAAE;AACpB,QAAA,WAAW,EAAE,EAAE;KAClB,CAAC;AACN,CAAC;SAEe,4BAA4B,CACxC,QAAgB,EAChB,MAAc,EACd,MAGC,EAAA;AAED,IAAA,IAAI,IAAU,CAAC;IAEf,IAAI;AACA,QAAA,IAAI,GAAGA,wBAAO,CAAC,KAAK,CAAC,MAAM,EAAE;AACzB,YAAA,IAAI,EAAE,QAAQ;AACjB,SAAA,CAAC,CAAC;AACN,KAAA;AAAC,IAAA,OAAO,KAAU,EAAE;AACjB,QAAA,MAAM,MAAM,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAE7C,QAAA,IAAI,QAA8B,CAAC;AACnC,QAAA,IAAI,CAACC,iBAAW,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAACA,iBAAW,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;AACxD,YAAA,QAAQ,GAAG;gBACP,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,MAAM,EAAE,KAAK,CAAC,MAAM;aACvB,CAAC;AACL,SAAA;QAED,OAAO;AACH,YAAA,GAAG,MAAM;AACT,YAAA,WAAW,EAAE;AACT,gBAAAC,iCAA0B,CAACC,eAAM,CAAC,YAAY,EAAE;AAC5C,oBAAA,WAAW,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC;AACtC,oBAAA,MAAM,EAAE;AACJ,wBAAA,QAAQ,EAAE,QAAQ;wBAClB,QAAQ;AACX,qBAAA;iBACJ,CAAC;AACL,aAAA;SACJ,CAAC;AACL,KAAA;AAED,IAAA,OAAO,kBAAkB,CACrB,QAAQ,EACR,IAAI,EACJ,MAAM,CAAC,gBAAgB,EACvB,MAAM,CAAC,wBAAwB,CAClC,CAAC;AACN,CAAC;AAED;AACA,SAAS,kBAAkB,CACvB,QAAgB,EAChB,IAAU,EACV,gBAAkC,EAClC,wBAAkC,EAAA;AAElC,IAAA,MAAM,MAAM,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/style-metadata/index.ts"],"sourcesContent":[null],"names":["postcss","isUndefined","generateCompilerDiagnostic","Errors","collectImports","collectCustomProperties","collectComponentReferences","MetadataCollectionError"],"mappings":";;;;;;;;;;;;;;AAAA;AAkBA,SAAS,mBAAmB,CAAC,QAAgB,EAAA;IACzC,OAAO;AACH,QAAA,QAAQ,EAAE,KAAK;QACf,QAAQ;AACR,QAAA,OAAO,EAAE,EAAE;AACX,QAAA,mBAAmB,EAAE,EAAE;AACvB,QAAA,gBAAgB,EAAE,EAAE;AACpB,QAAA,WAAW,EAAE,EAAE;KAClB,CAAC;AACN,CAAC;SAEe,4BAA4B,CACxC,QAAgB,EAChB,MAAc,EACd,MAGC,EAAA;AAED,IAA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AAI,EAAE,wBAAwB,CAAC,CAAC;AAChE,QAAAC,8CAA0B,CAAC,MAAM,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC;AAC9D,KAAA;AAAC,IAAA,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,YAAYC,gCAAuB,EAAE;;AAEtC,YAAA,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC;AACtC,SAAA;AAAM,aAAA;;AAEH,YAAA,MAAM,CAAC,CAAC;AACX,SAAA;AACJ,KAAA;AACD,IAAA,OAAO,MAAM,CAAC;AAClB,CAAC;AACD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lwc/metadata",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.45.0-0",
|
|
4
4
|
"description": "Extract metadata about Lightning Web Components modules. This software is provided as-is with no support provided.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"postcss-value-parser": "~4.2.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@lwc/sfdc-compiler-utils": "2.
|
|
26
|
-
"@lwc/errors": "~2.
|
|
27
|
-
"@lwc/template-compiler": "~2.
|
|
25
|
+
"@lwc/sfdc-compiler-utils": "2.45.0-0",
|
|
26
|
+
"@lwc/errors": "~2.45.0",
|
|
27
|
+
"@lwc/template-compiler": "~2.45.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/babel__core": "^7.1.20",
|