@superblocksteam/util 2.0.158 → 2.0.159-next.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 +1 -1
- package/.turbo/turbo-build.log +0 -4
- package/dist/api-files/api.d.mts +0 -8
- package/dist/api-files/api.d.mts.map +0 -1
- package/dist/api-files/api.mjs +0 -262
- package/dist/api-files/api.mjs.map +0 -1
- package/dist/api-files/constants.d.ts +0 -6
- package/dist/api-files/constants.d.ts.map +0 -1
- package/dist/api-files/constants.js +0 -9
- package/dist/api-files/constants.js.map +0 -1
- package/dist/api-files/index.d.ts +0 -8
- package/dist/api-files/index.d.ts.map +0 -1
- package/dist/api-files/index.js +0 -18
- package/dist/api-files/index.js.map +0 -1
- package/dist/api-files/types.d.ts +0 -115
- package/dist/api-files/types.d.ts.map +0 -1
- package/dist/api-files/types.js +0 -14
- package/dist/api-files/types.js.map +0 -1
- package/dist/component-configs.d.ts +0 -6
- package/dist/component-configs.d.ts.map +0 -1
- package/dist/component-configs.js +0 -178
- package/dist/component-configs.js.map +0 -1
- package/dist/constants.d.ts +0 -18
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -37
- package/dist/constants.js.map +0 -1
- package/dist/data-types.d.ts +0 -8
- package/dist/data-types.d.ts.map +0 -1
- package/dist/data-types.js +0 -22
- package/dist/data-types.js.map +0 -1
- package/dist/events.d.ts +0 -13
- package/dist/events.d.ts.map +0 -1
- package/dist/events.js +0 -17
- package/dist/events.js.map +0 -1
- package/dist/file-uploader.d.ts +0 -3
- package/dist/file-uploader.d.ts.map +0 -1
- package/dist/file-uploader.js +0 -41
- package/dist/file-uploader.js.map +0 -1
- package/dist/file-uploader.test.d.ts +0 -2
- package/dist/file-uploader.test.d.ts.map +0 -1
- package/dist/file-uploader.test.js +0 -43
- package/dist/file-uploader.test.js.map +0 -1
- package/dist/generate-component-types.d.ts +0 -3
- package/dist/generate-component-types.d.ts.map +0 -1
- package/dist/generate-component-types.js +0 -45
- package/dist/generate-component-types.js.map +0 -1
- package/dist/identifiers.d.ts +0 -9
- package/dist/identifiers.d.ts.map +0 -1
- package/dist/identifiers.js +0 -68
- package/dist/identifiers.js.map +0 -1
- package/dist/index.d.ts +0 -17
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/localGitRepoState.d.ts +0 -20
- package/dist/localGitRepoState.d.ts.map +0 -1
- package/dist/localGitRepoState.js +0 -3
- package/dist/localGitRepoState.js.map +0 -1
- package/dist/login.d.ts +0 -17
- package/dist/login.d.ts.map +0 -1
- package/dist/login.js +0 -74
- package/dist/login.js.map +0 -1
- package/dist/mask-unix-signals.d.ts +0 -28
- package/dist/mask-unix-signals.d.ts.map +0 -1
- package/dist/mask-unix-signals.js +0 -81
- package/dist/mask-unix-signals.js.map +0 -1
- package/dist/resource-configs.d.ts +0 -73
- package/dist/resource-configs.d.ts.map +0 -1
- package/dist/resource-configs.js +0 -224
- package/dist/resource-configs.js.map +0 -1
- package/dist/token-manager.d.ts +0 -22
- package/dist/token-manager.d.ts.map +0 -1
- package/dist/token-manager.js +0 -3
- package/dist/token-manager.js.map +0 -1
- package/dist/types.d.ts +0 -105
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
- package/dist/unreachable.d.ts +0 -2
- package/dist/unreachable.d.ts.map +0 -1
- package/dist/unreachable.js +0 -7
- package/dist/unreachable.js.map +0 -1
- package/dist/validation.d.ts +0 -5
- package/dist/validation.d.ts.map +0 -1
- package/dist/validation.js +0 -152
- package/dist/validation.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,178 +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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getContentType = void 0;
|
|
40
|
-
exports.getComponentConfigs = getComponentConfigs;
|
|
41
|
-
const node_child_process_1 = require("node:child_process");
|
|
42
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
43
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
44
|
-
const util = __importStar(require("node:util"));
|
|
45
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
46
|
-
const mime_types_1 = __importDefault(require("mime-types"));
|
|
47
|
-
const constants_js_1 = require("./constants.js");
|
|
48
|
-
const generate_component_types_js_1 = require("./generate-component-types.js");
|
|
49
|
-
const validation_js_1 = require("./validation.js");
|
|
50
|
-
const asyncExecFile = util.promisify(node_child_process_1.execFile);
|
|
51
|
-
async function compileTypeScript(inputFilePath, outputDir) {
|
|
52
|
-
try {
|
|
53
|
-
const tscPath = require.resolve("typescript/bin/tsc");
|
|
54
|
-
if (tscPath) {
|
|
55
|
-
const result = await asyncExecFile("node", [
|
|
56
|
-
tscPath,
|
|
57
|
-
node_path_1.default.resolve(inputFilePath),
|
|
58
|
-
"--outDir",
|
|
59
|
-
outputDir,
|
|
60
|
-
"--jsx",
|
|
61
|
-
"react-jsx",
|
|
62
|
-
"--target",
|
|
63
|
-
"es2019",
|
|
64
|
-
"--esModuleInterop",
|
|
65
|
-
"true",
|
|
66
|
-
"--moduleResolution",
|
|
67
|
-
"node",
|
|
68
|
-
"--module",
|
|
69
|
-
"es2022",
|
|
70
|
-
"--strict",
|
|
71
|
-
"true",
|
|
72
|
-
"--skipLibCheck",
|
|
73
|
-
"true",
|
|
74
|
-
]);
|
|
75
|
-
if (result.stdout || result.stderr) {
|
|
76
|
-
return {
|
|
77
|
-
output: result.stdout || result.stderr,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
return {
|
|
84
|
-
output: error.stdout || error.stderr,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
return {};
|
|
88
|
-
}
|
|
89
|
-
async function getFolderPaths() {
|
|
90
|
-
try {
|
|
91
|
-
const folderPaths = await fs_extra_1.default.readdir(constants_js_1.CUSTOM_COMPONENTS_PATH, {
|
|
92
|
-
withFileTypes: true,
|
|
93
|
-
});
|
|
94
|
-
// filter out any non-directory items
|
|
95
|
-
const directories = folderPaths.filter((dirent) => dirent.isDirectory() ||
|
|
96
|
-
(dirent.isSymbolicLink() &&
|
|
97
|
-
fs_extra_1.default
|
|
98
|
-
.statSync(node_path_1.default.join(constants_js_1.CUSTOM_COMPONENTS_PATH, dirent.name))
|
|
99
|
-
.isDirectory()));
|
|
100
|
-
// map each directory to its path
|
|
101
|
-
const folderPathsArray = directories.map((dirent) => node_path_1.default.join(constants_js_1.CUSTOM_COMPONENTS_PATH, dirent.name));
|
|
102
|
-
return folderPathsArray;
|
|
103
|
-
}
|
|
104
|
-
catch {
|
|
105
|
-
throw new Error("Could not access component directory, check your permissions");
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
async function getComponentConfigs(generateTypesFiles) {
|
|
109
|
-
const folderPaths = await getFolderPaths();
|
|
110
|
-
let hasError = false;
|
|
111
|
-
const promiseConfigFiles = folderPaths.map(async (ccpath) => {
|
|
112
|
-
const absPath = node_path_1.default.resolve(ccpath);
|
|
113
|
-
try {
|
|
114
|
-
const config = await fs_extra_1.default.readJSON(`${absPath}/config.json`);
|
|
115
|
-
console.log(`Found component in ${absPath}`);
|
|
116
|
-
return { ccpath, config };
|
|
117
|
-
}
|
|
118
|
-
catch {
|
|
119
|
-
// Noop because there is a fallback
|
|
120
|
-
}
|
|
121
|
-
// This is a tad complex to explain this hack but here's the context:
|
|
122
|
-
// We want to be able to hot reload the config.ts file, but we can't import it directly
|
|
123
|
-
// because it is going to get cached in the module cache and we dont have access to it to clear it
|
|
124
|
-
// so instead we copy the file to a new location with a random name and import that
|
|
125
|
-
// this is technically a memory leak, but you shouldnt really have a hot module server running forever
|
|
126
|
-
const rawPath = `${ccpath}/config.ts`;
|
|
127
|
-
const fileName = node_path_1.default.resolve(rawPath);
|
|
128
|
-
const outputDirectory = node_path_1.default.resolve(`${node_os_1.default.tmpdir()}/superblocks/${ccpath}/config.timestamp-${Date.now()}-${Math.random()
|
|
129
|
-
.toString(16)
|
|
130
|
-
.slice(2)}`);
|
|
131
|
-
await fs_extra_1.default.ensureDir(outputDirectory);
|
|
132
|
-
const compilationResult = await compileTypeScript(fileName, outputDirectory);
|
|
133
|
-
if (compilationResult.output) {
|
|
134
|
-
hasError = true;
|
|
135
|
-
if (compilationResult.output.includes(`Cannot find module`)) {
|
|
136
|
-
throw new Error("Could not find a module in node_modules. You likely need to run 'npm install'");
|
|
137
|
-
}
|
|
138
|
-
throw new Error(compilationResult.output);
|
|
139
|
-
}
|
|
140
|
-
console.log(`Typescript compiled to ${ccpath}`);
|
|
141
|
-
const config = (await import(outputDirectory + "/config.js")).default;
|
|
142
|
-
const isValid = (0, validation_js_1.validateCustomComponents)(config);
|
|
143
|
-
if (!isValid.valid) {
|
|
144
|
-
// Not throwing because we don't need a stack trace here
|
|
145
|
-
console.log(`Invalid config.ts file found`);
|
|
146
|
-
console.log(isValid.message);
|
|
147
|
-
hasError = true;
|
|
148
|
-
}
|
|
149
|
-
return { ccpath, config };
|
|
150
|
-
});
|
|
151
|
-
const configFiles = await Promise.all(promiseConfigFiles);
|
|
152
|
-
if (generateTypesFiles) {
|
|
153
|
-
for (const { config, ccpath } of configFiles) {
|
|
154
|
-
const typesFileContents = (0, generate_component_types_js_1.generateComponentTypesFile)(config);
|
|
155
|
-
await fs_extra_1.default.writeFile(`${ccpath}/types.ts`, typesFileContents);
|
|
156
|
-
console.log(`Generated ${ccpath}/types.ts`);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
const configs = configFiles
|
|
160
|
-
.filter((component) => component.config !== null)
|
|
161
|
-
.reduce((acc, { config }) => {
|
|
162
|
-
acc[config.id] = config;
|
|
163
|
-
return acc;
|
|
164
|
-
}, {});
|
|
165
|
-
return {
|
|
166
|
-
configs,
|
|
167
|
-
hasError,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
const getContentType = (filename) => {
|
|
171
|
-
const mimeType = mime_types_1.default.lookup(filename);
|
|
172
|
-
if (!mimeType) {
|
|
173
|
-
return "";
|
|
174
|
-
}
|
|
175
|
-
return mimeType;
|
|
176
|
-
};
|
|
177
|
-
exports.getContentType = getContentType;
|
|
178
|
-
//# sourceMappingURL=component-configs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-configs.js","sourceRoot":"","sources":["../src/component-configs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFA,kDAyEC;AA1JD,2DAA8C;AAC9C,sDAAyB;AACzB,0DAA6B;AAC7B,gDAAkC;AAElC,wDAA0B;AAC1B,4DAAmC;AAEnC,iDAAwD;AACxD,+EAA2E;AAC3E,mDAA2D;AAE3D,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,6BAAQ,CAAC,CAAC;AAE/C,KAAK,UAAU,iBAAiB,CAC9B,aAAqB,EACrB,SAAiB;IAEjB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACtD,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE;gBACzC,OAAO;gBACP,mBAAI,CAAC,OAAO,CAAC,aAAa,CAAC;gBAC3B,UAAU;gBACV,SAAS;gBACT,OAAO;gBACP,WAAW;gBACX,UAAU;gBACV,QAAQ;gBACR,mBAAmB;gBACnB,MAAM;gBACN,oBAAoB;gBACpB,MAAM;gBACN,UAAU;gBACV,QAAQ;gBACR,UAAU;gBACV,MAAM;gBACN,gBAAgB;gBAChB,MAAM;aACP,CAAC,CAAC;YACH,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBACnC,OAAO;oBACL,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM;iBACvC,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO;YACL,MAAM,EAAE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O,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,QAAkB,CAAC;AAC5B,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB"}
|
package/dist/constants.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare const SUPERBLOCKS_HOME_FOLDER_NAME = ".superblocks";
|
|
2
|
-
export declare const TOKEN_CONFIG_PATH = ".superblocks/auth.json";
|
|
3
|
-
export declare const RESOURCE_CONFIG_PATH = ".superblocks/superblocks.json";
|
|
4
|
-
export declare const DEV_ENVIRONMENT_CONFIG_PATH = ".superblocks/dev-environment.json";
|
|
5
|
-
export declare const CUSTOM_COMPONENTS_PATH = "components";
|
|
6
|
-
export declare class FileAccessError extends Error {
|
|
7
|
-
constructor(message: string);
|
|
8
|
-
}
|
|
9
|
-
export declare class NotFoundError extends Error {
|
|
10
|
-
constructor(message: string);
|
|
11
|
-
}
|
|
12
|
-
export declare class BadRequestError extends Error {
|
|
13
|
-
constructor(message: string);
|
|
14
|
-
}
|
|
15
|
-
export declare class ForbiddenError extends Error {
|
|
16
|
-
constructor(message: string);
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,iBAAiB,CAAC;AAC3D,eAAO,MAAM,iBAAiB,2BAA2B,CAAC;AAC1D,eAAO,MAAM,oBAAoB,kCAAkC,CAAC;AACpE,eAAO,MAAM,2BAA2B,sCAAsC,CAAC;AAE/E,eAAO,MAAM,sBAAsB,eAAe,CAAC;AAEnD,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,OAAO,EAAE,MAAM;CAI5B"}
|
package/dist/constants.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ForbiddenError = exports.BadRequestError = exports.NotFoundError = exports.FileAccessError = exports.CUSTOM_COMPONENTS_PATH = exports.DEV_ENVIRONMENT_CONFIG_PATH = exports.RESOURCE_CONFIG_PATH = exports.TOKEN_CONFIG_PATH = exports.SUPERBLOCKS_HOME_FOLDER_NAME = void 0;
|
|
4
|
-
exports.SUPERBLOCKS_HOME_FOLDER_NAME = ".superblocks";
|
|
5
|
-
exports.TOKEN_CONFIG_PATH = ".superblocks/auth.json";
|
|
6
|
-
exports.RESOURCE_CONFIG_PATH = ".superblocks/superblocks.json";
|
|
7
|
-
exports.DEV_ENVIRONMENT_CONFIG_PATH = ".superblocks/dev-environment.json";
|
|
8
|
-
exports.CUSTOM_COMPONENTS_PATH = "components";
|
|
9
|
-
class FileAccessError extends Error {
|
|
10
|
-
constructor(message) {
|
|
11
|
-
super(message);
|
|
12
|
-
this.name = "FileAccessError";
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.FileAccessError = FileAccessError;
|
|
16
|
-
class NotFoundError extends Error {
|
|
17
|
-
constructor(message) {
|
|
18
|
-
super(message);
|
|
19
|
-
this.name = "FileNotFoundError";
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.NotFoundError = NotFoundError;
|
|
23
|
-
class BadRequestError extends Error {
|
|
24
|
-
constructor(message) {
|
|
25
|
-
super(message);
|
|
26
|
-
this.name = "BadRequestError";
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.BadRequestError = BadRequestError;
|
|
30
|
-
class ForbiddenError extends Error {
|
|
31
|
-
constructor(message) {
|
|
32
|
-
super(message);
|
|
33
|
-
this.name = "ForbiddenError";
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.ForbiddenError = ForbiddenError;
|
|
37
|
-
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,4BAA4B,GAAG,cAAc,CAAC;AAC9C,QAAA,iBAAiB,GAAG,wBAAwB,CAAC;AAC7C,QAAA,oBAAoB,GAAG,+BAA+B,CAAC;AACvD,QAAA,2BAA2B,GAAG,mCAAmC,CAAC;AAElE,QAAA,sBAAsB,GAAG,YAAY,CAAC;AAEnD,MAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AALD,0CAKC;AAED,MAAa,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AALD,sCAKC;AAED,MAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AALD,0CAKC;AAED,MAAa,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AALD,wCAKC"}
|
package/dist/data-types.d.ts
DELETED
package/dist/data-types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-types.d.ts","sourceRoot":"","sources":["../src/data-types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,KAAK,CAAC;AAE/D,UAAU,QAAQ;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAiBxD,CAAC"}
|
package/dist/data-types.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dataTypeDefinions = void 0;
|
|
4
|
-
exports.dataTypeDefinions = {
|
|
5
|
-
string: {
|
|
6
|
-
tsType: "string",
|
|
7
|
-
prompt: "string",
|
|
8
|
-
},
|
|
9
|
-
number: {
|
|
10
|
-
tsType: "number",
|
|
11
|
-
prompt: "number",
|
|
12
|
-
},
|
|
13
|
-
boolean: {
|
|
14
|
-
tsType: "boolean",
|
|
15
|
-
prompt: "boolean",
|
|
16
|
-
},
|
|
17
|
-
any: {
|
|
18
|
-
tsType: "any",
|
|
19
|
-
prompt: "any (raw js expression)",
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=data-types.js.map
|
package/dist/data-types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-types.js","sourceRoot":"","sources":["../src/data-types.ts"],"names":[],"mappings":";;;AAOa,QAAA,iBAAiB,GAA+B;IAC3D,MAAM,EAAE;QACN,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,QAAQ;KACjB;IACD,MAAM,EAAE;QACN,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,QAAQ;KACjB;IACD,OAAO,EAAE;QACP,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,SAAS;KAClB;IACD,GAAG,EAAE;QACH,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,yBAAyB;KAClC;CACF,CAAC"}
|
package/dist/events.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare enum ComponentEvent {
|
|
2
|
-
CREATE = "create",
|
|
3
|
-
INIT = "init",
|
|
4
|
-
LOGIN = "login",
|
|
5
|
-
MIGRATE = "migrate",
|
|
6
|
-
PULL = "pull",
|
|
7
|
-
COMMITS = "commits",
|
|
8
|
-
PUSH = "push",
|
|
9
|
-
REGISTER = "register",
|
|
10
|
-
UPLOAD = "upload",
|
|
11
|
-
DEPLOY = "deploy"
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=events.d.ts.map
|
package/dist/events.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB"}
|
package/dist/events.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ComponentEvent = void 0;
|
|
4
|
-
var ComponentEvent;
|
|
5
|
-
(function (ComponentEvent) {
|
|
6
|
-
ComponentEvent["CREATE"] = "create";
|
|
7
|
-
ComponentEvent["INIT"] = "init";
|
|
8
|
-
ComponentEvent["LOGIN"] = "login";
|
|
9
|
-
ComponentEvent["MIGRATE"] = "migrate";
|
|
10
|
-
ComponentEvent["PULL"] = "pull";
|
|
11
|
-
ComponentEvent["COMMITS"] = "commits";
|
|
12
|
-
ComponentEvent["PUSH"] = "push";
|
|
13
|
-
ComponentEvent["REGISTER"] = "register";
|
|
14
|
-
ComponentEvent["UPLOAD"] = "upload";
|
|
15
|
-
ComponentEvent["DEPLOY"] = "deploy";
|
|
16
|
-
})(ComponentEvent || (exports.ComponentEvent = ComponentEvent = {}));
|
|
17
|
-
//# sourceMappingURL=events.js.map
|
package/dist/events.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAWX;AAXD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,+BAAa,CAAA;IACb,iCAAe,CAAA;IACf,qCAAmB,CAAA;IACnB,+BAAa,CAAA;IACb,qCAAmB,CAAA;IACnB,+BAAa,CAAA;IACb,uCAAqB,CAAA;IACrB,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;AACnB,CAAC,EAXW,cAAc,8BAAd,cAAc,QAWzB"}
|
package/dist/file-uploader.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-uploader.d.ts","sourceRoot":"","sources":["../src/file-uploader.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAUtE,eAAO,MAAM,iCAAiC,GAC5C,oBAAoB,MAAM,KACzB,MA6BF,CAAC"}
|
package/dist/file-uploader.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBucketeerUrlFromSuperblocksUrl = exports.COMPONENT_EVENT_HEADER = void 0;
|
|
4
|
-
exports.COMPONENT_EVENT_HEADER = "x-superblocks-component-event";
|
|
5
|
-
// SUPERBLOCKS_BUCKETEER_URL lets slot-N Tilt worktrees override the default
|
|
6
|
-
// localhost bucketeer URL (http://localhost:8030) when the server runs on a
|
|
7
|
-
// different slot offset. The local-orch Tilt profile injects this variable
|
|
8
|
-
// for the server's serve env.
|
|
9
|
-
const localhostBucketeerUrl = () => process.env.SUPERBLOCKS_BUCKETEER_URL ?? "http://localhost:8030";
|
|
10
|
-
// retrieves bucketeer base URL given the superblocks server base URL
|
|
11
|
-
const getBucketeerUrlFromSuperblocksUrl = (superblocksBaseUrl) => {
|
|
12
|
-
let hostname;
|
|
13
|
-
try {
|
|
14
|
-
hostname = new URL(superblocksBaseUrl).hostname;
|
|
15
|
-
}
|
|
16
|
-
catch {
|
|
17
|
-
return localhostBucketeerUrl();
|
|
18
|
-
}
|
|
19
|
-
if (/^pr-.*\.superblocks\.dev$/u.test(hostname)) {
|
|
20
|
-
return "https://bucketeer.dev.superblocks.com";
|
|
21
|
-
}
|
|
22
|
-
switch (hostname) {
|
|
23
|
-
case "eu.superblocks.com":
|
|
24
|
-
case "prod-eu.superblocks.com":
|
|
25
|
-
return "https://bucketeer.eu.superblocks.com";
|
|
26
|
-
case "app.staging.superblocks.com":
|
|
27
|
-
case "staging.superblocks.com":
|
|
28
|
-
return "https://bucketeer.staging.superblocks.com";
|
|
29
|
-
case "app.superblocks.com":
|
|
30
|
-
case "app.superblockshq.com":
|
|
31
|
-
return "https://bucketeer.superblocks.com";
|
|
32
|
-
case "dev.superblocks.com":
|
|
33
|
-
return "https://bucketeer.dev.superblocks.com";
|
|
34
|
-
case "127.0.0.1":
|
|
35
|
-
case "localhost":
|
|
36
|
-
default:
|
|
37
|
-
return localhostBucketeerUrl();
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
exports.getBucketeerUrlFromSuperblocksUrl = getBucketeerUrlFromSuperblocksUrl;
|
|
41
|
-
//# sourceMappingURL=file-uploader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-uploader.js","sourceRoot":"","sources":["../src/file-uploader.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG,+BAA+B,CAAC;AAEtE,4EAA4E;AAC5E,4EAA4E;AAC5E,2EAA2E;AAC3E,8BAA8B;AAC9B,MAAM,qBAAqB,GAAG,GAAW,EAAE,CACzC,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,uBAAuB,CAAC;AAEnE,qEAAqE;AAC9D,MAAM,iCAAiC,GAAG,CAC/C,kBAA0B,EAClB,EAAE;IACV,IAAI,QAAgB,CAAC;IACrB,IAAI,CAAC;QACH,QAAQ,GAAG,IAAI,GAAG,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC;IAClD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,qBAAqB,EAAE,CAAC;IACjC,CAAC;IAED,IAAI,4BAA4B,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChD,OAAO,uCAAuC,CAAC;IACjD,CAAC;IAED,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,oBAAoB,CAAC;QAC1B,KAAK,yBAAyB;YAC5B,OAAO,sCAAsC,CAAC;QAChD,KAAK,6BAA6B,CAAC;QACnC,KAAK,yBAAyB;YAC5B,OAAO,2CAA2C,CAAC;QACrD,KAAK,qBAAqB,CAAC;QAC3B,KAAK,uBAAuB;YAC1B,OAAO,mCAAmC,CAAC;QAC7C,KAAK,qBAAqB;YACxB,OAAO,uCAAuC,CAAC;QACjD,KAAK,WAAW,CAAC;QACjB,KAAK,WAAW,CAAC;QACjB;YACE,OAAO,qBAAqB,EAAE,CAAC;IACnC,CAAC;AACH,CAAC,CAAC;AA/BW,QAAA,iCAAiC,qCA+B5C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-uploader.test.d.ts","sourceRoot":"","sources":["../src/file-uploader.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const vitest_1 = require("vitest");
|
|
4
|
-
const file_uploader_js_1 = require("./file-uploader.js");
|
|
5
|
-
(0, vitest_1.describe)("getBucketeerUrlFromSuperblocksUrl", () => {
|
|
6
|
-
let originalUrl;
|
|
7
|
-
(0, vitest_1.beforeEach)(() => {
|
|
8
|
-
originalUrl = process.env.SUPERBLOCKS_BUCKETEER_URL;
|
|
9
|
-
delete process.env.SUPERBLOCKS_BUCKETEER_URL;
|
|
10
|
-
});
|
|
11
|
-
(0, vitest_1.afterEach)(() => {
|
|
12
|
-
if (originalUrl === undefined) {
|
|
13
|
-
delete process.env.SUPERBLOCKS_BUCKETEER_URL;
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
process.env.SUPERBLOCKS_BUCKETEER_URL = originalUrl;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
(0, vitest_1.it)("returns the default localhost bucketeer URL for localhost servers", () => {
|
|
20
|
-
(0, vitest_1.expect)((0, file_uploader_js_1.getBucketeerUrlFromSuperblocksUrl)("http://localhost:8080")).toBe("http://localhost:8030");
|
|
21
|
-
(0, vitest_1.expect)((0, file_uploader_js_1.getBucketeerUrlFromSuperblocksUrl)("http://127.0.0.1:8080")).toBe("http://localhost:8030");
|
|
22
|
-
});
|
|
23
|
-
(0, vitest_1.it)("honors SUPERBLOCKS_BUCKETEER_URL for localhost servers (slot-aware worktrees)", () => {
|
|
24
|
-
process.env.SUPERBLOCKS_BUCKETEER_URL = "http://localhost:8330";
|
|
25
|
-
(0, vitest_1.expect)((0, file_uploader_js_1.getBucketeerUrlFromSuperblocksUrl)("http://localhost:8380")).toBe("http://localhost:8330");
|
|
26
|
-
(0, vitest_1.expect)((0, file_uploader_js_1.getBucketeerUrlFromSuperblocksUrl)("http://127.0.0.1:8380")).toBe("http://localhost:8330");
|
|
27
|
-
});
|
|
28
|
-
(0, vitest_1.it)("falls back to localhost default when the input URL is unparseable", () => {
|
|
29
|
-
(0, vitest_1.expect)((0, file_uploader_js_1.getBucketeerUrlFromSuperblocksUrl)("not a url")).toBe("http://localhost:8030");
|
|
30
|
-
});
|
|
31
|
-
(0, vitest_1.it)("uses SUPERBLOCKS_BUCKETEER_URL when the input URL is unparseable", () => {
|
|
32
|
-
process.env.SUPERBLOCKS_BUCKETEER_URL = "http://localhost:8330";
|
|
33
|
-
(0, vitest_1.expect)((0, file_uploader_js_1.getBucketeerUrlFromSuperblocksUrl)("not a url")).toBe("http://localhost:8330");
|
|
34
|
-
});
|
|
35
|
-
(0, vitest_1.it)("ignores SUPERBLOCKS_BUCKETEER_URL for non-localhost hostnames", () => {
|
|
36
|
-
process.env.SUPERBLOCKS_BUCKETEER_URL = "http://localhost:8330";
|
|
37
|
-
(0, vitest_1.expect)((0, file_uploader_js_1.getBucketeerUrlFromSuperblocksUrl)("https://app.superblocks.com")).toBe("https://bucketeer.superblocks.com");
|
|
38
|
-
(0, vitest_1.expect)((0, file_uploader_js_1.getBucketeerUrlFromSuperblocksUrl)("https://staging.superblocks.com")).toBe("https://bucketeer.staging.superblocks.com");
|
|
39
|
-
(0, vitest_1.expect)((0, file_uploader_js_1.getBucketeerUrlFromSuperblocksUrl)("https://eu.superblocks.com")).toBe("https://bucketeer.eu.superblocks.com");
|
|
40
|
-
(0, vitest_1.expect)((0, file_uploader_js_1.getBucketeerUrlFromSuperblocksUrl)("https://pr-123.superblocks.dev")).toBe("https://bucketeer.dev.superblocks.com");
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
//# sourceMappingURL=file-uploader.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-uploader.test.js","sourceRoot":"","sources":["../src/file-uploader.test.ts"],"names":[],"mappings":";;AAAA,mCAAqE;AAErE,yDAAuE;AAEvE,IAAA,iBAAQ,EAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,IAAI,WAA+B,CAAC;IAEpC,IAAA,mBAAU,EAAC,GAAG,EAAE;QACd,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC;QACpD,OAAO,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,IAAA,kBAAS,EAAC,GAAG,EAAE;QACb,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,OAAO,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC;QAC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B,GAAG,uBAAuB,CAAC;QAEhE,IAAA,eAAM,EACJ,IAAA,oDAAiC,EAAC,6BAA6B,CAAC,CACjE,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QAC5C,IAAA,eAAM,EACJ,IAAA,oDAAiC,EAAC,iCAAiC,CAAC,CACrE,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;QACpD,IAAA,eAAM,EACJ,IAAA,oDAAiC,EAAC,4BAA4B,CAAC,CAChE,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QAC/C,IAAA,eAAM,EACJ,IAAA,oDAAiC,EAAC,gCAAgC,CAAC,CACpE,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-component-types.d.ts","sourceRoot":"","sources":["../src/generate-component-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAwBlD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,eAAe,UA2BjE"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateComponentTypesFile = generateComponentTypesFile;
|
|
4
|
-
const data_types_js_1 = require("./data-types.js");
|
|
5
|
-
const indent = (str, spaces) => {
|
|
6
|
-
const spacesString = " ".repeat(spaces);
|
|
7
|
-
return str
|
|
8
|
-
.split("\n")
|
|
9
|
-
.map((line) => `${spacesString}${line}`)
|
|
10
|
-
.join("\n");
|
|
11
|
-
};
|
|
12
|
-
function renderInputTypeAsTS(name, type, trailingChars, indentSpaces) {
|
|
13
|
-
let { tsType } = data_types_js_1.dataTypeDefinions[type];
|
|
14
|
-
if (["number", "string"].includes(type)) {
|
|
15
|
-
tsType += " | null";
|
|
16
|
-
}
|
|
17
|
-
return indent(`${name}: ${tsType}${trailingChars}`, indentSpaces);
|
|
18
|
-
}
|
|
19
|
-
function generateComponentTypesFile(config) {
|
|
20
|
-
const properties = config.properties ?? [];
|
|
21
|
-
const eventHandlers = config.events ?? [];
|
|
22
|
-
return `// GENERATED CODE -- DO NOT EDIT!
|
|
23
|
-
//
|
|
24
|
-
// This file is automatically generated by the Superblocks CLI
|
|
25
|
-
// Use the \`superblocks components watch\` command to regenerate this file from its source in config.ts
|
|
26
|
-
|
|
27
|
-
// All properties of your component are defined here.
|
|
28
|
-
// These are the properties which are surfaced in the Superblocks properties panel
|
|
29
|
-
// and can be referenced throughout your Superblocks Application
|
|
30
|
-
export type Props = {
|
|
31
|
-
${properties
|
|
32
|
-
.map((v) => renderInputTypeAsTS(v.path, v.dataType, ";", 2) + "\n")
|
|
33
|
-
.join("")}};
|
|
34
|
-
|
|
35
|
-
export type EventTriggers = {
|
|
36
|
-
// Call the subsequent function(s) to trigger event(s) in Superblocks from your component.
|
|
37
|
-
// These events can be wired up to event handlers in your Superblocks App
|
|
38
|
-
${eventHandlers.length === 0
|
|
39
|
-
? " // Note: no event handlers defined\n"
|
|
40
|
-
: eventHandlers
|
|
41
|
-
.map((v) => indent(v.path, 2) + ": () => void;" + "\n")
|
|
42
|
-
.join("")}};
|
|
43
|
-
`;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=generate-component-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-component-types.js","sourceRoot":"","sources":["../src/generate-component-types.ts"],"names":[],"mappings":";;AAyBA,gEA2BC;AApDD,mDAAmE;AAGnE,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,MAAc,EAAE,EAAE;IAC7C,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAExC,OAAO,GAAG;SACP,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,YAAY,GAAG,IAAI,EAAE,CAAC;SACvC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC,CAAC;AAEF,SAAS,mBAAmB,CAC1B,IAAY,EACZ,IAAc,EACd,aAAqB,EACrB,YAAoB;IAEpB,IAAI,EAAE,MAAM,EAAE,GAAG,iCAAiB,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,SAAS,CAAC;IACtB,CAAC;IACD,OAAO,MAAM,CAAC,GAAG,IAAI,KAAK,MAAM,GAAG,aAAa,EAAE,EAAE,YAAY,CAAC,CAAC;AACpE,CAAC;AAED,SAAgB,0BAA0B,CAAC,MAAuB;IAChE,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;IAC3C,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IAC1C,OAAO;;;;;;;;;EASP,UAAU;SACT,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;SAClE,IAAI,CAAC,EAAE,CAAC;;;;;EAMT,aAAa,CAAC,MAAM,KAAK,CAAC;QACxB,CAAC,CAAC,wCAAwC;QAC1C,CAAC,CAAC,aAAa;aACV,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,eAAe,GAAG,IAAI,CAAC;aAC3D,IAAI,CAAC,EAAE,CAChB;CACC,CAAC;AACF,CAAC"}
|
package/dist/identifiers.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Suggest an identifier based on a label, e.g. `My Component` -> `myComponent`.
|
|
3
|
-
* @param label The label to suggest an identifier for.
|
|
4
|
-
* @param capitalizeFirst Whether to capitalize the first letter of the identifier.
|
|
5
|
-
*/
|
|
6
|
-
export declare function suggestIdentifier(label: string, capitalizeFirst?: boolean): string;
|
|
7
|
-
export declare function isValidIdentifier(str: string): boolean;
|
|
8
|
-
export declare function isReservedPropertyName(str: string): boolean;
|
|
9
|
-
//# sourceMappingURL=identifiers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identifiers.d.ts","sourceRoot":"","sources":["../src/identifiers.ts"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,UAAQ,UASvE;AAID,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,WAE5C;AA2BD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,WAMjD"}
|
package/dist/identifiers.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.suggestIdentifier = suggestIdentifier;
|
|
4
|
-
exports.isValidIdentifier = isValidIdentifier;
|
|
5
|
-
exports.isReservedPropertyName = isReservedPropertyName;
|
|
6
|
-
// convert a string to upper camel case, e.g. "123 & this is my component, foo-bar" -> "123ThisIsMyComponentFooBar"
|
|
7
|
-
function wordsToUpperCamelCase(str) {
|
|
8
|
-
return str
|
|
9
|
-
.split(/[^A-Za-z0-9_]+/)
|
|
10
|
-
.filter(Boolean)
|
|
11
|
-
.map((word) => word[0].toUpperCase() + word.slice(1))
|
|
12
|
-
.join("");
|
|
13
|
-
}
|
|
14
|
-
const digits = "Zero One Two Three Four Five Six Seven Eight Nine".split(" ");
|
|
15
|
-
// convert digits to words, e.g. "123" -> "OneTwoThree"
|
|
16
|
-
function digitsToWords(str) {
|
|
17
|
-
return str.replace(/\d/g, (char) => digits[parseInt(char, 10)] ?? char);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Suggest an identifier based on a label, e.g. `My Component` -> `myComponent`.
|
|
21
|
-
* @param label The label to suggest an identifier for.
|
|
22
|
-
* @param capitalizeFirst Whether to capitalize the first letter of the identifier.
|
|
23
|
-
*/
|
|
24
|
-
function suggestIdentifier(label, capitalizeFirst = false) {
|
|
25
|
-
const upperCamelCase = wordsToUpperCamelCase(label)
|
|
26
|
-
// convert any digits at the start of the string to words as these are not valid in identifiers
|
|
27
|
-
.replace(/^\d+/, digitsToWords);
|
|
28
|
-
if (capitalizeFirst) {
|
|
29
|
-
return upperCamelCase;
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
return upperCamelCase[0].toLowerCase() + upperCamelCase.slice(1);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const IdentifierRegex = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
36
|
-
function isValidIdentifier(str) {
|
|
37
|
-
return IdentifierRegex.test(str);
|
|
38
|
-
}
|
|
39
|
-
const reservedPropertyNames = new Set([
|
|
40
|
-
"ENTITY_TYPE",
|
|
41
|
-
"bindingPaths",
|
|
42
|
-
"bottomRow",
|
|
43
|
-
"dynamicBindingPathList",
|
|
44
|
-
"dynamicTriggerPathList",
|
|
45
|
-
"gridColumns",
|
|
46
|
-
"gridRows",
|
|
47
|
-
"height",
|
|
48
|
-
"isLoading",
|
|
49
|
-
"isVisible",
|
|
50
|
-
"leftColumn",
|
|
51
|
-
"parentId",
|
|
52
|
-
"rightColumn",
|
|
53
|
-
"snapColumns",
|
|
54
|
-
"snapRows",
|
|
55
|
-
"top",
|
|
56
|
-
"topRow",
|
|
57
|
-
"type",
|
|
58
|
-
"widgetId",
|
|
59
|
-
"widgetLastChange",
|
|
60
|
-
"widgetName",
|
|
61
|
-
"width",
|
|
62
|
-
]);
|
|
63
|
-
function isReservedPropertyName(str) {
|
|
64
|
-
return (reservedPropertyNames.has(str) ||
|
|
65
|
-
// also treat any property name starting with "default_" as reserved since we use this prefix for default properties
|
|
66
|
-
str.startsWith("default_"));
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=identifiers.js.map
|
package/dist/identifiers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identifiers.js","sourceRoot":"","sources":["../src/identifiers.ts"],"names":[],"mappings":";;AAqBA,8CASC;AAID,8CAEC;AA2BD,wDAMC;AArED,mHAAmH;AACnH,SAAS,qBAAqB,CAAC,GAAW;IACxC,OAAO,GAAG;SACP,KAAK,CAAC,gBAAgB,CAAC;SACvB,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACpD,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,MAAM,MAAM,GAAG,mDAAmD,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAE9E,uDAAuD;AACvD,SAAS,aAAa,CAAC,GAAW;IAChC,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;AAC1E,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,KAAa,EAAE,eAAe,GAAG,KAAK;IACtE,MAAM,cAAc,GAAG,qBAAqB,CAAC,KAAK,CAAC;QACjD,+FAA+F;SAC9F,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAClC,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,cAAc,CAAC;IACxB,CAAC;SAAM,CAAC;QACN,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnE,CAAC;AACH,CAAC;AAED,MAAM,eAAe,GAAG,0BAA0B,CAAC;AAEnD,SAAgB,iBAAiB,CAAC,GAAW;IAC3C,OAAO,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAS;IAC5C,aAAa;IACb,cAAc;IACd,WAAW;IACX,wBAAwB;IACxB,wBAAwB;IACxB,aAAa;IACb,UAAU;IACV,QAAQ;IACR,WAAW;IACX,WAAW;IACX,YAAY;IACZ,UAAU;IACV,aAAa;IACb,aAAa;IACb,UAAU;IACV,KAAK;IACL,QAAQ;IACR,MAAM;IACN,UAAU;IACV,kBAAkB;IAClB,YAAY;IACZ,OAAO;CACR,CAAC,CAAC;AAEH,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,CACL,qBAAqB,CAAC,GAAG,CAAC,GAAG,CAAC;QAC9B,oHAAoH;QACpH,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAC3B,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from "./constants.js";
|
|
2
|
-
export * from "./component-configs.js";
|
|
3
|
-
export * from "./events.js";
|
|
4
|
-
export * from "./file-uploader.js";
|
|
5
|
-
export * from "./login.js";
|
|
6
|
-
export * from "./resource-configs.js";
|
|
7
|
-
export * from "./data-types.js";
|
|
8
|
-
export * from "./types.js";
|
|
9
|
-
export * from "./identifiers.js";
|
|
10
|
-
export * from "./localGitRepoState.js";
|
|
11
|
-
export * from "./unreachable.js";
|
|
12
|
-
export * from "./api-files/types.js";
|
|
13
|
-
export * from "./api-files/index.js";
|
|
14
|
-
export * from "./api-files/constants.js";
|
|
15
|
-
export * from "./mask-unix-signals.js";
|
|
16
|
-
export * from "./token-manager.js";
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,yDAAuC;AACvC,8CAA4B;AAC5B,qDAAmC;AACnC,6CAA2B;AAC3B,wDAAsC;AACtC,kDAAgC;AAChC,6CAA2B;AAC3B,mDAAiC;AACjC,yDAAuC;AACvC,mDAAiC;AACjC,uDAAqC;AACrC,uDAAqC;AACrC,2DAAyC;AACzC,yDAAuC;AACvC,qDAAmC"}
|