@muonic/muon 0.0.2-experimental-139-b12e3fd.0 → 0.0.2-experimental-142-e1fad5a.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-
|
|
3
|
+
"version": "0.0.2-experimental-142-e1fad5a.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
},
|
|
11
11
|
"bin": {
|
|
12
12
|
"muon-serve": "./scripts/serve/index.mjs",
|
|
13
|
-
"muon-build-styles": "./scripts/build/styles/index.mjs",
|
|
14
13
|
"muon-build-storybook": "./scripts/build/storybook/index.mjs"
|
|
15
14
|
},
|
|
16
15
|
"keywords": [],
|
|
@@ -36,6 +35,7 @@
|
|
|
36
35
|
"deep-equal": "^2.0.5",
|
|
37
36
|
"deepmerge": "4.2.2",
|
|
38
37
|
"glob": "8.0.3",
|
|
38
|
+
"glob-to-regexp": "0.4.1",
|
|
39
39
|
"lit": "2.2.7",
|
|
40
40
|
"lodash": "4.17.21",
|
|
41
41
|
"path-is-inside": "1.0.2",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"rollup-plugin-lit-css": "4.0.0",
|
|
48
48
|
"rollup-plugin-styles": "4.0.0",
|
|
49
49
|
"style-dictionary": "3.7.1",
|
|
50
|
-
"
|
|
50
|
+
"typescript": "4.8.2",
|
|
51
51
|
"web-component-analyzer": "1.1.6"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
@@ -6,25 +6,6 @@ import fs from 'fs';
|
|
|
6
6
|
|
|
7
7
|
import commandLineArgs from 'command-line-args';
|
|
8
8
|
|
|
9
|
-
import { createTokens, createComponentElementsJson } from '../../utils/index.mjs';
|
|
10
|
-
|
|
11
|
-
import postcss from 'postcss';
|
|
12
|
-
import { postcssPlugins } from '../../rollup-plugins.mjs';
|
|
13
|
-
|
|
14
|
-
import { fileURLToPath } from 'url';
|
|
15
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
-
|
|
17
|
-
const globalCSSUrl = path.join(__filename, '..', '..', '..', '..', 'css', 'global.css');
|
|
18
|
-
|
|
19
|
-
// @TODO: make reusable
|
|
20
|
-
const createGlobalCSS = async (destination) => {
|
|
21
|
-
const globalCSSDest = path.join(destination, 'muon.min.css');
|
|
22
|
-
const globalCSS = await fs.readFileSync(globalCSSUrl);
|
|
23
|
-
const processedCSS = await postcss(postcssPlugins).process(globalCSS, { from: globalCSSUrl, to: globalCSSDest });
|
|
24
|
-
|
|
25
|
-
fs.writeFileSync(globalCSSDest, processedCSS.css, 'utf8');
|
|
26
|
-
};
|
|
27
|
-
|
|
28
9
|
const args = commandLineArgs([
|
|
29
10
|
{
|
|
30
11
|
name: 'config-dir',
|
|
@@ -54,10 +35,6 @@ const main = async () => {
|
|
|
54
35
|
fs.mkdirSync(outputDir);
|
|
55
36
|
}
|
|
56
37
|
|
|
57
|
-
await createTokens();
|
|
58
|
-
// await createComponentElementsJson('dist');
|
|
59
|
-
await createGlobalCSS('dist');
|
|
60
|
-
|
|
61
38
|
execSync(`build-storybook --output-dir ${outputDir} --config-dir ${configDir}`);
|
|
62
39
|
|
|
63
40
|
console.log('Storybook build completed');
|
|
@@ -7,80 +7,41 @@ import postcssPreset from 'postcss-preset-env';
|
|
|
7
7
|
import postcssImport from 'postcss-import';
|
|
8
8
|
import postcssVariables from 'postcss-simple-vars';
|
|
9
9
|
import litcssPlugin from 'rollup-plugin-lit-css';
|
|
10
|
-
import
|
|
11
|
-
import { findComponents, getConfig, createComponentElementsJson } from './utils/index.mjs';
|
|
10
|
+
import { getConfig, createTokens, sourceFilesAnalyzer, getAliasPaths } from './utils/index.mjs';
|
|
12
11
|
|
|
13
|
-
import { dirSync } from 'tmp';
|
|
14
|
-
import fs from 'fs';
|
|
15
12
|
import path from 'path';
|
|
13
|
+
import fs from 'fs';
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const tmpName = tmp.name;
|
|
21
|
-
|
|
22
|
-
const writeFileSyncRecursive = (filename, content = '') => {
|
|
23
|
-
fs.mkdirSync(path.dirname(filename), { recursive: true });
|
|
24
|
-
fs.writeFileSync(filename, content);
|
|
25
|
-
};
|
|
15
|
+
import { fileURLToPath } from 'url';
|
|
16
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
+
const __dirname = path.dirname(__filename);
|
|
26
18
|
|
|
27
|
-
const
|
|
19
|
+
const config = getConfig(`muon.config.json`);
|
|
28
20
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
const muonPlugin = () => {
|
|
22
|
+
return {
|
|
23
|
+
name: 'muon',
|
|
24
|
+
async buildStart() {
|
|
25
|
+
const destination = config?.destination || 'dist';
|
|
26
|
+
if (!fs.existsSync(destination)) {
|
|
27
|
+
fs.mkdirSync(destination, { recursive: true });
|
|
28
|
+
}
|
|
29
|
+
const cejson = await sourceFilesAnalyzer();
|
|
33
30
|
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
fs.writeFileSync(path.join(destination, 'custom-elements.json'), cejson);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
36
34
|
};
|
|
37
35
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
if (!fs.existsSync(destination)) {
|
|
41
|
-
fs.mkdirSync(destination, { recursive: true });
|
|
42
|
-
}
|
|
43
|
-
fs.writeFileSync(path.join(destination, 'custom-elements.json'), JSON.stringify({ tags: [] }));
|
|
44
|
-
};
|
|
36
|
+
const tokenPath = path.join(__dirname, '..', 'build', 'tokens', 'es6', 'muon-tokens.mjs');
|
|
37
|
+
let designTokens = {};
|
|
45
38
|
|
|
46
|
-
|
|
47
|
-
const analyzerPlugin = () => {
|
|
39
|
+
const buildTokensPlugin = () => {
|
|
48
40
|
return {
|
|
49
|
-
name: '
|
|
50
|
-
async moduleParsed(obj) {
|
|
51
|
-
if (shouldSkip(obj.id)) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
writeFileSyncRecursive(getTmpFilePath(tmpName, obj.id), obj.code);
|
|
55
|
-
if (createElementJsonTimer) {
|
|
56
|
-
clearTimeout(createElementJsonTimer);
|
|
57
|
-
}
|
|
58
|
-
createElementJsonTimer = setTimeout(runElementJson, 500);
|
|
59
|
-
},
|
|
60
|
-
async serverStart() {
|
|
61
|
-
await createElementJsonFile();
|
|
62
|
-
},
|
|
63
|
-
serverStop() {
|
|
64
|
-
tmp.removeCallback();
|
|
65
|
-
},
|
|
41
|
+
name: 'generate-tokens-plugin',
|
|
66
42
|
async buildStart() {
|
|
67
|
-
await
|
|
68
|
-
|
|
69
|
-
async buildEnd() {
|
|
70
|
-
tmp.removeCallback();
|
|
71
|
-
},
|
|
72
|
-
async generateBundle(options, bundle) {
|
|
73
|
-
let code = '';
|
|
74
|
-
Object.keys(bundle).forEach((file) => {
|
|
75
|
-
Object.keys(bundle[file].modules).forEach((module) => {
|
|
76
|
-
code += `
|
|
77
|
-
${bundle[file].modules[module].code}
|
|
78
|
-
`;
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
writeFileSyncRecursive(getTmpFilePath(tmpName, 'code.js'), code);
|
|
83
|
-
createComponentElementsJson([getTmpFilePath(tmpName, 'code.js')]);
|
|
43
|
+
await createTokens();
|
|
44
|
+
designTokens = await import(tokenPath);
|
|
84
45
|
}
|
|
85
46
|
};
|
|
86
47
|
};
|
|
@@ -89,29 +50,18 @@ const styles = fromRollup(stylesPlugin);
|
|
|
89
50
|
const replace = fromRollup(replacePlugin);
|
|
90
51
|
const litcss = fromRollup(litcssPlugin);
|
|
91
52
|
const alias = fromRollup(aliasPlugin);
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
const additionalAlias = config?.alias?.map(({ find, replacement }) => {
|
|
95
|
-
return {
|
|
96
|
-
find,
|
|
97
|
-
replacement: path.join(process.cwd(), replacement)
|
|
98
|
-
};
|
|
99
|
-
}).filter((alias) => alias) ?? [];
|
|
53
|
+
const muon = fromRollup(muonPlugin);
|
|
54
|
+
const buildTokens = fromRollup(buildTokensPlugin);
|
|
100
55
|
|
|
101
56
|
const aliasConfig = {
|
|
102
|
-
entries:
|
|
103
|
-
...additionalAlias,
|
|
104
|
-
{ find: /^@muon\/components\/(.*)/, replacement: '@muonic/muon/components/$1' },
|
|
105
|
-
{ find: /^@muon\/mixins\/(.*)/, replacement: '@muonic/muon/mixins/$1' },
|
|
106
|
-
{ find: /^@muon\/directives\/(.*)/, replacement: '@muonic/muon/directives/$1' },
|
|
107
|
-
{ find: /^@muon\/utils\/(.*)/, replacement: '@muonic/muon/utils/$1' },
|
|
108
|
-
{ find: '@muon/tokens', replacement: '@muonic/muon/build/tokens/es6/muon-tokens' }
|
|
109
|
-
]
|
|
57
|
+
entries: getAliasPaths('regex')
|
|
110
58
|
};
|
|
111
59
|
|
|
112
|
-
|
|
60
|
+
const postcssPlugins = [
|
|
113
61
|
postcssVariables({
|
|
114
|
-
variables
|
|
62
|
+
variables() {
|
|
63
|
+
return designTokens;
|
|
64
|
+
},
|
|
115
65
|
unknown(node) {
|
|
116
66
|
node.remove(); // removing unknown or unset tokens
|
|
117
67
|
}
|
|
@@ -126,6 +76,16 @@ export const postcssPlugins = [
|
|
|
126
76
|
autoprefixer({ grid: true })
|
|
127
77
|
];
|
|
128
78
|
|
|
79
|
+
// @TODO: bring back when global css is used
|
|
80
|
+
// const createGlobalCSS = async (destination) => {
|
|
81
|
+
// const globalCSSUrl = path.join(__filename, '..', '..', '..', 'css', 'global.css');
|
|
82
|
+
// const globalCSSDest = path.join(destination, 'muon.min.css');
|
|
83
|
+
// const globalCSS = fs.readFileSync(globalCSSUrl);
|
|
84
|
+
// const processedCSS = await postcss(postcssPlugins).process(globalCSS, { from: globalCSSUrl, to: globalCSSDest });
|
|
85
|
+
|
|
86
|
+
// fs.writeFileSync(globalCSSDest, processedCSS.css, 'utf8');
|
|
87
|
+
// };
|
|
88
|
+
|
|
129
89
|
const styleConfig = {
|
|
130
90
|
mode: 'emit',
|
|
131
91
|
minimize: true,
|
|
@@ -140,17 +100,19 @@ const replaceConfig = {
|
|
|
140
100
|
};
|
|
141
101
|
|
|
142
102
|
export const serverPlugins = [
|
|
103
|
+
buildTokens(),
|
|
143
104
|
alias(aliasConfig),
|
|
144
105
|
replace(replaceConfig),
|
|
145
106
|
styles(styleConfig),
|
|
146
107
|
litcss({ exclude: ['**/css/*.css', '**/dist/*.css', 'muon.min.css'] }),
|
|
147
|
-
|
|
108
|
+
muon()
|
|
148
109
|
];
|
|
149
110
|
|
|
150
111
|
export const rollupPlugins = [
|
|
112
|
+
buildTokensPlugin(),
|
|
151
113
|
aliasPlugin(aliasConfig),
|
|
152
114
|
replacePlugin(replaceConfig),
|
|
153
115
|
stylesPlugin(styleConfig),
|
|
154
116
|
litcssPlugin({ exclude: ['**/css/*.css', '**/dist/*.css', 'muon.min.css'] }),
|
|
155
|
-
|
|
117
|
+
muonPlugin()
|
|
156
118
|
];
|
package/scripts/serve/run.mjs
CHANGED
|
@@ -1,72 +1,15 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import chokidar from 'chokidar';
|
|
4
1
|
import { startDevServer } from '@web/dev-server';
|
|
5
2
|
import commandLineArgs from 'command-line-args';
|
|
6
3
|
import StorybookConfig from '../../storybook/server.config.mjs';
|
|
7
|
-
import { getConfig, createTokens } from '../utils/index.mjs';
|
|
8
|
-
|
|
9
|
-
import postcss from 'postcss';
|
|
10
|
-
import { postcssPlugins } from '../rollup-plugins.mjs';
|
|
11
|
-
|
|
12
|
-
import { fileURLToPath } from 'url';
|
|
13
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
-
|
|
15
|
-
const globalCSSUrl = path.join(__filename, '..', '..', '..', 'css', 'global.css');
|
|
16
4
|
|
|
17
5
|
const myServerDefinitions = [
|
|
18
6
|
{ name: 'no-open', type: Boolean },
|
|
19
7
|
{ name: 'no-watch', type: Boolean },
|
|
20
8
|
];
|
|
21
9
|
|
|
22
|
-
const copyDir = async (src, dest) => {
|
|
23
|
-
fs.mkdirSync(dest, { recursive: true });
|
|
24
|
-
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
25
|
-
|
|
26
|
-
for (const entry of entries) {
|
|
27
|
-
const srcPath = path.join(src, entry.name);
|
|
28
|
-
const destPath = path.join(dest, entry.name);
|
|
29
|
-
|
|
30
|
-
entry.isDirectory() ?
|
|
31
|
-
await copyDir(srcPath, destPath) :
|
|
32
|
-
fs.copyFileSync(srcPath, destPath);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const createGlobalCSS = async (destination) => {
|
|
37
|
-
const globalCSSDest = path.join(destination, 'muon.min.css');
|
|
38
|
-
const globalCSS = await fs.readFileSync(globalCSSUrl);
|
|
39
|
-
const processedCSS = await postcss(postcssPlugins).process(globalCSS, { from: globalCSSUrl, to: globalCSSDest });
|
|
40
|
-
|
|
41
|
-
fs.writeFileSync(globalCSSDest, processedCSS.css, 'utf8');
|
|
42
|
-
};
|
|
43
|
-
|
|
44
10
|
const myConfig = commandLineArgs(myServerDefinitions, { partial: true });
|
|
45
11
|
|
|
46
|
-
const createStyleTokens = async (destination) => {
|
|
47
|
-
await createGlobalCSS(destination);
|
|
48
|
-
|
|
49
|
-
copyDir(path.join(__filename, '..', '..', '..', 'build'), destination);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const updateStyleTokens = async (destination) => {
|
|
53
|
-
await createTokens();
|
|
54
|
-
await createStyleTokens(destination);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
12
|
const main = async () => {
|
|
58
|
-
const config = await getConfig();
|
|
59
|
-
const destination = config?.destination || 'dist';
|
|
60
|
-
|
|
61
|
-
await createStyleTokens(destination);
|
|
62
|
-
|
|
63
|
-
/* Internal dev mode */
|
|
64
|
-
chokidar.watch(globalCSSUrl, { ignoreInitial: true }).on('all', async () => {
|
|
65
|
-
await createGlobalCSS(destination);
|
|
66
|
-
});
|
|
67
|
-
chokidar.watch(path.join(__filename, '..', '..', 'tokens'), { ignoreInitial: true }).on('all', () => updateStyleTokens(destination));
|
|
68
|
-
chokidar.watch('tokens', { ignoreInitial: true }).on('all', () => updateStyleTokens(destination));
|
|
69
|
-
|
|
70
13
|
await startDevServer({
|
|
71
14
|
argv: myConfig._unknown,
|
|
72
15
|
config: {
|
package/scripts/utils/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { analyzeText, analyzeSourceFile, transformAnalyzerResult } from 'web-component-analyzer';
|
|
2
3
|
import { analyzeAndTransformGlobs } from 'web-component-analyzer/lib/cjs/cli.js';
|
|
3
4
|
import StyleDictionary from 'style-dictionary';
|
|
4
5
|
import formatHelpers from 'style-dictionary/lib/common/formatHelpers/index.js';
|
|
@@ -6,6 +7,7 @@ import _ from 'lodash';
|
|
|
6
7
|
import appRoot from 'app-root-path';
|
|
7
8
|
import deepEqual from 'deep-equal';
|
|
8
9
|
import glob from 'glob';
|
|
10
|
+
import globToRegExp from 'glob-to-regexp';
|
|
9
11
|
import fs from 'fs';
|
|
10
12
|
import path from 'path';
|
|
11
13
|
|
|
@@ -14,6 +16,7 @@ import colorTransform from '../../tokens/utils/transforms/color.js';
|
|
|
14
16
|
import stringTransform from '../../tokens/utils/transforms/string.js';
|
|
15
17
|
|
|
16
18
|
import { fileURLToPath } from 'url';
|
|
19
|
+
|
|
17
20
|
const __filename = fileURLToPath(import.meta.url);
|
|
18
21
|
const __dirname = path.dirname(__filename);
|
|
19
22
|
|
|
@@ -103,7 +106,9 @@ const createComponentElementsJson = async (files) => {
|
|
|
103
106
|
const destination = config.destination || 'dist';
|
|
104
107
|
|
|
105
108
|
const results = await analyzeAndTransformGlobs(files, {
|
|
106
|
-
format: 'json'
|
|
109
|
+
format: 'json',
|
|
110
|
+
discoverNodeModules: true,
|
|
111
|
+
analyzeDependencies: true
|
|
107
112
|
});
|
|
108
113
|
|
|
109
114
|
const jsonResults = JSON.parse(results);
|
|
@@ -124,6 +129,110 @@ const createComponentElementsJson = async (files) => {
|
|
|
124
129
|
return results;
|
|
125
130
|
};
|
|
126
131
|
|
|
132
|
+
const getAliasPaths = (type) => {
|
|
133
|
+
const defaultPaths = {
|
|
134
|
+
'@muon/components/*': '@muonic/muon/components/*',
|
|
135
|
+
'@muon/mixins/*': '@muonic/muon/mixins/*',
|
|
136
|
+
'@muon/directives/*': '@muonic/muon/directives/*',
|
|
137
|
+
'@muon/utils/*': '@muonic/muon/utils/*',
|
|
138
|
+
'@muon/tokens': '@muonic/muon/build/tokens/es6/muon-tokens'
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const config = getConfig(`muon.config.json`);
|
|
142
|
+
const alias = config?.alias || {};
|
|
143
|
+
|
|
144
|
+
if (type === 'glob') {
|
|
145
|
+
const paths = {
|
|
146
|
+
...alias,
|
|
147
|
+
...defaultPaths
|
|
148
|
+
};
|
|
149
|
+
const obj = {};
|
|
150
|
+
|
|
151
|
+
Object.keys(paths).forEach((key) => {
|
|
152
|
+
const value = paths[key];
|
|
153
|
+
if (
|
|
154
|
+
value.startsWith('./') ||
|
|
155
|
+
value.startsWith('../') ||
|
|
156
|
+
value.startsWith('/')
|
|
157
|
+
) {
|
|
158
|
+
obj[key] = [value];
|
|
159
|
+
} else {
|
|
160
|
+
// @TODO: This needs a better way to find the node_modules folder
|
|
161
|
+
obj[key] = [`node_modules/${value}`];
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
return obj;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (type === 'regex') {
|
|
169
|
+
const objGlobToRegexArr = (paths) => {
|
|
170
|
+
if (!paths) {
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return Object.keys(paths).map((key) => {
|
|
175
|
+
//TODO: What happens if someone uses ** in their glob?
|
|
176
|
+
const regKey = globToRegExp(key.replaceAll('*', '{*}'), { extended: true });
|
|
177
|
+
//@TODO: See how to replace * better
|
|
178
|
+
return { find: regKey, replacement: paths[key].replaceAll('*', '$1') };
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const additionalAlias = objGlobToRegexArr(config?.alias)?.map(({ find, replacement }) => {
|
|
183
|
+
return {
|
|
184
|
+
find,
|
|
185
|
+
replacement: path.join(process.cwd(), replacement)
|
|
186
|
+
};
|
|
187
|
+
}).filter((alias) => alias) ?? [];
|
|
188
|
+
|
|
189
|
+
const defaultAlias = objGlobToRegexArr(defaultPaths);
|
|
190
|
+
|
|
191
|
+
return [...additionalAlias, ...defaultAlias];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return undefined;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const sourceFilesAnalyzer = async () => {
|
|
198
|
+
const files = await findComponents();
|
|
199
|
+
const paths = await getAliasPaths('glob');
|
|
200
|
+
const options = {
|
|
201
|
+
noEmitOnError: false,
|
|
202
|
+
allowJs: true,
|
|
203
|
+
maxNodeModuleJsDepth: 3,
|
|
204
|
+
experimentalDecorators: true,
|
|
205
|
+
target: ts.ScriptTarget.Latest,
|
|
206
|
+
downlevelIteration: true,
|
|
207
|
+
module: ts.ModuleKind.ESNext,
|
|
208
|
+
strictNullChecks: true,
|
|
209
|
+
moduleResolution: ts.ModuleResolutionKind.NodeJs,
|
|
210
|
+
esModuleInterop: true,
|
|
211
|
+
noEmit: true,
|
|
212
|
+
allowSyntheticDefaultImports: true,
|
|
213
|
+
allowUnreachableCode: true,
|
|
214
|
+
allowUnusedLabels: true,
|
|
215
|
+
skipLibCheck: true,
|
|
216
|
+
baseUrl: '.',
|
|
217
|
+
paths
|
|
218
|
+
};
|
|
219
|
+
const filePaths = Array.isArray(files) ? files : [files];
|
|
220
|
+
const program = ts.createProgram(filePaths, options);
|
|
221
|
+
const sourceFiles = program.getSourceFiles().filter((sf) => files.includes(sf.fileName));
|
|
222
|
+
|
|
223
|
+
const results = sourceFiles.map((sourceFile) => analyzeSourceFile(sourceFile, {
|
|
224
|
+
ts,
|
|
225
|
+
program,
|
|
226
|
+
verbose: true,
|
|
227
|
+
config: {
|
|
228
|
+
format: 'json',
|
|
229
|
+
discoverNodeModules: true
|
|
230
|
+
}
|
|
231
|
+
}));
|
|
232
|
+
|
|
233
|
+
return transformAnalyzerResult('json', results, program);
|
|
234
|
+
};
|
|
235
|
+
|
|
127
236
|
const styleDictionary = async () => {
|
|
128
237
|
const config = await getConfig();
|
|
129
238
|
|
|
@@ -185,8 +294,6 @@ const runner = async (file, overrideDestination) => {
|
|
|
185
294
|
const destination = overrideDestination || config?.destination || 'dist';
|
|
186
295
|
|
|
187
296
|
cleanup(destination).then(async () => {
|
|
188
|
-
await createTokens();
|
|
189
|
-
|
|
190
297
|
import(file);
|
|
191
298
|
});
|
|
192
299
|
};
|
|
@@ -200,5 +307,7 @@ export {
|
|
|
200
307
|
createTokens,
|
|
201
308
|
componentDefiner,
|
|
202
309
|
findComponents,
|
|
203
|
-
runner
|
|
310
|
+
runner,
|
|
311
|
+
sourceFilesAnalyzer,
|
|
312
|
+
getAliasPaths
|
|
204
313
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { playwrightLauncher } from '@web/test-runner-playwright';
|
|
2
2
|
import { serverPlugins } from '@muonic/muon/scripts/rollup-plugins.mjs';
|
|
3
3
|
import { checkRunSnapshots } from './tests/runner/commands.mjs';
|
|
4
|
-
// process.env.MUON_PREFIX = 'testing';
|
|
5
4
|
|
|
6
5
|
export default {
|
|
7
6
|
testRunnerHtml: (testFramework) =>
|