@breadstone-tools/cem-app 0.0.12-beta.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/Index.d.ts +3 -0
- package/Index.d.ts.map +1 -0
- package/Index.js +6 -0
- package/Index.js.map +1 -0
- package/LICENSE +21 -0
- package/Run.d.ts +24 -0
- package/Run.d.ts.map +1 -0
- package/Run.js +93 -0
- package/Run.js.map +1 -0
- package/package.json +24 -0
package/Index.d.ts
ADDED
package/Index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Index.d.ts","sourceRoot":"","sources":["../src/Index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC"}
|
package/Index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.run = void 0;
|
|
4
|
+
var Run_js_1 = require("./Run.js");
|
|
5
|
+
Object.defineProperty(exports, "run", { enumerable: true, get: function () { return Run_js_1.run; } });
|
|
6
|
+
//# sourceMappingURL=Index.js.map
|
package/Index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Index.js","sourceRoot":"","sources":["../src/Index.ts"],"names":[],"mappings":";;;AACA,mCAA+B;AAAtB,6FAAA,GAAG,OAAA"}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Breadstone
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/Run.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ILogger } from '@breadstone-infrastructure/utilities';
|
|
2
|
+
import type { IPlugin } from '@breadstone-tools/cem-plugin';
|
|
3
|
+
import ts from 'typescript';
|
|
4
|
+
export interface IRunConfig {
|
|
5
|
+
debug?: boolean;
|
|
6
|
+
verbose?: boolean;
|
|
7
|
+
quiet?: boolean;
|
|
8
|
+
globs?: Array<string>;
|
|
9
|
+
exclude?: Array<string>;
|
|
10
|
+
outdir?: string;
|
|
11
|
+
framework?: 'lit' | 'stencil' | 'fast' | 'catalyst';
|
|
12
|
+
plugins?: Array<IPlugin>;
|
|
13
|
+
logger?: ILogger;
|
|
14
|
+
overrideModuleCreation?: (ts: typeof import('typescript'), globs: Array<string>) => Array<ts.SourceFile>;
|
|
15
|
+
}
|
|
16
|
+
export interface IRunResult {
|
|
17
|
+
manifest: {
|
|
18
|
+
schemaVersion: string;
|
|
19
|
+
readme: string;
|
|
20
|
+
modules: Array<any>;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare function run(config: IRunConfig): IRunResult;
|
|
24
|
+
//# sourceMappingURL=Run.d.ts.map
|
package/Run.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Run.d.ts","sourceRoot":"","sources":["../src/Run.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwC,KAAK,OAAO,EAAQ,MAAM,sCAAsC,CAAC;AAEhH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,MAAM,YAAY,CAAC;AAI5B,MAAM,WAAW,UAAU;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAIhB,SAAS,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;IACpD,OAAO,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sBAAsB,CAAC,EAAE,CAAC,EAAE,EAAE,cAAc,YAAY,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;CAC5G;AAED,MAAM,WAAW,UAAU;IACvB,QAAQ,EAAE;QACN,aAAa,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;KACvB,CAAC;CACL;AAED,wBAAgB,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAmDlD"}
|
package/Run.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.run = run;
|
|
8
|
+
const utilities_1 = require("@breadstone-infrastructure/utilities");
|
|
9
|
+
const cem_core_1 = require("@breadstone-tools/cem-core");
|
|
10
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
11
|
+
function run(config) {
|
|
12
|
+
const logger = config.logger ?? new utilities_1.ConsoleLogger();
|
|
13
|
+
logger.log(' starting analysis...');
|
|
14
|
+
logger.log(' reading sources...');
|
|
15
|
+
const compiler = initTs(typescript_1.default, globs(config.globs ?? []));
|
|
16
|
+
const sources = moduleCreation(config, compiler.program);
|
|
17
|
+
logger.debug(` > found ${(0, utilities_1.bold)(sources.length.toString())} sources`);
|
|
18
|
+
const manifestBuilder = new cem_core_1.ManifestBuilder({
|
|
19
|
+
compiler: {
|
|
20
|
+
program: compiler.program,
|
|
21
|
+
typeChecker: compiler.typeChecker
|
|
22
|
+
},
|
|
23
|
+
debug: config.debug,
|
|
24
|
+
quiet: config.quiet,
|
|
25
|
+
verbose: config.verbose,
|
|
26
|
+
logger: logger,
|
|
27
|
+
engine: new cem_core_1.ManifestEngine({
|
|
28
|
+
compiler: {
|
|
29
|
+
program: compiler.program,
|
|
30
|
+
typeChecker: compiler.typeChecker
|
|
31
|
+
},
|
|
32
|
+
debug: config.debug,
|
|
33
|
+
quiet: config.quiet,
|
|
34
|
+
verbose: config.verbose,
|
|
35
|
+
logger: logger,
|
|
36
|
+
framework: config.framework,
|
|
37
|
+
plugins: config.plugins ?? []
|
|
38
|
+
}),
|
|
39
|
+
framework: config.framework
|
|
40
|
+
});
|
|
41
|
+
const cwd = process.cwd();
|
|
42
|
+
const outdir = utilities_1.Path.combine(cwd, config.outdir ?? '');
|
|
43
|
+
if (!utilities_1.Directory.exists(outdir)) {
|
|
44
|
+
utilities_1.Directory.create(outdir);
|
|
45
|
+
}
|
|
46
|
+
const manifest = manifestBuilder.create(sources);
|
|
47
|
+
const outPath = utilities_1.Path.combine(outdir, 'custom-elements.json');
|
|
48
|
+
utilities_1.File.writeAllJson(outPath, manifest);
|
|
49
|
+
logger.log(' manifest created.');
|
|
50
|
+
logger.debug(` > ${(0, utilities_1.bold)(outPath)}`);
|
|
51
|
+
return {
|
|
52
|
+
manifest: manifest
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function globs(values) {
|
|
56
|
+
const IGNORE = [
|
|
57
|
+
'!node_modules/**/*.*',
|
|
58
|
+
'!bower_components/**/*.*',
|
|
59
|
+
'!**/*.test.{js,ts}',
|
|
60
|
+
'!**/*.suite.{js,ts}',
|
|
61
|
+
'!**/*.config.{js,ts}',
|
|
62
|
+
'!**/*.d.ts',
|
|
63
|
+
...values
|
|
64
|
+
];
|
|
65
|
+
return IGNORE;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Gets the TypeScript program for analysis
|
|
69
|
+
* @param ts Global TypeScript object
|
|
70
|
+
* @param globs File globs to analyze
|
|
71
|
+
* @param configName TypeScript config file name to use during analysis
|
|
72
|
+
* @returns The TypeScript program
|
|
73
|
+
*/
|
|
74
|
+
function initTs(ts, globs, configName = 'tsconfig.json') {
|
|
75
|
+
const tsConfigFile = ts.findConfigFile(process.cwd(), ts.sys.fileExists, configName);
|
|
76
|
+
if (!tsConfigFile) {
|
|
77
|
+
throw new Error('No tsconfig file found.');
|
|
78
|
+
}
|
|
79
|
+
const { config } = ts.readConfigFile(tsConfigFile, ts.sys.readFile);
|
|
80
|
+
const compilerOptions = ts.convertCompilerOptionsFromJson(config.compilerOptions ?? {}, '.');
|
|
81
|
+
const program = ts.createProgram(globs, compilerOptions.options);
|
|
82
|
+
const typeChecker = program.getTypeChecker();
|
|
83
|
+
return {
|
|
84
|
+
program,
|
|
85
|
+
typeChecker
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function moduleCreation(config, program) {
|
|
89
|
+
const files = utilities_1.File.glob(globs(config.globs ?? []));
|
|
90
|
+
const sourceFiles = files.map((file) => program.getSourceFile(file)).filter((sf) => sf !== undefined);
|
|
91
|
+
return sourceFiles;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=Run.js.map
|
package/Run.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Run.js","sourceRoot":"","sources":["../src/Run.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;;;AAiClB,kBAmDC;AAlFD,oEAAgH;AAChH,yDAA6E;AAE7E,4DAA4B;AA4B5B,SAAgB,GAAG,CAAC,MAAkB;IAClC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,IAAI,yBAAa,EAAE,CAAC;IAEpD,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;IACvC,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAErC,MAAM,QAAQ,GAAG,MAAM,CAAC,oBAAE,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAEzD,MAAM,CAAC,KAAK,CAAC,gBAAgB,IAAA,gBAAI,EAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,CAAC;IAExE,MAAM,eAAe,GAAG,IAAI,0BAAe,CAAC;QACxC,QAAQ,EAAE;YACN,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,WAAW,EAAE,QAAQ,CAAC,WAAW;SACpC;QACD,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,OAAO,EAAE,MAAM,CAAC,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;AACvB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@breadstone-tools/cem-app",
|
|
3
|
+
"description": "Custom Elements Manifest App",
|
|
4
|
+
"version": "0.0.12-beta.0",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "andre.wehlert <awehlert@breadstone.de> (https://www.breadstone.de)",
|
|
7
|
+
"repository": {
|
|
8
|
+
"url": "git+ssh://git@github.com/RueDeRennes/mosaik.git"
|
|
9
|
+
},
|
|
10
|
+
"type": "commonjs",
|
|
11
|
+
"main": "./Index.js",
|
|
12
|
+
"commonjs": "./Index.js",
|
|
13
|
+
"module": "./Index.js",
|
|
14
|
+
"types": "./Index.d.ts",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@breadstone-infrastructure/utilities": "0.0.12-beta.0",
|
|
17
|
+
"@breadstone-tools/cem-core": "^0.0.12-beta.0",
|
|
18
|
+
"@breadstone-tools/cem-infrastructure": "^0.0.12-beta.0",
|
|
19
|
+
"@breadstone-tools/cem-plugin": "^0.0.12-beta.0",
|
|
20
|
+
"comment-parser": "^1.4.1",
|
|
21
|
+
"es-module-lexer": "^1.7.0",
|
|
22
|
+
"typescript": "^5.8.3"
|
|
23
|
+
}
|
|
24
|
+
}
|