@innovatorved/code-lab 0.1.13 → 0.2.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.
@@ -4058,8 +4058,9 @@ var GuidedStepSchema = external_exports.object({
4058
4058
  hint: external_exports.string().optional(),
4059
4059
  testNames: external_exports.array(external_exports.string()).optional()
4060
4060
  });
4061
+ var LanguageIdSchema = external_exports.enum(["js", "ts", "cpp"]);
4061
4062
  var LanguageBundleSchema = external_exports.object({
4062
- language: external_exports.enum(["js", "ts"]).default("js"),
4063
+ language: LanguageIdSchema.default("js"),
4063
4064
  files: external_exports.record(external_exports.string()).default({}),
4064
4065
  starterFiles: external_exports.record(external_exports.string()).optional(),
4065
4066
  solutionFiles: external_exports.record(external_exports.string()).optional(),
@@ -4070,17 +4071,47 @@ var GuidedLabExtensionOptionsSchema = external_exports.object({
4070
4071
  steps: external_exports.array(GuidedStepSchema).default([]),
4071
4072
  stepIndex: external_exports.number().int().nonnegative().default(0),
4072
4073
  mode: external_exports.enum(["guided", "sandbox"]).default("guided"),
4073
- language: external_exports.enum(["js", "ts"]).optional(),
4074
- lang: external_exports.enum(["js", "ts"]).optional(),
4074
+ language: LanguageIdSchema.optional(),
4075
+ lang: LanguageIdSchema.optional(),
4075
4076
  starterFiles: external_exports.record(external_exports.string()).optional(),
4076
4077
  solutionFiles: external_exports.record(external_exports.string()).optional(),
4077
4078
  tsStarterFiles: external_exports.record(external_exports.string()).optional(),
4078
4079
  tsSolutionFiles: external_exports.record(external_exports.string()).optional(),
4079
4080
  tsFiles: external_exports.record(external_exports.string()).optional(),
4081
+ cppStarterFiles: external_exports.record(external_exports.string()).optional(),
4082
+ cppSolutionFiles: external_exports.record(external_exports.string()).optional(),
4083
+ cppFiles: external_exports.record(external_exports.string()).optional(),
4080
4084
  summary: external_exports.string().optional(),
4081
4085
  onStepComplete: external_exports.function().args(GuidedStepSchema, external_exports.number()).returns(external_exports.void()).optional(),
4082
4086
  onLabComplete: external_exports.function().args(external_exports.string()).returns(external_exports.void()).optional()
4083
4087
  });
4088
+ var CppToolchainProgressSchema = external_exports.object({
4089
+ stage: external_exports.enum(["downloading", "caching", "extracting", "compiling", "linking", "ready"]),
4090
+ loadedBytes: external_exports.number().optional(),
4091
+ totalBytes: external_exports.number().optional(),
4092
+ percent: external_exports.number().optional(),
4093
+ message: external_exports.string().optional()
4094
+ });
4095
+ var CppExtensionOptionsSchema = external_exports.object({
4096
+ toolchainUrl: external_exports.string().optional(),
4097
+ clangWasmUrl: external_exports.string().optional(),
4098
+ clangUrl: external_exports.string().optional(),
4099
+ lldWasmUrl: external_exports.string().optional(),
4100
+ lldUrl: external_exports.string().optional(),
4101
+ sysrootTarUrl: external_exports.string().optional(),
4102
+ sysrootUrl: external_exports.string().optional(),
4103
+ cacheInIndexedDB: external_exports.boolean().default(true),
4104
+ preload: external_exports.boolean().default(false),
4105
+ std: external_exports.enum(["c++17", "c++20", "c++23"]).default("c++20"),
4106
+ optLevel: external_exports.enum(["-O0", "-O1", "-O2", "-O3"]).default("-O2"),
4107
+ flags: external_exports.array(external_exports.string()).default(["-O2", "-Wall", "-Wextra"]),
4108
+ headers: external_exports.record(external_exports.string()).optional(),
4109
+ extraHeaders: external_exports.record(external_exports.string()).optional(),
4110
+ files: external_exports.record(external_exports.string()).optional(),
4111
+ starterFiles: external_exports.record(external_exports.string()).optional(),
4112
+ solutionFiles: external_exports.record(external_exports.string()).optional(),
4113
+ onProgress: external_exports.function().args(external_exports.any()).returns(external_exports.void()).optional()
4114
+ });
4084
4115
  var CloneProgressPhaseSchema = external_exports.enum([
4085
4116
  "connecting",
4086
4117
  "metadata",
@@ -4137,7 +4168,7 @@ var WorkspaceSnapshotSchema = external_exports.object({
4137
4168
  openTabs: external_exports.array(external_exports.string()).default([]),
4138
4169
  activeFile: external_exports.string().nullable().optional(),
4139
4170
  mode: external_exports.enum(["guided", "sandbox"]).optional(),
4140
- lang: external_exports.enum(["js", "ts"]).optional(),
4171
+ lang: LanguageIdSchema.optional(),
4141
4172
  labId: external_exports.string().optional()
4142
4173
  });
4143
4174
  var WorkbenchOptionsSchema = external_exports.object({
@@ -4173,10 +4204,13 @@ var WorkbenchOptionsSchema = external_exports.object({
4173
4204
  tsFiles: external_exports.record(external_exports.string()).optional(),
4174
4205
  tsStarterFiles: external_exports.record(external_exports.string()).optional(),
4175
4206
  tsSolutionFiles: external_exports.record(external_exports.string()).optional(),
4207
+ cppFiles: external_exports.record(external_exports.string()).optional(),
4208
+ cppStarterFiles: external_exports.record(external_exports.string()).optional(),
4209
+ cppSolutionFiles: external_exports.record(external_exports.string()).optional(),
4176
4210
  guided: external_exports.any().optional(),
4177
4211
  mode: external_exports.enum(["guided", "sandbox"]).optional(),
4178
- language: external_exports.enum(["js", "ts"]).optional(),
4179
- lang: external_exports.enum(["js", "ts"]).optional(),
4212
+ language: LanguageIdSchema.optional(),
4213
+ lang: LanguageIdSchema.optional(),
4180
4214
  stepIndex: external_exports.number().int().optional(),
4181
4215
  onStepComplete: external_exports.function().args(external_exports.any(), external_exports.number()).returns(external_exports.void()).optional(),
4182
4216
  onLabComplete: external_exports.function().args(external_exports.string()).returns(external_exports.void()).optional()
@@ -4263,7 +4297,15 @@ function guidedLabExtension(workbench, options = {}) {
4263
4297
  ...parsed,
4264
4298
  steps: workbench.steps
4265
4299
  };
4300
+ if (!workbench.enabledLanguages || !(workbench.enabledLanguages instanceof Set)) {
4301
+ workbench.enabledLanguages = /* @__PURE__ */ new Set(["js"]);
4302
+ }
4266
4303
  if (parsed.tsStarterFiles || parsed.tsSolutionFiles || parsed.tsFiles) {
4304
+ workbench.enabledLanguages.add("ts");
4305
+ workbench.hasMultipleLanguages = true;
4306
+ }
4307
+ if (parsed.cppStarterFiles || parsed.cppSolutionFiles || parsed.cppFiles) {
4308
+ workbench.enabledLanguages.add("cpp");
4267
4309
  workbench.hasMultipleLanguages = true;
4268
4310
  }
4269
4311
  if (typeof workbench._renderShell === "function" && workbench.container) {
@@ -4078,8 +4078,9 @@ var CodeLabGuidedLab = (() => {
4078
4078
  hint: external_exports.string().optional(),
4079
4079
  testNames: external_exports.array(external_exports.string()).optional()
4080
4080
  });
4081
+ var LanguageIdSchema = external_exports.enum(["js", "ts", "cpp"]);
4081
4082
  var LanguageBundleSchema = external_exports.object({
4082
- language: external_exports.enum(["js", "ts"]).default("js"),
4083
+ language: LanguageIdSchema.default("js"),
4083
4084
  files: external_exports.record(external_exports.string()).default({}),
4084
4085
  starterFiles: external_exports.record(external_exports.string()).optional(),
4085
4086
  solutionFiles: external_exports.record(external_exports.string()).optional(),
@@ -4090,17 +4091,47 @@ var CodeLabGuidedLab = (() => {
4090
4091
  steps: external_exports.array(GuidedStepSchema).default([]),
4091
4092
  stepIndex: external_exports.number().int().nonnegative().default(0),
4092
4093
  mode: external_exports.enum(["guided", "sandbox"]).default("guided"),
4093
- language: external_exports.enum(["js", "ts"]).optional(),
4094
- lang: external_exports.enum(["js", "ts"]).optional(),
4094
+ language: LanguageIdSchema.optional(),
4095
+ lang: LanguageIdSchema.optional(),
4095
4096
  starterFiles: external_exports.record(external_exports.string()).optional(),
4096
4097
  solutionFiles: external_exports.record(external_exports.string()).optional(),
4097
4098
  tsStarterFiles: external_exports.record(external_exports.string()).optional(),
4098
4099
  tsSolutionFiles: external_exports.record(external_exports.string()).optional(),
4099
4100
  tsFiles: external_exports.record(external_exports.string()).optional(),
4101
+ cppStarterFiles: external_exports.record(external_exports.string()).optional(),
4102
+ cppSolutionFiles: external_exports.record(external_exports.string()).optional(),
4103
+ cppFiles: external_exports.record(external_exports.string()).optional(),
4100
4104
  summary: external_exports.string().optional(),
4101
4105
  onStepComplete: external_exports.function().args(GuidedStepSchema, external_exports.number()).returns(external_exports.void()).optional(),
4102
4106
  onLabComplete: external_exports.function().args(external_exports.string()).returns(external_exports.void()).optional()
4103
4107
  });
4108
+ var CppToolchainProgressSchema = external_exports.object({
4109
+ stage: external_exports.enum(["downloading", "caching", "extracting", "compiling", "linking", "ready"]),
4110
+ loadedBytes: external_exports.number().optional(),
4111
+ totalBytes: external_exports.number().optional(),
4112
+ percent: external_exports.number().optional(),
4113
+ message: external_exports.string().optional()
4114
+ });
4115
+ var CppExtensionOptionsSchema = external_exports.object({
4116
+ toolchainUrl: external_exports.string().optional(),
4117
+ clangWasmUrl: external_exports.string().optional(),
4118
+ clangUrl: external_exports.string().optional(),
4119
+ lldWasmUrl: external_exports.string().optional(),
4120
+ lldUrl: external_exports.string().optional(),
4121
+ sysrootTarUrl: external_exports.string().optional(),
4122
+ sysrootUrl: external_exports.string().optional(),
4123
+ cacheInIndexedDB: external_exports.boolean().default(true),
4124
+ preload: external_exports.boolean().default(false),
4125
+ std: external_exports.enum(["c++17", "c++20", "c++23"]).default("c++20"),
4126
+ optLevel: external_exports.enum(["-O0", "-O1", "-O2", "-O3"]).default("-O2"),
4127
+ flags: external_exports.array(external_exports.string()).default(["-O2", "-Wall", "-Wextra"]),
4128
+ headers: external_exports.record(external_exports.string()).optional(),
4129
+ extraHeaders: external_exports.record(external_exports.string()).optional(),
4130
+ files: external_exports.record(external_exports.string()).optional(),
4131
+ starterFiles: external_exports.record(external_exports.string()).optional(),
4132
+ solutionFiles: external_exports.record(external_exports.string()).optional(),
4133
+ onProgress: external_exports.function().args(external_exports.any()).returns(external_exports.void()).optional()
4134
+ });
4104
4135
  var CloneProgressPhaseSchema = external_exports.enum([
4105
4136
  "connecting",
4106
4137
  "metadata",
@@ -4157,7 +4188,7 @@ var CodeLabGuidedLab = (() => {
4157
4188
  openTabs: external_exports.array(external_exports.string()).default([]),
4158
4189
  activeFile: external_exports.string().nullable().optional(),
4159
4190
  mode: external_exports.enum(["guided", "sandbox"]).optional(),
4160
- lang: external_exports.enum(["js", "ts"]).optional(),
4191
+ lang: LanguageIdSchema.optional(),
4161
4192
  labId: external_exports.string().optional()
4162
4193
  });
4163
4194
  var WorkbenchOptionsSchema = external_exports.object({
@@ -4193,10 +4224,13 @@ var CodeLabGuidedLab = (() => {
4193
4224
  tsFiles: external_exports.record(external_exports.string()).optional(),
4194
4225
  tsStarterFiles: external_exports.record(external_exports.string()).optional(),
4195
4226
  tsSolutionFiles: external_exports.record(external_exports.string()).optional(),
4227
+ cppFiles: external_exports.record(external_exports.string()).optional(),
4228
+ cppStarterFiles: external_exports.record(external_exports.string()).optional(),
4229
+ cppSolutionFiles: external_exports.record(external_exports.string()).optional(),
4196
4230
  guided: external_exports.any().optional(),
4197
4231
  mode: external_exports.enum(["guided", "sandbox"]).optional(),
4198
- language: external_exports.enum(["js", "ts"]).optional(),
4199
- lang: external_exports.enum(["js", "ts"]).optional(),
4232
+ language: LanguageIdSchema.optional(),
4233
+ lang: LanguageIdSchema.optional(),
4200
4234
  stepIndex: external_exports.number().int().optional(),
4201
4235
  onStepComplete: external_exports.function().args(external_exports.any(), external_exports.number()).returns(external_exports.void()).optional(),
4202
4236
  onLabComplete: external_exports.function().args(external_exports.string()).returns(external_exports.void()).optional()
@@ -4283,7 +4317,15 @@ var CodeLabGuidedLab = (() => {
4283
4317
  ...parsed,
4284
4318
  steps: workbench.steps
4285
4319
  };
4320
+ if (!workbench.enabledLanguages || !(workbench.enabledLanguages instanceof Set)) {
4321
+ workbench.enabledLanguages = /* @__PURE__ */ new Set(["js"]);
4322
+ }
4286
4323
  if (parsed.tsStarterFiles || parsed.tsSolutionFiles || parsed.tsFiles) {
4324
+ workbench.enabledLanguages.add("ts");
4325
+ workbench.hasMultipleLanguages = true;
4326
+ }
4327
+ if (parsed.cppStarterFiles || parsed.cppSolutionFiles || parsed.cppFiles) {
4328
+ workbench.enabledLanguages.add("cpp");
4287
4329
  workbench.hasMultipleLanguages = true;
4288
4330
  }
4289
4331
  if (typeof workbench._renderShell === "function" && workbench.container) {
@@ -4300,3 +4342,4 @@ var CodeLabGuidedLab = (() => {
4300
4342
  var guided_lab_default = guidedLabExtension;
4301
4343
  return __toCommonJS(guided_lab_exports);
4302
4344
  })();
4345
+ if(typeof module!=="undefined"&&module.exports)module.exports=CodeLabGuidedLab;if(typeof globalThis!=="undefined")globalThis.CodeLabGuidedLab=CodeLabGuidedLab;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * JavaScript Language Extension for CodeLab
3
+ *
4
+ * Enabled by default in CodeLab. Uses the browser's built-in JavaScript engine
5
+ * and CodeLab's zero-dependency virtual Node.js + Bun runtime (`node`, `bun`, `npm`).
6
+ */
7
+ export interface JavaScriptExtensionOptions {
8
+ /**
9
+ * Optional starter files to seed when JavaScript is selected.
10
+ */
11
+ files?: Record<string, string>;
12
+ /**
13
+ * Default entry file for JavaScript runs (e.g. 'src/demo.js' or 'index.js').
14
+ */
15
+ entry?: string;
16
+ }
17
+ export declare function javascriptExtension(workbench: any, options?: JavaScriptExtensionOptions): any;
18
+ export declare function createJavaScriptExtension(options?: JavaScriptExtensionOptions): {
19
+ (workbench: any): any;
20
+ extensionName: string;
21
+ languageId: "js";
22
+ };
23
+ export declare const jsExtension: typeof javascriptExtension;
24
+ export default javascriptExtension;
@@ -0,0 +1,36 @@
1
+ // src/extensions/javascript.ts
2
+ function javascriptExtension(workbench, options = {}) {
3
+ if (!workbench) return workbench;
4
+ if (!workbench.enabledLanguages || !(workbench.enabledLanguages instanceof Set)) {
5
+ workbench.enabledLanguages = /* @__PURE__ */ new Set(["js"]);
6
+ } else {
7
+ workbench.enabledLanguages.add("js");
8
+ }
9
+ if (options.files && typeof options.files === "object") {
10
+ workbench.jsFiles = { ...workbench.jsFiles || {}, ...options.files };
11
+ }
12
+ if (options.entry && !workbench.entry) {
13
+ workbench.entry = options.entry;
14
+ }
15
+ workbench.hasMultipleLanguages = workbench.enabledLanguages.size > 1;
16
+ if (typeof workbench._renderShell === "function" && workbench.container) {
17
+ workbench._renderShell();
18
+ if (typeof workbench._bindEvents === "function") workbench._bindEvents();
19
+ if (typeof workbench._renderFileLists === "function") workbench._renderFileLists();
20
+ }
21
+ return workbench;
22
+ }
23
+ function createJavaScriptExtension(options = {}) {
24
+ const plugin = (workbench) => javascriptExtension(workbench, options);
25
+ plugin.extensionName = "javascript";
26
+ plugin.languageId = "js";
27
+ return plugin;
28
+ }
29
+ var jsExtension = javascriptExtension;
30
+ var javascript_default = javascriptExtension;
31
+ export {
32
+ createJavaScriptExtension,
33
+ javascript_default as default,
34
+ javascriptExtension,
35
+ jsExtension
36
+ };
@@ -0,0 +1,59 @@
1
+ var CodeLabJavaScript = (() => {
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/extensions/javascript.ts
21
+ var javascript_exports = {};
22
+ __export(javascript_exports, {
23
+ createJavaScriptExtension: () => createJavaScriptExtension,
24
+ default: () => javascript_default,
25
+ javascriptExtension: () => javascriptExtension,
26
+ jsExtension: () => jsExtension
27
+ });
28
+ function javascriptExtension(workbench, options = {}) {
29
+ if (!workbench) return workbench;
30
+ if (!workbench.enabledLanguages || !(workbench.enabledLanguages instanceof Set)) {
31
+ workbench.enabledLanguages = /* @__PURE__ */ new Set(["js"]);
32
+ } else {
33
+ workbench.enabledLanguages.add("js");
34
+ }
35
+ if (options.files && typeof options.files === "object") {
36
+ workbench.jsFiles = { ...workbench.jsFiles || {}, ...options.files };
37
+ }
38
+ if (options.entry && !workbench.entry) {
39
+ workbench.entry = options.entry;
40
+ }
41
+ workbench.hasMultipleLanguages = workbench.enabledLanguages.size > 1;
42
+ if (typeof workbench._renderShell === "function" && workbench.container) {
43
+ workbench._renderShell();
44
+ if (typeof workbench._bindEvents === "function") workbench._bindEvents();
45
+ if (typeof workbench._renderFileLists === "function") workbench._renderFileLists();
46
+ }
47
+ return workbench;
48
+ }
49
+ function createJavaScriptExtension(options = {}) {
50
+ const plugin = (workbench) => javascriptExtension(workbench, options);
51
+ plugin.extensionName = "javascript";
52
+ plugin.languageId = "js";
53
+ return plugin;
54
+ }
55
+ var jsExtension = javascriptExtension;
56
+ var javascript_default = javascriptExtension;
57
+ return __toCommonJS(javascript_exports);
58
+ })();
59
+ if(typeof module!=="undefined"&&module.exports)module.exports=CodeLabJavaScript;if(typeof globalThis!=="undefined")globalThis.CodeLabJavaScript=CodeLabJavaScript;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * TypeScript Language Extension for CodeLab
3
+ *
4
+ * Zero-dependency browser TypeScript extension powered by CodeLab's built-in
5
+ * `transpileTS` compiler and virtual Node.js / Bun runtime.
6
+ */
7
+ export interface TypeScriptExtensionOptions {
8
+ /**
9
+ * Optional TypeScript workspace files (`tsFiles`).
10
+ */
11
+ files?: Record<string, string>;
12
+ /**
13
+ * Optional Guided Lab TypeScript starter files (`tsStarterFiles`).
14
+ */
15
+ starterFiles?: Record<string, string>;
16
+ /**
17
+ * Optional Guided Lab TypeScript reference solution files (`tsSolutionFiles`).
18
+ */
19
+ solutionFiles?: Record<string, string>;
20
+ /**
21
+ * Optional entry file when TypeScript is active (e.g. 'src/demo.ts').
22
+ */
23
+ entry?: string;
24
+ /**
25
+ * Immediately switch the active workbench language to 'ts'.
26
+ */
27
+ activate?: boolean;
28
+ }
29
+ export declare function typescriptExtension(workbench: any, options?: TypeScriptExtensionOptions): any;
30
+ export declare function createTypeScriptExtension(options?: TypeScriptExtensionOptions): {
31
+ (workbench: any): any;
32
+ extensionName: string;
33
+ languageId: "ts";
34
+ };
35
+ export declare const tsExtension: typeof typescriptExtension;
36
+ export default typescriptExtension;
@@ -0,0 +1,55 @@
1
+ // src/extensions/typescript.ts
2
+ function typescriptExtension(workbench, options = {}) {
3
+ if (!workbench) return workbench;
4
+ if (!workbench.enabledLanguages || !(workbench.enabledLanguages instanceof Set)) {
5
+ workbench.enabledLanguages = /* @__PURE__ */ new Set(["js", "ts"]);
6
+ } else {
7
+ workbench.enabledLanguages.add("ts");
8
+ }
9
+ if (options.files && typeof options.files === "object") {
10
+ workbench.tsFiles = { ...workbench.tsFiles || {}, ...options.files };
11
+ if (workbench.guidedConfig) {
12
+ workbench.guidedConfig.tsFiles = { ...workbench.guidedConfig.tsFiles || {}, ...options.files };
13
+ }
14
+ }
15
+ if (options.starterFiles && typeof options.starterFiles === "object") {
16
+ if (!workbench.guidedConfig) workbench.guidedConfig = {};
17
+ workbench.guidedConfig.tsStarterFiles = {
18
+ ...workbench.guidedConfig.tsStarterFiles || {},
19
+ ...options.starterFiles
20
+ };
21
+ }
22
+ if (options.solutionFiles && typeof options.solutionFiles === "object") {
23
+ if (!workbench.guidedConfig) workbench.guidedConfig = {};
24
+ workbench.guidedConfig.tsSolutionFiles = {
25
+ ...workbench.guidedConfig.tsSolutionFiles || {},
26
+ ...options.solutionFiles
27
+ };
28
+ }
29
+ if (options.entry) {
30
+ workbench.tsEntry = options.entry;
31
+ }
32
+ workbench.hasMultipleLanguages = workbench.enabledLanguages.size > 1;
33
+ if (options.activate && typeof workbench.setLanguage === "function") {
34
+ workbench.setLanguage("ts");
35
+ } else if (typeof workbench._renderShell === "function" && workbench.container) {
36
+ workbench._renderShell();
37
+ if (typeof workbench._bindEvents === "function") workbench._bindEvents();
38
+ if (typeof workbench._renderFileLists === "function") workbench._renderFileLists();
39
+ }
40
+ return workbench;
41
+ }
42
+ function createTypeScriptExtension(options = {}) {
43
+ const plugin = (workbench) => typescriptExtension(workbench, options);
44
+ plugin.extensionName = "typescript";
45
+ plugin.languageId = "ts";
46
+ return plugin;
47
+ }
48
+ var tsExtension = typescriptExtension;
49
+ var typescript_default = typescriptExtension;
50
+ export {
51
+ createTypeScriptExtension,
52
+ typescript_default as default,
53
+ tsExtension,
54
+ typescriptExtension
55
+ };
@@ -0,0 +1,78 @@
1
+ var CodeLabTypeScript = (() => {
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/extensions/typescript.ts
21
+ var typescript_exports = {};
22
+ __export(typescript_exports, {
23
+ createTypeScriptExtension: () => createTypeScriptExtension,
24
+ default: () => typescript_default,
25
+ tsExtension: () => tsExtension,
26
+ typescriptExtension: () => typescriptExtension
27
+ });
28
+ function typescriptExtension(workbench, options = {}) {
29
+ if (!workbench) return workbench;
30
+ if (!workbench.enabledLanguages || !(workbench.enabledLanguages instanceof Set)) {
31
+ workbench.enabledLanguages = /* @__PURE__ */ new Set(["js", "ts"]);
32
+ } else {
33
+ workbench.enabledLanguages.add("ts");
34
+ }
35
+ if (options.files && typeof options.files === "object") {
36
+ workbench.tsFiles = { ...workbench.tsFiles || {}, ...options.files };
37
+ if (workbench.guidedConfig) {
38
+ workbench.guidedConfig.tsFiles = { ...workbench.guidedConfig.tsFiles || {}, ...options.files };
39
+ }
40
+ }
41
+ if (options.starterFiles && typeof options.starterFiles === "object") {
42
+ if (!workbench.guidedConfig) workbench.guidedConfig = {};
43
+ workbench.guidedConfig.tsStarterFiles = {
44
+ ...workbench.guidedConfig.tsStarterFiles || {},
45
+ ...options.starterFiles
46
+ };
47
+ }
48
+ if (options.solutionFiles && typeof options.solutionFiles === "object") {
49
+ if (!workbench.guidedConfig) workbench.guidedConfig = {};
50
+ workbench.guidedConfig.tsSolutionFiles = {
51
+ ...workbench.guidedConfig.tsSolutionFiles || {},
52
+ ...options.solutionFiles
53
+ };
54
+ }
55
+ if (options.entry) {
56
+ workbench.tsEntry = options.entry;
57
+ }
58
+ workbench.hasMultipleLanguages = workbench.enabledLanguages.size > 1;
59
+ if (options.activate && typeof workbench.setLanguage === "function") {
60
+ workbench.setLanguage("ts");
61
+ } else if (typeof workbench._renderShell === "function" && workbench.container) {
62
+ workbench._renderShell();
63
+ if (typeof workbench._bindEvents === "function") workbench._bindEvents();
64
+ if (typeof workbench._renderFileLists === "function") workbench._renderFileLists();
65
+ }
66
+ return workbench;
67
+ }
68
+ function createTypeScriptExtension(options = {}) {
69
+ const plugin = (workbench) => typescriptExtension(workbench, options);
70
+ plugin.extensionName = "typescript";
71
+ plugin.languageId = "ts";
72
+ return plugin;
73
+ }
74
+ var tsExtension = typescriptExtension;
75
+ var typescript_default = typescriptExtension;
76
+ return __toCommonJS(typescript_exports);
77
+ })();
78
+ if(typeof module!=="undefined"&&module.exports)module.exports=CodeLabTypeScript;if(typeof globalThis!=="undefined")globalThis.CodeLabTypeScript=CodeLabTypeScript;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @innovatorved/code-lab v0.1.10
3
- * Browser-native IDE, POSIX Shell, Web Worker Node.js/Bun Runtime, and Git Engine.
2
+ * @innovatorved/code-lab v0.2.0
3
+ * Browser-native IDE, POSIX Shell, Web Worker Node.js/Bun Runtime, WASI C++20 Toolchain, and Git Engine.
4
4
  */
5
5
  export * from './schemas';
6
6
  export * from './logger';
@@ -15,5 +15,8 @@ export * from './runtime';
15
15
  export { createPosixShell, cloneGitHubRepository, parseGitHubRepoUrl, CodeLabShell } from './shell';
16
16
  export * from './terminal';
17
17
  export { guidedLabExtension } from './extensions/guided-lab';
18
+ export { type JavaScriptExtensionOptions, javascriptExtension, createJavaScriptExtension } from './extensions/javascript';
19
+ export { type TypeScriptExtensionOptions, typescriptExtension, createTypeScriptExtension } from './extensions/typescript';
20
+ export { type CppCompileOptions, type CppCompileResult, type CppCompilerAdapter, DEFAULT_CPP_CDN_BASE_URL, BUILTIN_CPP_HEADERS, extractTarToVfs, createTarArchive, seedCppHeadersIntoVfs, parseCppCompilerFlags, CppToolchainManager, registerCppCompilerOnRuntime, cppExtension, createCppExtension } from './extensions/cpp';
18
21
  declare const _default: any;
19
22
  export default _default;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * ============================================================
3
- * @innovatorved/code-lab v0.1.13 — Standalone Browser Code IDE & Virtual Runtime
3
+ * @innovatorved/code-lab v0.2.0 — Standalone Browser Code IDE & Virtual Runtime
4
4
  * ============================================================
5
5
  * Features:
6
6
  * - Sandboxed Web Worker Execution Engine with Multi-Instance Isolation & Watchdog Timer
package/dist/runtime.d.ts CHANGED
@@ -21,6 +21,12 @@ export declare const transpileTS: (code: string, filename?: string) => string;
21
21
  export declare const transpileForBrowser: (source: string, filename?: string) => string;
22
22
  export declare const preloadNpmPackages: (files?: Record<string, any>, onProgressOrCache?: ((pkg: string) => void) | Map<string, string>, onProgress?: (pkg: string) => void) => Promise<Record<string, string>>;
23
23
  export declare const createVirtualPortTable: () => any;
24
+ export declare const createVirtualWasi: (options?: any) => any;
25
+ export declare const executeWasiModule: (wasmBytesOrModule: Uint8Array | ArrayBuffer | WebAssembly.Module, options?: any) => Promise<{
26
+ exitCode: number;
27
+ stdout: string;
28
+ stderr: string;
29
+ }>;
24
30
  export declare const executeInVirtualRuntime: (options?: any) => Promise<any>;
25
31
  declare const createWorkerRuntimeSourceExport: () => string;
26
32
  export { createWorkerRuntimeSourceExport as createWorkerRuntimeSource };