@muonic/muon 0.0.2-experimental-147-882b02a.0 → 0.0.2-experimental-149-9efe5a2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muonic/muon",
3
- "version": "0.0.2-experimental-147-882b02a.0",
3
+ "version": "0.0.2-experimental-149-9efe5a2.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -16,7 +16,7 @@ import { fileURLToPath } from 'url';
16
16
  const __filename = fileURLToPath(import.meta.url);
17
17
  const __dirname = path.dirname(__filename);
18
18
 
19
- const config = getConfig(`muon.config.json`);
19
+ const config = getConfig();
20
20
 
21
21
  const muonPlugin = () => {
22
22
  return {
@@ -95,7 +95,7 @@ const styleConfig = {
95
95
  const replaceConfig = {
96
96
  preventAssignment: true,
97
97
  values: {
98
- 'process.env.MUON_PREFIX': JSON.stringify(config?.components?.prefix) || JSON.stringify('muon')
98
+ 'process.env.MUON_PREFIX': JSON.stringify(config?.components?.prefix || 'muon')
99
99
  }
100
100
  };
101
101
 
@@ -65,7 +65,7 @@ const filterPathToCustomElements = async (componentsList) => {
65
65
  };
66
66
 
67
67
  const findComponents = async () => {
68
- const config = await getConfig();
68
+ const config = getConfig();
69
69
  const additional = config?.components?.dir;
70
70
  const componentsList = config?.components?.included;
71
71
  const pathPattern = await filterPathToCustomElements(componentsList);
@@ -98,37 +98,6 @@ const analyze = async () => {
98
98
  });
99
99
  };
100
100
 
101
- const createComponentElementsJson = async (files) => {
102
- if (!files) {
103
- files = await findComponents();
104
- }
105
- const config = await getConfig();
106
- const destination = config.destination || 'dist';
107
-
108
- const results = await analyzeAndTransformGlobs(files, {
109
- format: 'json',
110
- discoverNodeModules: true,
111
- analyzeDependencies: true
112
- });
113
-
114
- const jsonResults = JSON.parse(results);
115
- const tagNames = jsonResults?.tags.map((tag) => tag.name);
116
- const tagsSet = new Set(tagNames);
117
- if (tagsSet?.size !== tagNames?.length) {
118
- console.error('---------------------------------------------');
119
- console.error('No two custom elements can have same tag name `%s`', tagNames);
120
- console.error('---------------------------------------------');
121
- process.exit(1);
122
- }
123
-
124
- const content = JSON.parse(fs.readFileSync(path.join(destination, 'custom-elements.json')));
125
-
126
- if (!deepEqual(content, jsonResults)) {
127
- fs.writeFileSync(path.join(destination, 'custom-elements.json'), results);
128
- }
129
- return results;
130
- };
131
-
132
101
  const getAliasPaths = (type) => {
133
102
  const defaultPaths = {
134
103
  '@muon/components/*': '@muonic/muon/components/*',
@@ -138,7 +107,7 @@ const getAliasPaths = (type) => {
138
107
  '@muon/tokens': '@muonic/muon/build/tokens/es6/muon-tokens'
139
108
  };
140
109
 
141
- const config = getConfig(`muon.config.json`);
110
+ const config = getConfig();
142
111
  const alias = config?.alias || {};
143
112
 
144
113
  if (type === 'glob') {
@@ -230,11 +199,19 @@ const sourceFilesAnalyzer = async () => {
230
199
  }
231
200
  }));
232
201
 
202
+ const tagNames = results?.map((result) => result.componentDefinitions[0].tagName);
203
+ const tagsSet = new Set(tagNames);
204
+ if (tagsSet?.size !== tagNames?.length) {
205
+ console.error('---------------------------------------------');
206
+ console.error('No two custom elements can have same tag name `%s`', tagNames);
207
+ console.error('---------------------------------------------');
208
+ process.exit(1);
209
+ }
233
210
  return transformAnalyzerResult('json', results, program);
234
211
  };
235
212
 
236
213
  const styleDictionary = async () => {
237
- const config = await getConfig();
214
+ const config = getConfig();
238
215
 
239
216
  // Set the overriding tokens if there are any
240
217
  if (config.tokens && config.tokens.dir) {
@@ -273,7 +250,7 @@ const createTokens = async () => {
273
250
  };
274
251
 
275
252
  const componentDefiner = async () => {
276
- const config = await getConfig();
253
+ const config = getConfig();
277
254
  const compList = await analyze();
278
255
  const prefix = config?.components?.prefix || 'muon';
279
256
  let componentDefinition = `import '@webcomponents/scoped-custom-element-registry';`;
@@ -299,14 +276,10 @@ const runner = async (file, overrideDestination) => {
299
276
  };
300
277
 
301
278
  export {
302
- cleanup,
303
279
  getConfig,
304
- createComponentElementsJson,
305
280
  filterPathToCustomElements,
306
- styleDictionary,
307
281
  createTokens,
308
282
  componentDefiner,
309
- findComponents,
310
283
  runner,
311
284
  sourceFilesAnalyzer,
312
285
  getAliasPaths
@@ -5,7 +5,7 @@ const pathIsInside = require('path-is-inside');
5
5
  const findStories = async (dir = process.cwd()) => {
6
6
  const { getConfig, filterPathToCustomElements } = await import('../scripts/utils/index.mjs');
7
7
 
8
- const config = await getConfig();
8
+ const config = getConfig();
9
9
  const componentsList = config?.components?.included;
10
10
 
11
11
  if (!componentsList) {