@omnia/tooling 8.0.194-dev → 8.0.196-dev

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1,6 @@
1
- export declare function replaceTokens(content: string): string;
1
+ export interface IGlobalThisReplaceToken {
2
+ o$: {
3
+ enums: any;
4
+ };
5
+ enum$: any;
6
+ }
@@ -1,36 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceTokens = void 0;
4
- globalThis["o$"] = {
3
+ const _globalThis = globalThis;
4
+ _globalThis.o$ = {
5
5
  enums: {}
6
6
  };
7
- function replaceTokens(content) {
8
- return content.replace(new RegExp(`(o\\$.*)([a-z])`), function (token) {
9
- if (token.indexOf("o$.") === 0) {
10
- const result = getTokenValue(token);
11
- if (typeof result === "string") {
12
- return `"${result}"`;
13
- }
14
- return result;
15
- }
16
- return token;
17
- });
18
- }
19
- exports.replaceTokens = replaceTokens;
20
- function getTokenValue(token) {
21
- const parts = token.split(".");
22
- let value = globalThis;
23
- parts.forEach(p => {
24
- value = value[p];
25
- });
26
- // console.log(token, parts, value, (globalThis as any)["o$"])
27
- return value;
28
- }
29
- function populateEnums(name) {
7
+ function addEnums(name) {
30
8
  return {
31
9
  value(data) {
32
- globalThis["o$"].enums[name] = data;
10
+ _globalThis.o$.enums[name] = data;
33
11
  }
34
12
  };
35
13
  }
36
- globalThis["enum$"] = populateEnums;
14
+ _globalThis.enum$ = addEnums;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/tooling",
3
3
  "license": "MIT",
4
- "version": "8.0.194-dev",
4
+ "version": "8.0.196-dev",
5
5
  "description": "Provide basic stuffs extensible for omnia extension.",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "main": "index.js",
28
28
  "dependencies": {
29
- "@omnia/types": "8.0.194-dev",
29
+ "@omnia/types": "8.0.196-dev",
30
30
  "@types/node": "18.13.0",
31
31
  "tslib": "2.6.2",
32
32
  "typescript": "5.3.3",