@salesforce-ux/eslint-plugin-slds 0.1.7-alpha.0 → 0.1.7-alpha.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.
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  const node_1 = require("./utils/node");
3
- const metadata_service_1 = require("../services/metadata.service");
4
- const bemMapping = metadata_service_1.MetadataService.loadMetadata(metadata_service_1.MetadataFile.BEM_NAMING);
6
+ const sds_metadata_1 = __importDefault(require("@salesforce-ux/sds-metadata"));
7
+ const bemMapping = sds_metadata_1.default.bemNaming;
5
8
  module.exports = {
6
9
  meta: {
7
10
  type: "problem", // The rule type
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  const node_1 = require("./utils/node");
3
- const metadata_service_1 = require("../services/metadata.service");
4
- const deprecatedClasses = metadata_service_1.MetadataService.loadMetadata(metadata_service_1.MetadataFile.DEPRECATED_CLASSES);
6
+ const sds_metadata_1 = __importDefault(require("@salesforce-ux/sds-metadata"));
7
+ const deprecatedClasses = sds_metadata_1.default.deprecatedClasses;
5
8
  module.exports = {
6
9
  meta: {
7
10
  type: "problem", // The rule type
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce-ux/eslint-plugin-slds",
3
- "version": "0.1.7-alpha.0",
3
+ "version": "0.1.7-alpha.1",
4
4
  "main": "build/index.js",
5
5
  "files": [
6
6
  "build/*",
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "@html-eslint/eslint-plugin": "^0.34.0",
22
22
  "@html-eslint/parser": "^0.34.0",
23
- "@salesforce-ux/sds-metadata": "~0.0.1-alpha.3",
23
+ "@salesforce-ux/sds-metadata": "~0.0.1-alpha.8",
24
24
  "eslint": "^8.0.0"
25
25
  },
26
26
  "repository": {
@@ -1,53 +0,0 @@
1
- export * from '@salesforce-ux/sds-metadata';
2
- /**
3
- * Enum representing all available metadata JSON files
4
- */
5
- export declare enum MetadataFile {
6
- AURA_TO_LWC_TOKENS = "auraToLwcTokensMapping.json",
7
- BEM_NAMING = "bem-naming.json",
8
- DEPRECATED_CLASSES = "deprecatedClasses.json",
9
- DEPRECATED_STYLING_HOOKS = "deprecatedStylingHooks.json",
10
- GLOBAL_STYLING_HOOKS = "globalStylingHooks.metadata.json",
11
- ICONS = "icons.json",
12
- LWC_TO_SLDS = "lwc-to-slds.json",
13
- SLDS_CLASSES = "sldsClasses.json",
14
- SLDS_PLUS_CLASSES = "sldsPlusClasses.json",
15
- SLDS_PLUS_STYLING_HOOKS = "sldsPlusStylingHooks.json",
16
- SLDS_STYLING_HOOKS = "sldsStylingHooks.json",
17
- VALUE_TO_STYLING_HOOKS_COSMOS = "valueToStylingHooks.cosmos.json",
18
- VALUE_TO_STYLING_HOOKS_SLDS = "valueToStylingHooks.slds.json"
19
- }
20
- export declare class MetadataService {
21
- private static instance;
22
- private readonly metadataPath;
23
- private cache;
24
- private constructor();
25
- /**
26
- * Get the singleton instance of MetadataService
27
- */
28
- static getInstance(): MetadataService;
29
- /**
30
- * Loads a metadata file from the package
31
- * @param filePath - Path to the metadata file relative to the metadata package root
32
- * @returns Parsed metadata as a JavaScript object/array
33
- */
34
- private loadMetadata;
35
- /**
36
- * Loads multiple metadata files from the package
37
- * @param filePaths - Array of paths to metadata files relative to the metadata package root
38
- * @returns Array of parsed metadata as JavaScript objects/arrays
39
- */
40
- private loadMultipleMetadata;
41
- /**
42
- * Static method to load a single metadata file
43
- * @param file - The metadata file to load
44
- * @returns Parsed metadata as a JavaScript object/array
45
- */
46
- static loadMetadata<T>(file: MetadataFile): T;
47
- /**
48
- * Static method to load multiple metadata files
49
- * @param files - Array of metadata files to load
50
- * @returns Array of parsed metadata as JavaScript objects/arrays
51
- */
52
- static loadMultipleMetadata<T>(files: MetadataFile[]): T[];
53
- }
@@ -1,106 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.MetadataService = exports.MetadataFile = void 0;
18
- __exportStar(require("@salesforce-ux/sds-metadata"), exports);
19
- const path_1 = require("path");
20
- const fs_1 = require("fs");
21
- /**
22
- * Enum representing all available metadata JSON files
23
- */
24
- var MetadataFile;
25
- (function (MetadataFile) {
26
- MetadataFile["AURA_TO_LWC_TOKENS"] = "auraToLwcTokensMapping.json";
27
- MetadataFile["BEM_NAMING"] = "bem-naming.json";
28
- MetadataFile["DEPRECATED_CLASSES"] = "deprecatedClasses.json";
29
- MetadataFile["DEPRECATED_STYLING_HOOKS"] = "deprecatedStylingHooks.json";
30
- MetadataFile["GLOBAL_STYLING_HOOKS"] = "globalStylingHooks.metadata.json";
31
- MetadataFile["ICONS"] = "icons.json";
32
- MetadataFile["LWC_TO_SLDS"] = "lwc-to-slds.json";
33
- MetadataFile["SLDS_CLASSES"] = "sldsClasses.json";
34
- MetadataFile["SLDS_PLUS_CLASSES"] = "sldsPlusClasses.json";
35
- MetadataFile["SLDS_PLUS_STYLING_HOOKS"] = "sldsPlusStylingHooks.json";
36
- MetadataFile["SLDS_STYLING_HOOKS"] = "sldsStylingHooks.json";
37
- MetadataFile["VALUE_TO_STYLING_HOOKS_COSMOS"] = "valueToStylingHooks.cosmos.json";
38
- MetadataFile["VALUE_TO_STYLING_HOOKS_SLDS"] = "valueToStylingHooks.slds.json";
39
- })(MetadataFile || (exports.MetadataFile = MetadataFile = {}));
40
- class MetadataService {
41
- static instance;
42
- metadataPath;
43
- cache = new Map();
44
- constructor() {
45
- // Create a require function for the current module
46
- //const require = createRequire(import.meta.url);
47
- // Resolve the path to @salesforce-ux/sds-metadata package
48
- this.metadataPath = require.resolve('@salesforce-ux/sds-metadata');
49
- }
50
- /**
51
- * Get the singleton instance of MetadataService
52
- */
53
- static getInstance() {
54
- if (!MetadataService.instance) {
55
- MetadataService.instance = new MetadataService();
56
- }
57
- return MetadataService.instance;
58
- }
59
- /**
60
- * Loads a metadata file from the package
61
- * @param filePath - Path to the metadata file relative to the metadata package root
62
- * @returns Parsed metadata as a JavaScript object/array
63
- */
64
- loadMetadata(filePath) {
65
- try {
66
- // Check cache first
67
- if (this.cache.has(filePath)) {
68
- return this.cache.get(filePath);
69
- }
70
- const fullPath = (0, path_1.join)(this.metadataPath, '..', filePath);
71
- const fileContent = (0, fs_1.readFileSync)(fullPath, 'utf8');
72
- const data = JSON.parse(fileContent);
73
- // Cache the result
74
- this.cache.set(filePath, data);
75
- return data;
76
- }
77
- catch (error) {
78
- throw new Error(`Failed to load metadata file: ${filePath}. Error: ${error.message}`);
79
- }
80
- }
81
- /**
82
- * Loads multiple metadata files from the package
83
- * @param filePaths - Array of paths to metadata files relative to the metadata package root
84
- * @returns Array of parsed metadata as JavaScript objects/arrays
85
- */
86
- loadMultipleMetadata(filePaths) {
87
- return filePaths.map(filePath => this.loadMetadata(filePath));
88
- }
89
- /**
90
- * Static method to load a single metadata file
91
- * @param file - The metadata file to load
92
- * @returns Parsed metadata as a JavaScript object/array
93
- */
94
- static loadMetadata(file) {
95
- return MetadataService.getInstance().loadMetadata(file);
96
- }
97
- /**
98
- * Static method to load multiple metadata files
99
- * @param files - Array of metadata files to load
100
- * @returns Array of parsed metadata as JavaScript objects/arrays
101
- */
102
- static loadMultipleMetadata(files) {
103
- return MetadataService.getInstance().loadMultipleMetadata(files);
104
- }
105
- }
106
- exports.MetadataService = MetadataService;