@vite-hub/workspace 0.0.0 → 0.0.2
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/README.md +262 -1
- package/dist/ai-Cztw4eLk.js +472 -0
- package/dist/ai-hFdsvDHC.d.ts +162 -0
- package/dist/ai.d.ts +3 -0
- package/dist/ai.js +2 -0
- package/dist/artifacts-store-BAV9jZpd.js +555 -0
- package/dist/asset-registry-CaG9b7tf.js +19 -0
- package/dist/chunk-8H4AJuhK.js +14 -0
- package/dist/cli.d.ts +31 -0
- package/dist/cli.js +303 -0
- package/dist/cloudflare-env-CKxUs2fa.js +20 -0
- package/dist/cloudflare.d.ts +16 -0
- package/dist/cloudflare.js +3 -0
- package/dist/collections/client.d.ts +39 -0
- package/dist/collections/client.js +137 -0
- package/dist/collections.d.ts +59 -0
- package/dist/collections.js +159 -0
- package/dist/config--r5unwPc.js +7811 -0
- package/dist/config-Ca5DM8fF.d.ts +28 -0
- package/dist/config-DCQ6y30R.js +30 -0
- package/dist/file-B2q9NE18.js +24 -0
- package/dist/files-xy0le-_U.js +51 -0
- package/dist/github-lIO6-2sH.js +194 -0
- package/dist/glob-DeH0dzZX.js +23 -0
- package/dist/host-I-_vDs05.js +370 -0
- package/dist/hosted-vercel-blob.d.ts +15 -0
- package/dist/hosted-vercel-blob.js +26 -0
- package/dist/hosted.d.ts +18 -0
- package/dist/hosted.js +30 -0
- package/dist/index.d.ts +185 -0
- package/dist/index.js +541 -0
- package/dist/lifecycle-Lhk3dAMt.js +176 -0
- package/dist/loader.d.ts +17 -0
- package/dist/loader.js +22 -0
- package/dist/nitro.d.ts +2 -0
- package/dist/nitro.js +2 -0
- package/dist/nuxt.d.ts +26 -0
- package/dist/nuxt.js +36 -0
- package/dist/path-CNI6wKIU.js +115 -0
- package/dist/provider-CeQciesl.js +599 -0
- package/dist/providers/cloudflare/artifacts-store.d.ts +6 -0
- package/dist/providers/cloudflare/artifacts-store.js +2 -0
- package/dist/providers/github/store.d.ts +6 -0
- package/dist/providers/github/store.js +362 -0
- package/dist/providers/vercel/blob-store.d.ts +6 -0
- package/dist/providers/vercel/blob-store.js +235 -0
- package/dist/publish.d.ts +35 -0
- package/dist/publish.js +112 -0
- package/dist/registry-C7DMdBXN.js +74 -0
- package/dist/registry-CoC9JxVt.d.ts +11 -0
- package/dist/request-execution-C8qRcReq.js +80 -0
- package/dist/runtime/assets.d.ts +12 -0
- package/dist/runtime/assets.js +138 -0
- package/dist/runtime/empty-assets-registry.d.ts +6 -0
- package/dist/runtime/empty-assets-registry.js +4 -0
- package/dist/runtime/empty-registry.d.ts +6 -0
- package/dist/runtime/empty-registry.js +4 -0
- package/dist/runtime/state.d.ts +4 -0
- package/dist/runtime/state.js +15 -0
- package/dist/runtime/workspace.d.ts +2 -0
- package/dist/runtime/workspace.js +2 -0
- package/dist/runtime.d.ts +38 -0
- package/dist/runtime.js +643 -0
- package/dist/search-C4REyHj9.js +39 -0
- package/dist/server.d.ts +65 -0
- package/dist/server.js +355 -0
- package/dist/shared-BRycRSbo.js +255 -0
- package/dist/source-metadata.d.ts +2 -0
- package/dist/source-metadata.js +2 -0
- package/dist/state-DSAHEsq6.d.ts +25 -0
- package/dist/sync-DO42ypji.js +269 -0
- package/dist/target-D4Bqb1eH.js +11 -0
- package/dist/test.d.ts +2 -0
- package/dist/test.js +2 -0
- package/dist/types-DHkae7Cb.d.ts +628 -0
- package/dist/use-D16tf8Ph.d.ts +86 -0
- package/dist/use-d_PlAdOu.js +353 -0
- package/dist/utils-BPdaCyI6.js +55 -0
- package/dist/vite-NWC9mFjI.js +1882 -0
- package/dist/vite.d.ts +50 -0
- package/dist/vite.js +2 -0
- package/dist/workspace-f2DBLmPZ.d.ts +6 -0
- package/dist/workspace-n4wBmdaM.js +1476 -0
- package/package.json +197 -5
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { O as WorkspaceAssetsRegistry, Zt as WorkspaceStore, o as GitHubWorkspaceStoreOptions, t as CloudflareArtifactsWorkspaceStoreOptions, v as ResolvedWorkspaceModuleOptions, w as VercelBlobWorkspaceStoreOptions } from "./types-DHkae7Cb.js";
|
|
2
|
+
import { t as WorkspaceRegistry } from "./registry-CoC9JxVt.js";
|
|
3
|
+
|
|
4
|
+
//#region src/runtime/config.d.ts
|
|
5
|
+
declare function setWorkspaceRuntimeConfig(config: false | ResolvedWorkspaceModuleOptions): void;
|
|
6
|
+
declare function getWorkspaceRuntimeConfig(): false | ResolvedWorkspaceModuleOptions;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/runtime/hosted-store-loader.d.ts
|
|
9
|
+
type HostedWorkspaceStoreOptions = CloudflareArtifactsWorkspaceStoreOptions | GitHubWorkspaceStoreOptions | VercelBlobWorkspaceStoreOptions;
|
|
10
|
+
type WorkspaceHostedStoreLoader = (options: HostedWorkspaceStoreOptions, workspaceName: string) => WorkspaceStore;
|
|
11
|
+
declare function setWorkspaceHostedStoreLoader(loader: WorkspaceHostedStoreLoader | undefined): void;
|
|
12
|
+
declare function getWorkspaceHostedStoreLoader(): WorkspaceHostedStoreLoader | undefined;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region ../internal/src/runtime/cloudflare-env.d.ts
|
|
15
|
+
type CloudflareWorkerEnv = Record<string, unknown>;
|
|
16
|
+
declare function setActiveCloudflareEnv(env: CloudflareWorkerEnv | undefined): void;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/core/workspace-cache.d.ts
|
|
19
|
+
declare function resetWorkspaceStoreCache(): void;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/runtime/state.d.ts
|
|
22
|
+
declare function setWorkspaceRuntimeRegistry(registry: WorkspaceRegistry): void;
|
|
23
|
+
declare function setWorkspaceRuntimeAssetsRegistry(registry: WorkspaceAssetsRegistry): void;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { HostedWorkspaceStoreOptions as a, setWorkspaceHostedStoreLoader as c, setActiveCloudflareEnv as i, getWorkspaceRuntimeConfig as l, setWorkspaceRuntimeRegistry as n, WorkspaceHostedStoreLoader as o, resetWorkspaceStoreCache as r, getWorkspaceHostedStoreLoader as s, setWorkspaceRuntimeAssetsRegistry as t, setWorkspaceRuntimeConfig as u };
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { d as sha256, n as contentStreamToBytes, p as workspaceError } from "./path-CNI6wKIU.js";
|
|
2
|
+
import { a as normalizeWorkspaceSources, n as createSourceContext, s as sourceMountContainsPath } from "./config--r5unwPc.js";
|
|
3
|
+
import { a as sourceSyncMetaKey, c as normalizeSourceItemPath, i as readWorkspaceSourceSyncState, o as workspaceSourceSyncStateEquals } from "./workspace-n4wBmdaM.js";
|
|
4
|
+
//#region src/sources/sync.ts
|
|
5
|
+
const sourceSyncLocks = /* @__PURE__ */ new Map();
|
|
6
|
+
function zeroCounts() {
|
|
7
|
+
return {
|
|
8
|
+
added: 0,
|
|
9
|
+
removed: 0,
|
|
10
|
+
unchanged: 0,
|
|
11
|
+
updated: 0
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function countPath(counts, status) {
|
|
15
|
+
counts[status]++;
|
|
16
|
+
}
|
|
17
|
+
async function contentFromItem(item) {
|
|
18
|
+
if (item.contentStream) {
|
|
19
|
+
if (typeof item.content !== "undefined" || typeof item.data !== "undefined") throw workspaceError("[vitehub] Workspace source items cannot define contentStream with content or data.");
|
|
20
|
+
return await contentStreamToBytes(item.contentStream);
|
|
21
|
+
}
|
|
22
|
+
return item.content ?? (typeof item.data === "undefined" ? "" : JSON.stringify(item.data, null, 2));
|
|
23
|
+
}
|
|
24
|
+
async function sourceConfigHash(source) {
|
|
25
|
+
return await sha256({
|
|
26
|
+
key: source.key,
|
|
27
|
+
mountPath: source.mountPath,
|
|
28
|
+
source: source.source.fingerprint,
|
|
29
|
+
sync: source.sync
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function sourceLockKey(definition, source) {
|
|
33
|
+
return `${definition.name}\0${source.key}`;
|
|
34
|
+
}
|
|
35
|
+
function lockSkippedStatus(source) {
|
|
36
|
+
return {
|
|
37
|
+
counts: zeroCounts(),
|
|
38
|
+
mountPath: source.mountPath,
|
|
39
|
+
source: source.key,
|
|
40
|
+
status: "skipped"
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function resultStatus(sources) {
|
|
44
|
+
if (sources.some((source) => source.status === "error")) return sources.some((source) => source.status === "ready") ? "partial" : "error";
|
|
45
|
+
if (sources.every((source) => source.status === "skipped")) return "skipped";
|
|
46
|
+
return "ready";
|
|
47
|
+
}
|
|
48
|
+
function selectedSyncSources(definition, options) {
|
|
49
|
+
const sources = normalizeWorkspaceSources(definition.sources).filter((source) => source.sync);
|
|
50
|
+
if (options.sources === "all") return sources;
|
|
51
|
+
return [...new Set(options.sources)].map((key) => {
|
|
52
|
+
const source = sources.find((item) => item.key === key);
|
|
53
|
+
if (!source) throw workspaceError(normalizeWorkspaceSources(definition.sources).some((item) => item.key === key) ? `[vitehub] Workspace source ${JSON.stringify(key)} is not configured for Source Sync. Add sync: true to the source binding.` : `[vitehub] Workspace source ${JSON.stringify(key)} does not exist.`);
|
|
54
|
+
return source;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async function getSourceItems(source, ctx) {
|
|
58
|
+
await source.source.prepare?.(ctx);
|
|
59
|
+
if (source.source.getItems) return await source.source.getItems(ctx);
|
|
60
|
+
return await Promise.all((await source.source.getKeys(ctx)).map(async (key) => await source.source.getItem(key, ctx)));
|
|
61
|
+
}
|
|
62
|
+
async function shouldRemoveStalePath(store, path, metadata) {
|
|
63
|
+
const file = await store.readFile(path);
|
|
64
|
+
if (!file) return false;
|
|
65
|
+
return await sha256(file.content) === metadata.digest;
|
|
66
|
+
}
|
|
67
|
+
async function planSourceSync(definition, store, source) {
|
|
68
|
+
const ctx = createSourceContext(definition, source);
|
|
69
|
+
const [previousState, configHash, items] = await Promise.all([
|
|
70
|
+
store.getMeta?.(sourceSyncMetaKey(source.key)).then(readWorkspaceSourceSyncState),
|
|
71
|
+
sourceConfigHash(source),
|
|
72
|
+
getSourceItems(source, ctx)
|
|
73
|
+
]);
|
|
74
|
+
const counts = zeroCounts();
|
|
75
|
+
const paths = [];
|
|
76
|
+
const files = [];
|
|
77
|
+
const nextPaths = {};
|
|
78
|
+
for (const item of items) {
|
|
79
|
+
const { path, sourcePath } = normalizeSourceItemPath(source, item, { operation: "Source Sync" });
|
|
80
|
+
if (nextPaths[path]) throw workspaceError(`[vitehub] Workspace Source Sync produced duplicate path: ${path}.`);
|
|
81
|
+
const content = await contentFromItem(item);
|
|
82
|
+
const digest = await sha256(content);
|
|
83
|
+
const existing = await store.readFile(path);
|
|
84
|
+
const existingDigest = existing ? await sha256(existing.content) : void 0;
|
|
85
|
+
const status = existing ? existingDigest === digest ? "unchanged" : "updated" : "added";
|
|
86
|
+
countPath(counts, status);
|
|
87
|
+
paths.push({
|
|
88
|
+
path,
|
|
89
|
+
sourcePath,
|
|
90
|
+
status
|
|
91
|
+
});
|
|
92
|
+
nextPaths[path] = {
|
|
93
|
+
digest,
|
|
94
|
+
mediaType: item.mediaType,
|
|
95
|
+
sourcePath
|
|
96
|
+
};
|
|
97
|
+
files.push({
|
|
98
|
+
path,
|
|
99
|
+
content,
|
|
100
|
+
mediaType: item.mediaType,
|
|
101
|
+
metadata: {
|
|
102
|
+
...item.metadata,
|
|
103
|
+
source: source.key,
|
|
104
|
+
sourcePath
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
const removals = [];
|
|
109
|
+
if (source.sync && source.sync.stale === "remove" && previousState) for (const [path, metadata] of Object.entries(previousState.paths)) {
|
|
110
|
+
if (nextPaths[path]) continue;
|
|
111
|
+
if (!await shouldRemoveStalePath(store, path, metadata)) continue;
|
|
112
|
+
const removal = {
|
|
113
|
+
path,
|
|
114
|
+
sourcePath: metadata.sourcePath,
|
|
115
|
+
status: "removed"
|
|
116
|
+
};
|
|
117
|
+
removals.push(removal);
|
|
118
|
+
paths.push(removal);
|
|
119
|
+
countPath(counts, "removed");
|
|
120
|
+
}
|
|
121
|
+
const nextState = {
|
|
122
|
+
configHash,
|
|
123
|
+
mountPath: source.mountPath,
|
|
124
|
+
paths: nextPaths,
|
|
125
|
+
source: source.key
|
|
126
|
+
};
|
|
127
|
+
return {
|
|
128
|
+
counts,
|
|
129
|
+
files,
|
|
130
|
+
nextState,
|
|
131
|
+
paths,
|
|
132
|
+
removals,
|
|
133
|
+
source,
|
|
134
|
+
stateChanged: !workspaceSourceSyncStateEquals(previousState, nextState)
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
async function applySourceSyncPlan(store, plan) {
|
|
138
|
+
if (plan.source.mountPath) await store.mkdir(plan.source.mountPath, { recursive: true });
|
|
139
|
+
for (const file of plan.files) await store.writeFile(file.path, file);
|
|
140
|
+
for (const removal of plan.removals) await store.rm(removal.path, { force: true });
|
|
141
|
+
await pruneEmptySourceDirectories(store, plan.source, plan.removals);
|
|
142
|
+
if (plan.stateChanged) await store.setMeta?.(sourceSyncMetaKey(plan.source.key), plan.nextState);
|
|
143
|
+
}
|
|
144
|
+
async function pruneEmptySourceDirectories(store, source, removals) {
|
|
145
|
+
const directories = /* @__PURE__ */ new Set();
|
|
146
|
+
for (const removal of removals) for (const directory of parentDirectories(removal.path)) {
|
|
147
|
+
if (directory === source.mountPath) continue;
|
|
148
|
+
if (source.mountPath && !sourceMountContainsPath(source, directory)) continue;
|
|
149
|
+
directories.add(directory);
|
|
150
|
+
}
|
|
151
|
+
for (const directory of [...directories].sort((left, right) => right.length - left.length)) {
|
|
152
|
+
if ((await store.stat(directory))?.type !== "directory") continue;
|
|
153
|
+
if ((await store.list(directory)).length > 0) continue;
|
|
154
|
+
await store.rm(directory, {
|
|
155
|
+
force: true,
|
|
156
|
+
recursive: true
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function parentDirectories(path) {
|
|
161
|
+
const parts = path.split("/").filter(Boolean);
|
|
162
|
+
const directories = [];
|
|
163
|
+
for (let index = parts.length - 1; index > 0; index--) directories.push(parts.slice(0, index).join("/"));
|
|
164
|
+
return directories;
|
|
165
|
+
}
|
|
166
|
+
function statusFromPlan(plan, details) {
|
|
167
|
+
return {
|
|
168
|
+
counts: plan.counts,
|
|
169
|
+
mountPath: plan.source.mountPath,
|
|
170
|
+
paths: details === "paths" ? plan.paths : void 0,
|
|
171
|
+
source: plan.source.key,
|
|
172
|
+
status: "ready"
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
async function snapshotSyncedWorkspace(definition, store, options) {
|
|
176
|
+
if (!(!!options.snapshot || !!options.publish)) return;
|
|
177
|
+
const snapshotOptions = typeof options.snapshot === "object" ? options.snapshot : {};
|
|
178
|
+
const snapshot = await store.snapshot(normalizeSnapshotOptions(snapshotOptions));
|
|
179
|
+
if (options.publish) {
|
|
180
|
+
const { publishWorkspaceSnapshot } = await import("./lifecycle-Lhk3dAMt.js").then((n) => n.t);
|
|
181
|
+
await publishWorkspaceSnapshot(definition, store, snapshot);
|
|
182
|
+
}
|
|
183
|
+
return snapshot;
|
|
184
|
+
}
|
|
185
|
+
function normalizeSnapshotOptions(options) {
|
|
186
|
+
if (!options || typeof options !== "object") return { name: "source-sync" };
|
|
187
|
+
return { name: options.name || options.message || "source-sync" };
|
|
188
|
+
}
|
|
189
|
+
async function syncWorkspaceSourcesUnlocked(definition, store, options, sources, initialStatuses, started) {
|
|
190
|
+
const statuses = [...initialStatuses];
|
|
191
|
+
const plans = [];
|
|
192
|
+
for (const source of sources) try {
|
|
193
|
+
plans.push(await planSourceSync(definition, store, source));
|
|
194
|
+
} catch (error) {
|
|
195
|
+
statuses.push({
|
|
196
|
+
counts: zeroCounts(),
|
|
197
|
+
error: error instanceof Error ? error.message : String(error),
|
|
198
|
+
mountPath: source.mountPath,
|
|
199
|
+
source: source.key,
|
|
200
|
+
status: "error"
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
if (statuses.some((status) => status.status === "error") && !options.publishPartial) return {
|
|
204
|
+
durationMs: Date.now() - started,
|
|
205
|
+
published: false,
|
|
206
|
+
sources: [...statuses, ...plans.map((plan) => ({
|
|
207
|
+
counts: plan.counts,
|
|
208
|
+
mountPath: plan.source.mountPath,
|
|
209
|
+
paths: options.details === "paths" ? plan.paths : void 0,
|
|
210
|
+
source: plan.source.key,
|
|
211
|
+
status: "skipped"
|
|
212
|
+
}))],
|
|
213
|
+
status: resultStatus(statuses)
|
|
214
|
+
};
|
|
215
|
+
for (const plan of plans) await applySourceSyncPlan(store, plan);
|
|
216
|
+
const planStatuses = plans.map((plan) => statusFromPlan(plan, options.details));
|
|
217
|
+
const resultSources = [...statuses, ...planStatuses];
|
|
218
|
+
const snapshot = resultStatus(resultSources) === "ready" || options.publishPartial && planStatuses.length > 0 ? await snapshotSyncedWorkspace(definition, store, options) : void 0;
|
|
219
|
+
return {
|
|
220
|
+
durationMs: Date.now() - started,
|
|
221
|
+
published: !!options.publish && !!snapshot,
|
|
222
|
+
snapshot,
|
|
223
|
+
sources: resultSources,
|
|
224
|
+
status: resultStatus(resultSources)
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
async function syncWorkspaceSources(definition, store, options) {
|
|
228
|
+
if (!options || !options.sources) throw workspaceError("[vitehub] workspace.sync({ sources }) requires an explicit Source selection.");
|
|
229
|
+
if (!store.getMeta || !store.setMeta) throw workspaceError("[vitehub] Workspace Source Sync requires a Workspace Store with metadata support.");
|
|
230
|
+
const started = Date.now();
|
|
231
|
+
const sources = selectedSyncSources(definition, options);
|
|
232
|
+
if (sources.length === 0) return {
|
|
233
|
+
durationMs: 0,
|
|
234
|
+
published: false,
|
|
235
|
+
sources: [],
|
|
236
|
+
status: "skipped"
|
|
237
|
+
};
|
|
238
|
+
const statuses = [];
|
|
239
|
+
const runnableSources = [];
|
|
240
|
+
for (const source of sources) {
|
|
241
|
+
const key = sourceLockKey(definition, source);
|
|
242
|
+
let existing = sourceSyncLocks.get(key);
|
|
243
|
+
while (existing) {
|
|
244
|
+
if (source.sync && source.sync.concurrency === "skip") {
|
|
245
|
+
statuses.push(lockSkippedStatus(source));
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
await existing.catch(() => void 0);
|
|
249
|
+
existing = sourceSyncLocks.get(key);
|
|
250
|
+
}
|
|
251
|
+
if (!statuses.some((status) => status.source === source.key)) runnableSources.push(source);
|
|
252
|
+
}
|
|
253
|
+
if (runnableSources.length === 0) return {
|
|
254
|
+
durationMs: Date.now() - started,
|
|
255
|
+
published: false,
|
|
256
|
+
sources: statuses,
|
|
257
|
+
status: resultStatus(statuses)
|
|
258
|
+
};
|
|
259
|
+
const lockKeys = runnableSources.map((source) => sourceLockKey(definition, source)).sort();
|
|
260
|
+
const promise = syncWorkspaceSourcesUnlocked(definition, store, options, runnableSources, statuses, started);
|
|
261
|
+
for (const key of lockKeys) sourceSyncLocks.set(key, promise);
|
|
262
|
+
try {
|
|
263
|
+
return await promise;
|
|
264
|
+
} finally {
|
|
265
|
+
for (const key of lockKeys) if (sourceSyncLocks.get(key) === promise) sourceSyncLocks.delete(key);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
//#endregion
|
|
269
|
+
export { syncWorkspaceSources };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/storage/target.ts
|
|
2
|
+
const workspaceStoreTarget = Symbol.for("vitehub.workspace.storeTarget");
|
|
3
|
+
function forwardWorkspaceStoreTarget(source, target) {
|
|
4
|
+
const resolveTarget = source[workspaceStoreTarget];
|
|
5
|
+
if (resolveTarget) target[workspaceStoreTarget] = resolveTarget.bind(source);
|
|
6
|
+
}
|
|
7
|
+
async function resolveWorkspaceStoreTarget(source) {
|
|
8
|
+
return await source[workspaceStoreTarget]?.();
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { resolveWorkspaceStoreTarget as n, workspaceStoreTarget as r, forwardWorkspaceStoreTarget as t };
|
package/dist/test.d.ts
ADDED
package/dist/test.js
ADDED