@decohere/flux 0.0.1-dev.10 → 0.0.1-dev.100
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 +247 -0
- package/commonjs/src/deferred-script-runner.js +56 -0
- package/commonjs/src/flux.command.js +2 -2
- package/commonjs/src/flux.js +56 -0
- package/commonjs/src/flux.module.js +8 -7
- package/commonjs/src/hot-reload-server.js +302 -215
- package/commonjs/src/index.js +34 -2
- package/commonjs/src/rewrite-serve-specifier.js +44 -0
- package/commonjs/src/run.action.js +47 -0
- package/commonjs/src/run.command.js +65 -0
- package/commonjs/src/serve.action.js +76 -5
- package/commonjs/src/serve.command.js +31 -3
- package/commonjs/src/slice-serve.js +130 -0
- package/commonjs/src/source-module-loader.js +217 -0
- package/es6/src/deferred-script-runner.js +46 -0
- package/es6/src/flux.command.js +2 -2
- package/es6/src/flux.js +41 -0
- package/es6/src/flux.module.js +8 -7
- package/es6/src/hot-reload-server.js +283 -172
- package/es6/src/index.js +5 -3
- package/es6/src/rewrite-serve-specifier.js +38 -0
- package/es6/src/run.action.js +37 -0
- package/es6/src/run.command.js +55 -0
- package/es6/src/serve.action.js +71 -7
- package/es6/src/serve.command.js +31 -3
- package/es6/src/slice-serve.js +105 -0
- package/es6/src/source-module-loader.js +161 -0
- package/package.json +7 -6
- package/types/src/deferred-script-runner.d.ts +18 -0
- package/types/src/flux.d.ts +43 -0
- package/types/src/flux.module.d.ts +2 -0
- package/types/src/hot-reload-server.d.ts +55 -22
- package/types/src/index.d.ts +8 -1
- package/types/src/rewrite-serve-specifier.d.ts +13 -0
- package/types/src/run.action.d.ts +15 -0
- package/types/src/run.command.d.ts +11 -0
- package/types/src/serve.action.d.ts +11 -1
- package/types/src/serve.command.d.ts +5 -0
- package/types/src/slice-serve.d.ts +52 -0
- package/types/src/source-module-loader.d.ts +49 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "SourceModuleLoader", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return SourceModuleLoader;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _nodemodule = require("node:module");
|
|
12
|
+
const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
|
|
13
|
+
const _nodeurl = require("node:url");
|
|
14
|
+
const _decorators = require("@decohere/crucible/decorators");
|
|
15
|
+
const _forge = require("@decohere/forge");
|
|
16
|
+
const _mesh = require("@decohere/mesh");
|
|
17
|
+
const _io = require("@decohere/nexus/io");
|
|
18
|
+
const _scribe = require("@decohere/scribe");
|
|
19
|
+
const _rewriteservespecifier = require("./rewrite-serve-specifier.js");
|
|
20
|
+
function _interop_require_default(obj) {
|
|
21
|
+
return obj && obj.__esModule ? obj : {
|
|
22
|
+
default: obj
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
26
|
+
if (typeof WeakMap !== "function") return null;
|
|
27
|
+
var cacheBabelInterop = new WeakMap();
|
|
28
|
+
var cacheNodeInterop = new WeakMap();
|
|
29
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
30
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
31
|
+
})(nodeInterop);
|
|
32
|
+
}
|
|
33
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
34
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
35
|
+
return obj;
|
|
36
|
+
}
|
|
37
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
38
|
+
return {
|
|
39
|
+
default: obj
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
43
|
+
if (cache && cache.has(obj)) {
|
|
44
|
+
return cache.get(obj);
|
|
45
|
+
}
|
|
46
|
+
var newObj = {
|
|
47
|
+
__proto__: null
|
|
48
|
+
};
|
|
49
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
50
|
+
for(var key in obj){
|
|
51
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
52
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
53
|
+
if (desc && (desc.get || desc.set)) {
|
|
54
|
+
Object.defineProperty(newObj, key, desc);
|
|
55
|
+
} else {
|
|
56
|
+
newObj[key] = obj[key];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
newObj.default = obj;
|
|
61
|
+
if (cache) {
|
|
62
|
+
cache.set(obj, newObj);
|
|
63
|
+
}
|
|
64
|
+
return newObj;
|
|
65
|
+
}
|
|
66
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
67
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
68
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
69
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
70
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
71
|
+
}
|
|
72
|
+
class SourceModuleLoader {
|
|
73
|
+
logger = _scribe.scribe.logger(SourceModuleLoader.name);
|
|
74
|
+
transpiler = new _forge.SwcTranspiler();
|
|
75
|
+
disposed = false;
|
|
76
|
+
hooksRegistered = false;
|
|
77
|
+
workspace;
|
|
78
|
+
buildConfig = "debug";
|
|
79
|
+
fileInfoMap = new Map();
|
|
80
|
+
transpileCache = new Map();
|
|
81
|
+
aliasPaths = {};
|
|
82
|
+
aliasBaseUrl = _nodepath.default.resolve(".");
|
|
83
|
+
versionFileUrl = (fileUrl)=>fileUrl;
|
|
84
|
+
onResolved;
|
|
85
|
+
getWorkspace() {
|
|
86
|
+
return this.workspace;
|
|
87
|
+
}
|
|
88
|
+
getBuildConfig() {
|
|
89
|
+
return this.buildConfig;
|
|
90
|
+
}
|
|
91
|
+
hasSourceFile(absolutePath) {
|
|
92
|
+
return this.fileInfoMap.has(absolutePath);
|
|
93
|
+
}
|
|
94
|
+
sourceFilePaths() {
|
|
95
|
+
return this.fileInfoMap.keys();
|
|
96
|
+
}
|
|
97
|
+
setSourceFile(absolutePath, project) {
|
|
98
|
+
this.fileInfoMap.set(absolutePath, {
|
|
99
|
+
project
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
async configure(options) {
|
|
103
|
+
this.disposed = false;
|
|
104
|
+
this.transpileCache.clear();
|
|
105
|
+
this.buildConfig = options.buildConfig;
|
|
106
|
+
this.workspace = options.workspace ?? await (0, _forge.createWorkspace)();
|
|
107
|
+
this.versionFileUrl = options.versionFileUrl ?? ((fileUrl)=>fileUrl);
|
|
108
|
+
this.onResolved = options.onResolved;
|
|
109
|
+
this.fileInfoMap = await this.buildFileInfoMap(this.buildConfig);
|
|
110
|
+
const aliases = this.workspace.getPackageAliases(this.buildConfig);
|
|
111
|
+
this.aliasBaseUrl = aliases.baseUrl;
|
|
112
|
+
this.aliasPaths = aliases.paths;
|
|
113
|
+
}
|
|
114
|
+
registerHooks() {
|
|
115
|
+
if (this.hooksRegistered) return;
|
|
116
|
+
this.hooksRegistered = true;
|
|
117
|
+
// Compiled code carries inline source maps; Node only applies them to stack traces when
|
|
118
|
+
// this is on. Without it, errors point at compiled line numbers (#506).
|
|
119
|
+
process.setSourceMapsEnabled(true);
|
|
120
|
+
(0, _nodemodule.registerHooks)({
|
|
121
|
+
resolve: (specifier, context, next)=>{
|
|
122
|
+
if (this.disposed) return next(specifier, context);
|
|
123
|
+
const parentUrl = context.parentURL ?? "";
|
|
124
|
+
const rewritten = (0, _rewriteservespecifier.rewriteServeSpecifier)({
|
|
125
|
+
specifier,
|
|
126
|
+
parentUrl,
|
|
127
|
+
isWatchedTs: (filePath)=>this.fileInfoMap.has(filePath),
|
|
128
|
+
resolveBare: (bare)=>_mesh.packageAliases.resolvePath(bare, this.aliasPaths, this.aliasBaseUrl),
|
|
129
|
+
versionFileUrl: this.versionFileUrl
|
|
130
|
+
}) ?? specifier;
|
|
131
|
+
const result = next(rewritten, context);
|
|
132
|
+
this.onResolved?.(result, parentUrl);
|
|
133
|
+
return result;
|
|
134
|
+
},
|
|
135
|
+
load: (url, context, next)=>{
|
|
136
|
+
if (this.disposed) return next(url, context);
|
|
137
|
+
const result = this.loadTs(url);
|
|
138
|
+
if (result != null) {
|
|
139
|
+
return {
|
|
140
|
+
format: "module",
|
|
141
|
+
source: result.source,
|
|
142
|
+
shortCircuit: true
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
return next(url, context);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
async importEntry(absolutePath) {
|
|
150
|
+
const url = this.versionFileUrl(_io.io.pathToFileUrl(_nodepath.default.resolve(absolutePath)));
|
|
151
|
+
return Promise.resolve(url).then((p)=>/*#__PURE__*/ _interop_require_wildcard(require(p)));
|
|
152
|
+
}
|
|
153
|
+
invalidateTranspile(...absolutePaths) {
|
|
154
|
+
for (const fullPath of absolutePaths){
|
|
155
|
+
this.transpileCache.delete(fullPath);
|
|
156
|
+
this.transpiler.invalidateContentCache(new _io.FileEx({
|
|
157
|
+
fullPath
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
dispose() {
|
|
162
|
+
this.disposed = true;
|
|
163
|
+
this.transpileCache.clear();
|
|
164
|
+
this.fileInfoMap.clear();
|
|
165
|
+
this.workspace?.[Symbol.dispose]();
|
|
166
|
+
this.workspace = undefined;
|
|
167
|
+
}
|
|
168
|
+
async buildFileInfoMap(buildConfig) {
|
|
169
|
+
const projects = this.workspace?.getProjects(buildConfig) ?? [];
|
|
170
|
+
const entries = await Promise.all(projects.map(async (project)=>{
|
|
171
|
+
const files = await project.getAllFiles();
|
|
172
|
+
return files.map((file)=>[
|
|
173
|
+
file.fullPath,
|
|
174
|
+
{
|
|
175
|
+
project
|
|
176
|
+
}
|
|
177
|
+
]);
|
|
178
|
+
}));
|
|
179
|
+
return new Map(entries.flat());
|
|
180
|
+
}
|
|
181
|
+
loadTs(url) {
|
|
182
|
+
if (!url.startsWith("file:")) return null;
|
|
183
|
+
// fileURLToPath, not URL.pathname: decodes %20 and gives Windows paths, so files
|
|
184
|
+
// whose path has a space still match Mesh's list (#511).
|
|
185
|
+
const cleanPath = (0, _nodeurl.fileURLToPath)(url);
|
|
186
|
+
const fileInfo = this.fileInfoMap.get(cleanPath);
|
|
187
|
+
if (fileInfo == null) return null;
|
|
188
|
+
const cached = this.transpileCache.get(cleanPath);
|
|
189
|
+
if (cached != null) return {
|
|
190
|
+
source: cached
|
|
191
|
+
};
|
|
192
|
+
const { project } = fileInfo;
|
|
193
|
+
const tsConfig = project.getTsConfigSync();
|
|
194
|
+
const userConfig = project.getSwcConfigSync();
|
|
195
|
+
const file = new _io.FileEx({
|
|
196
|
+
fullPath: cleanPath
|
|
197
|
+
});
|
|
198
|
+
const response = this.transpiler.transformFileSync(file, _forge.BuildTargets.es6, {
|
|
199
|
+
tsConfig,
|
|
200
|
+
aliasPaths: true,
|
|
201
|
+
userConfig,
|
|
202
|
+
workspace: this.workspace,
|
|
203
|
+
projects: this.workspace?.getProjects(this.buildConfig)
|
|
204
|
+
});
|
|
205
|
+
if (response.outcome !== "success") {
|
|
206
|
+
this.logger.error(`Failed to transpile ${cleanPath}`, response);
|
|
207
|
+
throw new Error(`Failed to transpile ${cleanPath}`);
|
|
208
|
+
}
|
|
209
|
+
this.transpileCache.set(cleanPath, response.code);
|
|
210
|
+
return {
|
|
211
|
+
source: response.code
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
SourceModuleLoader = _ts_decorate([
|
|
216
|
+
(0, _decorators.injectable)()
|
|
217
|
+
], SourceModuleLoader);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
}
|
|
7
|
+
import { spawn } from "node:child_process";
|
|
8
|
+
import { injectable } from "@decohere/crucible/decorators";
|
|
9
|
+
import { detectPackageManager, packageManagerFromString } from "@decohere/nexus/interop";
|
|
10
|
+
import { scribe } from "@decohere/scribe";
|
|
11
|
+
export class DeferredScriptRunner {
|
|
12
|
+
logger = scribe.logger(DeferredScriptRunner.name);
|
|
13
|
+
children = [];
|
|
14
|
+
start(options) {
|
|
15
|
+
const pm = detectPackageManager(options.workspaceRoot) ?? packageManagerFromString("pnpm");
|
|
16
|
+
this.logger.info(`deferred ${options.label} — running ${pm.name} run ${options.script} in ${options.cwd}`);
|
|
17
|
+
const child = spawn(pm.name, [
|
|
18
|
+
"run",
|
|
19
|
+
options.script
|
|
20
|
+
], {
|
|
21
|
+
cwd: options.cwd,
|
|
22
|
+
stdio: "inherit",
|
|
23
|
+
env: process.env,
|
|
24
|
+
shell: false
|
|
25
|
+
});
|
|
26
|
+
child.on("exit", (code, signal)=>{
|
|
27
|
+
if (signal) return;
|
|
28
|
+
if (code != null && code !== 0) {
|
|
29
|
+
this.logger.warn(`deferred ${options.label} exited with ${code}`);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
this.children.push(child);
|
|
33
|
+
return child;
|
|
34
|
+
}
|
|
35
|
+
async [Symbol.asyncDispose]() {
|
|
36
|
+
for (const child of this.children){
|
|
37
|
+
if (!child.killed) {
|
|
38
|
+
child.kill("SIGTERM");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
this.children.length = 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
DeferredScriptRunner = _ts_decorate([
|
|
45
|
+
injectable()
|
|
46
|
+
], DeferredScriptRunner);
|
package/es6/src/flux.command.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DecohereCommand } from "@decohere/nexus/cli";
|
|
2
|
+
import { RunCommand } from "./run.command.js";
|
|
2
3
|
import { ServeCommand } from "./serve.command.js";
|
|
3
4
|
export class FluxCommand extends DecohereCommand {
|
|
4
5
|
constructor(commands, handler){
|
|
@@ -6,6 +7,7 @@ export class FluxCommand extends DecohereCommand {
|
|
|
6
7
|
this.exitOverride();
|
|
7
8
|
this.registerSubcommand({
|
|
8
9
|
serve: ServeCommand,
|
|
10
|
+
run: RunCommand,
|
|
9
11
|
...commands
|
|
10
12
|
}, handler);
|
|
11
13
|
}
|
|
@@ -13,5 +15,3 @@ export class FluxCommand extends DecohereCommand {
|
|
|
13
15
|
return this.help();
|
|
14
16
|
}
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2RlY29oZXJlL2RlY29oZXJlL3Byb2plY3RzL2ZsdXgvc3JjL2ZsdXguY29tbWFuZC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IEFjdGlvbnMgfSBmcm9tIFwiQGRlY29oZXJlL25leHVzL2NsaVwiO1xuaW1wb3J0IHtcblx0dHlwZSBDb21tYW5kSGFuZGxlcixcblx0dHlwZSBDb21tYW5kUmVzcG9uc2UsXG5cdHR5cGUgQ29tbWFuZFR5cGUsXG5cdERlY29oZXJlQ29tbWFuZCx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ixJQUFJLENBQUNHLFlBQVk7UUFDakIsSUFBSSxDQUFDQyxrQkFBa0IsQ0FBQztZQUFFQyxPQUFPTjtZQUFjLEdBQUdFLFFBQVE7UUFBQyxHQUFHQztJQUMvRDtJQUVPSSxJQUFJQyxRQUFpQixFQUFFQyxRQUFlLEVBQTRCO1FBQ3hFLE9BQU8sSUFBSSxDQUFDQyxJQUFJO0lBQ2pCO0FBQ0QifQ==
|
package/es6/src/flux.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { HotReloadServer } from "./hot-reload-server.js";
|
|
3
|
+
import { SourceModuleLoader } from "./source-module-loader.js";
|
|
4
|
+
/** Process-level one-shot loader so a second `run()` reconfigures instead of stacking hooks. */ const runLoader = new SourceModuleLoader();
|
|
5
|
+
async function run(entry, options = {}) {
|
|
6
|
+
const trimmed = entry.trim();
|
|
7
|
+
if (trimmed == null || trimmed === "") {
|
|
8
|
+
throw new Error("flux.run requires an entry file path");
|
|
9
|
+
}
|
|
10
|
+
const absoluteEntry = path.resolve(trimmed);
|
|
11
|
+
await runLoader.configure({
|
|
12
|
+
workspace: options.workspace,
|
|
13
|
+
buildConfig: options.configuration ?? "debug"
|
|
14
|
+
});
|
|
15
|
+
runLoader.registerHooks();
|
|
16
|
+
process.argv = [
|
|
17
|
+
process.execPath,
|
|
18
|
+
absoluteEntry,
|
|
19
|
+
...options.args ?? []
|
|
20
|
+
];
|
|
21
|
+
return runLoader.importEntry(absoluteEntry);
|
|
22
|
+
}
|
|
23
|
+
async function serve(options = {}) {
|
|
24
|
+
const server = new HotReloadServer();
|
|
25
|
+
await server.start({
|
|
26
|
+
buildConfig: options.configuration ?? "debug",
|
|
27
|
+
project: options.project,
|
|
28
|
+
projects: options.projects,
|
|
29
|
+
workspace: options.workspace,
|
|
30
|
+
rebootDebounceMs: options.rebootDebounceMs
|
|
31
|
+
});
|
|
32
|
+
return server;
|
|
33
|
+
}
|
|
34
|
+
function dispose() {
|
|
35
|
+
runLoader.dispose();
|
|
36
|
+
}
|
|
37
|
+
export const flux = {
|
|
38
|
+
run,
|
|
39
|
+
serve,
|
|
40
|
+
dispose
|
|
41
|
+
};
|
package/es6/src/flux.module.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createWorkspace } from "@decohere/forge";
|
|
2
2
|
import { ModuleManifest } from "@decohere/nexus/cli";
|
|
3
|
+
import { DeferredScriptRunner } from "./deferred-script-runner.js";
|
|
3
4
|
import { FluxCommand } from "./flux.command.js";
|
|
4
5
|
import { HotReloadServer } from "./hot-reload-server.js";
|
|
6
|
+
import { RunAction } from "./run.action.js";
|
|
5
7
|
import { ServeAction } from "./serve.action.js";
|
|
6
8
|
export class FluxModule extends ModuleManifest {
|
|
7
9
|
id = "flux";
|
|
8
10
|
command = FluxCommand;
|
|
9
11
|
actions = {
|
|
10
|
-
serve: ServeAction
|
|
12
|
+
serve: ServeAction,
|
|
13
|
+
run: RunAction
|
|
11
14
|
};
|
|
12
15
|
registerServices(builder) {
|
|
13
16
|
builder.registerSingleton(HotReloadServer);
|
|
17
|
+
builder.registerSingleton(DeferredScriptRunner);
|
|
14
18
|
}
|
|
15
19
|
createWorkspace(options) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
20
|
+
// Same workspace as `flux.run` / `flux.serve` and forge (#516).
|
|
21
|
+
return createWorkspace(options);
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2RlY29oZXJlL2RlY29oZXJlL3Byb2plY3RzL2ZsdXgvc3JjL2ZsdXgubW9kdWxlLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IFdvcmtzcGFjZUZhY3RvcnkgfSBmcm9tIFwiQGRlY29oZXJlL21lc2hcIjtcbmltcG9ydCB0eXB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