Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lwc/metadata

Package Overview
Dependencies
Maintainers
14
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lwc/metadata - npm Package Compare versions

Comparing version 2.23.0-2 to 2.23.0-3

9

dist/bundle-metadata.js

@@ -78,6 +78,6 @@ 'use strict';

} */
const version = '2.23.0-2';
const version = '2.23.0-3';
function collectBundleMetadata(config) {
// validateBundleConfig(config);
const { namespace, name, type, namespaceMapping, files, enableKomaci } = config;
const { namespace, name, type, namespaceMapping, files, enableKomaci, strictCSSTokenCollection, } = config;
const filesResult = [];

@@ -101,3 +101,6 @@ files.forEach(({ fileName, source }) => {

case '.css':
filesResult.push(index.collectCssMetadataFromSource(fileName, source, { namespaceMapping }));
filesResult.push(index.collectCssMetadataFromSource(fileName, source, {
namespaceMapping,
strictCSSTokenCollection,
}));
break;

@@ -104,0 +107,0 @@ }

@@ -15,2 +15,3 @@ export declare type NamespaceMapping = {

enableKomaci?: boolean;
strictCSSTokenCollection?: boolean;
}
import { Root } from 'postcss';
import { CSSFile } from '../schema/typescript-types/style-metadata-types';
export declare function collectCustomProperties(result: CSSFile, root: Root): void;
export declare function collectCustomProperties(result: CSSFile, root: Root, strict?: boolean): void;

@@ -13,3 +13,3 @@ 'use strict';

// Copyright (c) 2022, Salesforce, Inc.,
function collectCustomProperties(result, root) {
function collectCustomProperties(result, root, strict) {
root.walkDecls((decl) => {

@@ -33,10 +33,19 @@ // Early exit if the declaration doesn't includes a var() function. This avoid parsing the

}
const { nodes } = parsedValue;
// To keep the implementation backwards compatible with metadata-v1, only process declaration
// values that start with a "var". This is not comprehensive, as lwc tokens nested with in
// css functions are not collected. But doing so now will break existing usages in production
const declarationValueStartsWithVar = nodes.filter((n) => {
return n.type === 'function' && n.value === 'var';
});
postcssValueParser__default["default"].walk(declarationValueStartsWithVar, (node) => {
// Use the 'strict' flag to determine whether to comprehensively collect lwc tokens nested within
// css functions. Fallback to backwards compatible behavior when 'strict' is false.
let nodeWalker;
if (strict) {
nodeWalker = parsedValue.walk.bind(parsedValue);
}
else {
// To keep the implementation backwards compatible with metadata-v1, only process declaration
// values that start with a "var". This is not comprehensive, as lwc tokens nested with in
// css functions are not collected. But doing so now will break existing usages in production
const { nodes } = parsedValue;
const declarationValueStartsWithVar = nodes.filter((n) => {
return n.type === 'function' && n.value === 'var';
});
nodeWalker = postcssValueParser__default["default"].walk.bind(postcssValueParser__default["default"], declarationValueStartsWithVar);
}
nodeWalker((node) => {
if (node.type !== 'function' || node.value !== 'var') {

@@ -43,0 +52,0 @@ return;

@@ -5,3 +5,4 @@ import { NamespaceMapping } from '../shared/config';

namespaceMapping: NamespaceMapping;
strictCSSTokenCollection?: boolean;
}): CSSFile;
/** End internal API **/

@@ -57,9 +57,9 @@ 'use strict';

}
return collectCssMetadata(fileName, root, config.namespaceMapping);
return collectCssMetadata(fileName, root, config.namespaceMapping, config.strictCSSTokenCollection);
}
/** Internal API, optimization to reuse existing ast from compilation process **/
function collectCssMetadata(fileName, root, namespaceMapping) {
function collectCssMetadata(fileName, root, namespaceMapping, strictCSSTokenCollection) {
const result = generateEmptyResult(fileName);
imports.collectImports(result, root, namespaceMapping);
customProperties.collectCustomProperties(result, root);
customProperties.collectCustomProperties(result, root, strictCSSTokenCollection);
componentReferences.collectComponentReferences(result, root, namespaceMapping);

@@ -66,0 +66,0 @@ return result;

{
"name": "@lwc/metadata",
"version": "2.23.0-2",
"version": "2.23.0-3",
"description": "Extract metadata about Lightning Web Components modules. This software is provided as-is with no support provided.",

@@ -17,6 +17,6 @@ "main": "dist/index.js",

"dependencies": {
"@babel/parser": "~7.17.10",
"@babel/traverse": "~7.17.10",
"@babel/types": "~7.17.10",
"postcss": "~8.4.13",
"@babel/parser": "~7.19.1",
"@babel/traverse": "~7.19.1",
"@babel/types": "~7.19.0",
"postcss": "~8.4.16",
"postcss-selector-parser": "~6.0.10",

@@ -26,3 +26,3 @@ "postcss-value-parser": "~4.2.0"

"peerDependencies": {
"@lwc/sfdc-compiler-utils": "2.23.0-2",
"@lwc/sfdc-compiler-utils": "2.23.0-3",
"@lwc/errors": "~2.23.0",

@@ -33,4 +33,4 @@ "@lwc/template-compiler": "~2.23.0"

"@types/babel__core": "^7.1.19",
"@types/babel__traverse": "^7.17.1",
"@types/glob": "^7.2.0"
"@types/babel__traverse": "^7.18.1",
"@types/glob": "^8.0.0"
},

@@ -37,0 +37,0 @@ "engines": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc