@arcote.tech/arc-cli 0.7.11 → 0.7.13
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/dist/index.js +84 -3
- package/package.json +9 -9
- package/src/builder/module-builder.ts +31 -1
package/dist/index.js
CHANGED
|
@@ -15486,6 +15486,7 @@ class StreamingQueryCache {
|
|
|
15486
15486
|
views = [];
|
|
15487
15487
|
activeStreams = new Map;
|
|
15488
15488
|
pendingUnsubscribes = new Map;
|
|
15489
|
+
streamScopes = new Map;
|
|
15489
15490
|
static UNSUBSCRIBE_DELAY_MS = 5000;
|
|
15490
15491
|
registerViews(views) {
|
|
15491
15492
|
this.views = views;
|
|
@@ -15544,6 +15545,7 @@ class StreamingQueryCache {
|
|
|
15544
15545
|
if (current2 && current2.refCount <= 0) {
|
|
15545
15546
|
current2.unsubscribe();
|
|
15546
15547
|
this.activeStreams.delete(viewName);
|
|
15548
|
+
this.streamScopes.delete(viewName);
|
|
15547
15549
|
}
|
|
15548
15550
|
}, StreamingQueryCache.UNSUBSCRIBE_DELAY_MS);
|
|
15549
15551
|
this.pendingUnsubscribes.set(viewName, timeout);
|
|
@@ -15551,6 +15553,8 @@ class StreamingQueryCache {
|
|
|
15551
15553
|
}
|
|
15552
15554
|
subscribeQuery(descriptor, eventWire, scope) {
|
|
15553
15555
|
const key = descriptor.element;
|
|
15556
|
+
if (scope)
|
|
15557
|
+
this.streamScopes.set(key, scope);
|
|
15554
15558
|
const { unsubscribe } = this.registerStream(key, () => {
|
|
15555
15559
|
const subId = eventWire.subscribeQuery(descriptor, (data) => {
|
|
15556
15560
|
this.setViewData(descriptor.element, data);
|
|
@@ -15559,6 +15563,28 @@ class StreamingQueryCache {
|
|
|
15559
15563
|
});
|
|
15560
15564
|
return unsubscribe;
|
|
15561
15565
|
}
|
|
15566
|
+
invalidateScope(scope) {
|
|
15567
|
+
for (const [viewName, viewScope] of this.streamScopes) {
|
|
15568
|
+
if (viewScope !== scope)
|
|
15569
|
+
continue;
|
|
15570
|
+
const pending = this.pendingUnsubscribes.get(viewName);
|
|
15571
|
+
if (pending) {
|
|
15572
|
+
clearTimeout(pending);
|
|
15573
|
+
this.pendingUnsubscribes.delete(viewName);
|
|
15574
|
+
}
|
|
15575
|
+
const stream2 = this.activeStreams.get(viewName);
|
|
15576
|
+
if (stream2) {
|
|
15577
|
+
try {
|
|
15578
|
+
stream2.unsubscribe();
|
|
15579
|
+
} catch {}
|
|
15580
|
+
this.activeStreams.delete(viewName);
|
|
15581
|
+
}
|
|
15582
|
+
this.streamScopes.delete(viewName);
|
|
15583
|
+
const store = this.stores.get(viewName);
|
|
15584
|
+
if (store)
|
|
15585
|
+
store.clear();
|
|
15586
|
+
}
|
|
15587
|
+
}
|
|
15562
15588
|
setViewData(viewName, data) {
|
|
15563
15589
|
const store = this.stores.get(viewName);
|
|
15564
15590
|
if (!store)
|
|
@@ -15606,6 +15632,11 @@ class StreamingQueryCache {
|
|
|
15606
15632
|
stream2.unsubscribe();
|
|
15607
15633
|
}
|
|
15608
15634
|
this.activeStreams.clear();
|
|
15635
|
+
this.streamScopes.clear();
|
|
15636
|
+
for (const timeout of this.pendingUnsubscribes.values()) {
|
|
15637
|
+
clearTimeout(timeout);
|
|
15638
|
+
}
|
|
15639
|
+
this.pendingUnsubscribes.clear();
|
|
15609
15640
|
for (const store of this.stores.values()) {
|
|
15610
15641
|
store.clear();
|
|
15611
15642
|
}
|
|
@@ -19299,7 +19330,11 @@ var init_dist = __esm(() => {
|
|
|
19299
19330
|
if (!adapters.commandWire) {
|
|
19300
19331
|
throw new Error(`Command "${this.data.name}" has no handler and no commandWire adapter available for remote execution`);
|
|
19301
19332
|
}
|
|
19302
|
-
|
|
19333
|
+
const wireAuth = adapters.scope ? {
|
|
19334
|
+
scope: adapters.scope.scopeName,
|
|
19335
|
+
token: adapters.scope.getToken()
|
|
19336
|
+
} : undefined;
|
|
19337
|
+
return await adapters.commandWire.executeCommand(this.data.name, params, wireAuth);
|
|
19303
19338
|
};
|
|
19304
19339
|
return Object.assign(executeFunc, { params: this.data.params });
|
|
19305
19340
|
}
|
|
@@ -22843,6 +22878,7 @@ class StreamingQueryCache2 {
|
|
|
22843
22878
|
views = [];
|
|
22844
22879
|
activeStreams = new Map;
|
|
22845
22880
|
pendingUnsubscribes = new Map;
|
|
22881
|
+
streamScopes = new Map;
|
|
22846
22882
|
static UNSUBSCRIBE_DELAY_MS = 5000;
|
|
22847
22883
|
registerViews(views) {
|
|
22848
22884
|
this.views = views;
|
|
@@ -22901,6 +22937,7 @@ class StreamingQueryCache2 {
|
|
|
22901
22937
|
if (current22 && current22.refCount <= 0) {
|
|
22902
22938
|
current22.unsubscribe();
|
|
22903
22939
|
this.activeStreams.delete(viewName);
|
|
22940
|
+
this.streamScopes.delete(viewName);
|
|
22904
22941
|
}
|
|
22905
22942
|
}, StreamingQueryCache2.UNSUBSCRIBE_DELAY_MS);
|
|
22906
22943
|
this.pendingUnsubscribes.set(viewName, timeout);
|
|
@@ -22908,6 +22945,8 @@ class StreamingQueryCache2 {
|
|
|
22908
22945
|
}
|
|
22909
22946
|
subscribeQuery(descriptor, eventWire, scope) {
|
|
22910
22947
|
const key = descriptor.element;
|
|
22948
|
+
if (scope)
|
|
22949
|
+
this.streamScopes.set(key, scope);
|
|
22911
22950
|
const { unsubscribe } = this.registerStream(key, () => {
|
|
22912
22951
|
const subId = eventWire.subscribeQuery(descriptor, (data) => {
|
|
22913
22952
|
this.setViewData(descriptor.element, data);
|
|
@@ -22916,6 +22955,28 @@ class StreamingQueryCache2 {
|
|
|
22916
22955
|
});
|
|
22917
22956
|
return unsubscribe;
|
|
22918
22957
|
}
|
|
22958
|
+
invalidateScope(scope) {
|
|
22959
|
+
for (const [viewName, viewScope] of this.streamScopes) {
|
|
22960
|
+
if (viewScope !== scope)
|
|
22961
|
+
continue;
|
|
22962
|
+
const pending = this.pendingUnsubscribes.get(viewName);
|
|
22963
|
+
if (pending) {
|
|
22964
|
+
clearTimeout(pending);
|
|
22965
|
+
this.pendingUnsubscribes.delete(viewName);
|
|
22966
|
+
}
|
|
22967
|
+
const stream2 = this.activeStreams.get(viewName);
|
|
22968
|
+
if (stream2) {
|
|
22969
|
+
try {
|
|
22970
|
+
stream2.unsubscribe();
|
|
22971
|
+
} catch {}
|
|
22972
|
+
this.activeStreams.delete(viewName);
|
|
22973
|
+
}
|
|
22974
|
+
this.streamScopes.delete(viewName);
|
|
22975
|
+
const store = this.stores.get(viewName);
|
|
22976
|
+
if (store)
|
|
22977
|
+
store.clear();
|
|
22978
|
+
}
|
|
22979
|
+
}
|
|
22919
22980
|
setViewData(viewName, data) {
|
|
22920
22981
|
const store = this.stores.get(viewName);
|
|
22921
22982
|
if (!store)
|
|
@@ -22963,6 +23024,11 @@ class StreamingQueryCache2 {
|
|
|
22963
23024
|
stream2.unsubscribe();
|
|
22964
23025
|
}
|
|
22965
23026
|
this.activeStreams.clear();
|
|
23027
|
+
this.streamScopes.clear();
|
|
23028
|
+
for (const timeout of this.pendingUnsubscribes.values()) {
|
|
23029
|
+
clearTimeout(timeout);
|
|
23030
|
+
}
|
|
23031
|
+
this.pendingUnsubscribes.clear();
|
|
22966
23032
|
for (const store of this.stores.values()) {
|
|
22967
23033
|
store.clear();
|
|
22968
23034
|
}
|
|
@@ -25091,7 +25157,11 @@ var init_dist2 = __esm(() => {
|
|
|
25091
25157
|
if (!adapters.commandWire) {
|
|
25092
25158
|
throw new Error(`Command "${this.data.name}" has no handler and no commandWire adapter available for remote execution`);
|
|
25093
25159
|
}
|
|
25094
|
-
|
|
25160
|
+
const wireAuth = adapters.scope ? {
|
|
25161
|
+
scope: adapters.scope.scopeName,
|
|
25162
|
+
token: adapters.scope.getToken()
|
|
25163
|
+
} : undefined;
|
|
25164
|
+
return await adapters.commandWire.executeCommand(this.data.name, params, wireAuth);
|
|
25095
25165
|
};
|
|
25096
25166
|
return Object.assign(executeFunc, { params: this.data.params });
|
|
25097
25167
|
}
|
|
@@ -34648,6 +34718,17 @@ function singleReactPlugin(rootDir) {
|
|
|
34648
34718
|
}
|
|
34649
34719
|
};
|
|
34650
34720
|
}
|
|
34721
|
+
function serverExternalsPlugin() {
|
|
34722
|
+
return {
|
|
34723
|
+
name: "server-externals",
|
|
34724
|
+
setup(build2) {
|
|
34725
|
+
build2.onResolve({ filter: /^(@aws-sdk|@smithy)\// }, (args) => ({
|
|
34726
|
+
path: args.path,
|
|
34727
|
+
external: true
|
|
34728
|
+
}));
|
|
34729
|
+
}
|
|
34730
|
+
};
|
|
34731
|
+
}
|
|
34651
34732
|
function jsxDevShimPlugin() {
|
|
34652
34733
|
return {
|
|
34653
34734
|
name: "jsx-dev-runtime-shim",
|
|
@@ -34773,7 +34854,7 @@ async function buildContextClient(pkg, rootDir, client, cache, noCache) {
|
|
|
34773
34854
|
format: "esm",
|
|
34774
34855
|
naming: "index.[ext]",
|
|
34775
34856
|
external: externals,
|
|
34776
|
-
plugins: [jsxDevShimPlugin()],
|
|
34857
|
+
plugins: isBrowser2 ? [jsxDevShimPlugin()] : [jsxDevShimPlugin(), serverExternalsPlugin()],
|
|
34777
34858
|
define: client.defines
|
|
34778
34859
|
});
|
|
34779
34860
|
if (!result.success) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcote.tech/arc-cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.13",
|
|
4
4
|
"description": "CLI tool for Arc framework",
|
|
5
5
|
"module": "index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
"build": "bun build --target=bun ./src/index.ts --outdir=dist --external @arcote.tech/arc --external @arcote.tech/arc-ds --external @arcote.tech/arc-react --external @arcote.tech/platform --external '@opentelemetry/*' && chmod +x dist/index.js"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@arcote.tech/arc": "^0.7.
|
|
16
|
-
"@arcote.tech/arc-ds": "^0.7.
|
|
17
|
-
"@arcote.tech/arc-react": "^0.7.
|
|
18
|
-
"@arcote.tech/arc-host": "^0.7.
|
|
19
|
-
"@arcote.tech/arc-adapter-db-sqlite": "^0.7.
|
|
20
|
-
"@arcote.tech/arc-adapter-db-postgres": "^0.7.
|
|
21
|
-
"@arcote.tech/arc-otel": "^0.7.
|
|
15
|
+
"@arcote.tech/arc": "^0.7.13",
|
|
16
|
+
"@arcote.tech/arc-ds": "^0.7.13",
|
|
17
|
+
"@arcote.tech/arc-react": "^0.7.13",
|
|
18
|
+
"@arcote.tech/arc-host": "^0.7.13",
|
|
19
|
+
"@arcote.tech/arc-adapter-db-sqlite": "^0.7.13",
|
|
20
|
+
"@arcote.tech/arc-adapter-db-postgres": "^0.7.13",
|
|
21
|
+
"@arcote.tech/arc-otel": "^0.7.13",
|
|
22
22
|
"@opentelemetry/api": "^1.9.0",
|
|
23
23
|
"@opentelemetry/api-logs": "^0.57.0",
|
|
24
24
|
"@opentelemetry/core": "^1.30.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@opentelemetry/sdk-trace-base": "^1.30.0",
|
|
32
32
|
"@opentelemetry/sdk-trace-node": "^1.30.0",
|
|
33
33
|
"@opentelemetry/semantic-conventions": "^1.27.0",
|
|
34
|
-
"@arcote.tech/platform": "^0.7.
|
|
34
|
+
"@arcote.tech/platform": "^0.7.13",
|
|
35
35
|
"@clack/prompts": "^0.9.0",
|
|
36
36
|
"commander": "^11.1.0",
|
|
37
37
|
"chokidar": "^3.5.3",
|
|
@@ -97,6 +97,34 @@ function singleReactPlugin(rootDir: string): import("bun").BunPlugin {
|
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Marks heavy server-side packages as external. Bun.build's `external: string[]`
|
|
102
|
+
* accepts only literal package names — wildcard like `@aws-sdk/*` is treated
|
|
103
|
+
* verbatim and doesn't match anything. This plugin uses `onResolve` regex to
|
|
104
|
+
* catch any subpackage matching the prefix and marks it external.
|
|
105
|
+
*
|
|
106
|
+
* Removes ~10-15 MB of AWS SDK v3 from every server bundle that transitively
|
|
107
|
+
* pulls `@arcote.tech/arc-files` (e.g. `@ndt/content` was 340 MB before).
|
|
108
|
+
*
|
|
109
|
+
* Runtime requirement: each external package must be available in
|
|
110
|
+
* `node_modules/` at server startup (Bun resolves bare specifiers). Consumer
|
|
111
|
+
* apps declare them in root `package.json` dependencies.
|
|
112
|
+
*/
|
|
113
|
+
function serverExternalsPlugin(): import("bun").BunPlugin {
|
|
114
|
+
return {
|
|
115
|
+
name: "server-externals",
|
|
116
|
+
setup(build) {
|
|
117
|
+
// @aws-sdk/* and @smithy/* — full AWS SDK v3 + low-level signing/HTTP
|
|
118
|
+
// primitives it depends on. Add more prefixes here if other heavy
|
|
119
|
+
// server-only libs appear (e.g. `@google-cloud/*`).
|
|
120
|
+
build.onResolve({ filter: /^(@aws-sdk|@smithy)\// }, (args) => ({
|
|
121
|
+
path: args.path,
|
|
122
|
+
external: true,
|
|
123
|
+
}));
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
100
128
|
function jsxDevShimPlugin(): import("bun").BunPlugin {
|
|
101
129
|
return {
|
|
102
130
|
name: "jsx-dev-runtime-shim",
|
|
@@ -311,7 +339,9 @@ async function buildContextClient(
|
|
|
311
339
|
format: "esm",
|
|
312
340
|
naming: "index.[ext]",
|
|
313
341
|
external: externals,
|
|
314
|
-
plugins:
|
|
342
|
+
plugins: isBrowser
|
|
343
|
+
? [jsxDevShimPlugin()]
|
|
344
|
+
: [jsxDevShimPlugin(), serverExternalsPlugin()],
|
|
315
345
|
define: client.defines,
|
|
316
346
|
});
|
|
317
347
|
|