@epic-web/workshop-utils 6.47.5 → 6.47.7
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/{esm/apps.server.d.ts → apps.server.d.ts} +1 -2
- package/dist/{esm/apps.server.js → apps.server.js} +11 -12
- package/dist/{esm/cache.server.d.ts → cache.server.d.ts} +1 -2
- package/dist/{esm/cache.server.js → cache.server.js} +5 -6
- package/dist/{esm/compile-mdx.server.d.ts → compile-mdx.server.d.ts} +2 -3
- package/dist/{esm/compile-mdx.server.js → compile-mdx.server.js} +3 -4
- package/dist/{esm/config.server.d.ts → config.server.d.ts} +0 -1
- package/dist/{esm/config.server.js → config.server.js} +2 -3
- package/dist/{esm/data-storage.server.d.ts → data-storage.server.d.ts} +0 -1
- package/dist/{esm/data-storage.server.js → data-storage.server.js} +0 -1
- package/dist/{esm/db.server.d.ts → db.server.d.ts} +1 -2
- package/dist/{esm/db.server.js → db.server.js} +3 -4
- package/dist/{esm/diff.server.d.ts → diff.server.d.ts} +2 -3
- package/dist/{esm/diff.server.js → diff.server.js} +5 -6
- package/dist/{esm/env.server.d.ts → env.server.d.ts} +0 -1
- package/dist/{esm/env.server.js → env.server.js} +1 -2
- package/dist/{esm/epic-api.server.d.ts → epic-api.server.d.ts} +1 -2
- package/dist/{esm/epic-api.server.js → epic-api.server.js} +7 -8
- package/dist/{esm/git.server.d.ts → git.server.d.ts} +1 -2
- package/dist/{esm/git.server.js → git.server.js} +8 -9
- package/dist/{esm/iframe-sync.d.ts → iframe-sync.d.ts} +0 -1
- package/dist/{esm/iframe-sync.js → iframe-sync.js} +0 -1
- package/dist/init-env.d.ts +2 -0
- package/dist/init-env.js +5 -0
- package/dist/{esm/launch-editor.server.d.ts → launch-editor.server.d.ts} +0 -1
- package/dist/{esm/launch-editor.server.js → launch-editor.server.js} +1 -2
- package/dist/{esm/logger.d.ts → logger.d.ts} +0 -1
- package/dist/{esm/logger.js → logger.js} +0 -1
- package/dist/{esm/modified-time.server.d.ts → modified-time.server.d.ts} +1 -2
- package/dist/{esm/modified-time.server.js → modified-time.server.js} +2 -3
- package/dist/{esm/notifications.server.d.ts → notifications.server.d.ts} +0 -1
- package/dist/{esm/notifications.server.js → notifications.server.js} +4 -5
- package/dist/{esm/playwright.server.d.ts → playwright.server.d.ts} +1 -2
- package/dist/{esm/playwright.server.js → playwright.server.js} +2 -3
- package/dist/{esm/process-manager.server.d.ts → process-manager.server.d.ts} +2 -3
- package/dist/{esm/process-manager.server.js → process-manager.server.js} +4 -5
- package/dist/{esm/request-context.server.d.ts → request-context.server.d.ts} +1 -2
- package/dist/{esm/request-context.server.js → request-context.server.js} +1 -2
- package/dist/{esm/test.d.ts → test.d.ts} +0 -1
- package/dist/{esm/test.js → test.js} +0 -1
- package/dist/{esm/timing.server.d.ts → timing.server.d.ts} +1 -2
- package/dist/{esm/timing.server.js → timing.server.js} +1 -2
- package/dist/{esm/user.server.d.ts → user.server.d.ts} +0 -1
- package/dist/{esm/user.server.js → user.server.js} +2 -3
- package/dist/{esm/utils.d.ts → utils.d.ts} +1 -2
- package/dist/{esm/utils.js → utils.js} +1 -2
- package/dist/utils.server.d.ts +7 -0
- package/dist/{esm/utils.server.js → utils.server.js} +4 -15
- package/dist/{esm/workshops.server.d.ts → workshops.server.d.ts} +0 -1
- package/dist/{esm/workshops.server.js → workshops.server.js} +1 -2
- package/package.json +56 -109
- package/dist/esm/apps.server.d.ts.map +0 -1
- package/dist/esm/apps.server.js.map +0 -1
- package/dist/esm/cache.server.d.ts.map +0 -1
- package/dist/esm/cache.server.js.map +0 -1
- package/dist/esm/compile-mdx.server.d.ts.map +0 -1
- package/dist/esm/compile-mdx.server.js.map +0 -1
- package/dist/esm/config.server.d.ts.map +0 -1
- package/dist/esm/config.server.js.map +0 -1
- package/dist/esm/config.test.d.ts +0 -2
- package/dist/esm/config.test.d.ts.map +0 -1
- package/dist/esm/config.test.js +0 -77
- package/dist/esm/config.test.js.map +0 -1
- package/dist/esm/data-storage.server.d.ts.map +0 -1
- package/dist/esm/data-storage.server.js.map +0 -1
- package/dist/esm/data-storage.test.d.ts +0 -2
- package/dist/esm/data-storage.test.d.ts.map +0 -1
- package/dist/esm/data-storage.test.js +0 -339
- package/dist/esm/data-storage.test.js.map +0 -1
- package/dist/esm/db.server.d.ts.map +0 -1
- package/dist/esm/db.server.js.map +0 -1
- package/dist/esm/diff.server.d.ts.map +0 -1
- package/dist/esm/diff.server.js.map +0 -1
- package/dist/esm/env.server.d.ts.map +0 -1
- package/dist/esm/env.server.js.map +0 -1
- package/dist/esm/epic-api.server.d.ts.map +0 -1
- package/dist/esm/epic-api.server.js.map +0 -1
- package/dist/esm/git.server.d.ts.map +0 -1
- package/dist/esm/git.server.js.map +0 -1
- package/dist/esm/iframe-sync.d.ts.map +0 -1
- package/dist/esm/iframe-sync.js.map +0 -1
- package/dist/esm/init-env.d.ts +0 -3
- package/dist/esm/init-env.d.ts.map +0 -1
- package/dist/esm/init-env.js +0 -6
- package/dist/esm/init-env.js.map +0 -1
- package/dist/esm/launch-editor.server.d.ts.map +0 -1
- package/dist/esm/launch-editor.server.js.map +0 -1
- package/dist/esm/logger.d.ts.map +0 -1
- package/dist/esm/logger.js.map +0 -1
- package/dist/esm/modified-time.server.d.ts.map +0 -1
- package/dist/esm/modified-time.server.js.map +0 -1
- package/dist/esm/notifications.server.d.ts.map +0 -1
- package/dist/esm/notifications.server.js.map +0 -1
- package/dist/esm/package.json +0 -3
- package/dist/esm/playwright.server.d.ts.map +0 -1
- package/dist/esm/playwright.server.js.map +0 -1
- package/dist/esm/process-manager.server.d.ts.map +0 -1
- package/dist/esm/process-manager.server.js.map +0 -1
- package/dist/esm/request-context.server.d.ts.map +0 -1
- package/dist/esm/request-context.server.js.map +0 -1
- package/dist/esm/test.d.ts.map +0 -1
- package/dist/esm/test.js.map +0 -1
- package/dist/esm/timing.server.d.ts.map +0 -1
- package/dist/esm/timing.server.js.map +0 -1
- package/dist/esm/user.server.d.ts.map +0 -1
- package/dist/esm/user.server.js.map +0 -1
- package/dist/esm/utils.d.ts.map +0 -1
- package/dist/esm/utils.js.map +0 -1
- package/dist/esm/utils.server.d.ts +0 -9
- package/dist/esm/utils.server.d.ts.map +0 -1
- package/dist/esm/utils.server.js.map +0 -1
- package/dist/esm/utils.test.d.ts +0 -2
- package/dist/esm/utils.test.d.ts.map +0 -1
- package/dist/esm/utils.test.js +0 -139
- package/dist/esm/utils.test.js.map +0 -1
- package/dist/esm/workshops.server.d.ts.map +0 -1
- package/dist/esm/workshops.server.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type CacheEntry } from '@epic-web/cachified';
|
|
2
2
|
import '@total-typescript/ts-reset';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { type Timings } from
|
|
4
|
+
import { type Timings } from "./timing.server.js";
|
|
5
5
|
declare global {
|
|
6
6
|
var __epicshop_apps_initialized__: boolean | undefined;
|
|
7
7
|
}
|
|
@@ -4493,4 +4493,3 @@ export declare function getRelativePath(filePath: string): string;
|
|
|
4493
4493
|
*/
|
|
4494
4494
|
export declare function getAppPathFromFilePath(filePath: string): string | null;
|
|
4495
4495
|
export {};
|
|
4496
|
-
//# sourceMappingURL=apps.server.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// eslint-disable-next-line import/order -- this must be first
|
|
2
|
-
import { getEnv } from
|
|
2
|
+
import { getEnv } from "./init-env.js";
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { invariant } from '@epic-web/invariant';
|
|
@@ -12,16 +12,16 @@ import { execa } from 'execa';
|
|
|
12
12
|
import fsExtra from 'fs-extra';
|
|
13
13
|
import { globby, isGitIgnored } from 'globby';
|
|
14
14
|
import { z } from 'zod';
|
|
15
|
-
import { cachified, exampleAppCache, playgroundAppCache, problemAppCache, solutionAppCache, directoryEmptyCache, } from
|
|
16
|
-
import { compileMdx } from
|
|
17
|
-
import { getAppConfig, getStackBlitzUrl } from
|
|
18
|
-
import { getPreferences } from
|
|
19
|
-
import { getDirModifiedTime } from
|
|
20
|
-
import { closeProcess, isAppRunning, runAppDev, waitOnApp, } from
|
|
21
|
-
import { requestStorageify } from
|
|
22
|
-
import { getServerTimeHeader, time } from
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
15
|
+
import { cachified, exampleAppCache, playgroundAppCache, problemAppCache, solutionAppCache, directoryEmptyCache, } from "./cache.server.js";
|
|
16
|
+
import { compileMdx } from "./compile-mdx.server.js";
|
|
17
|
+
import { getAppConfig, getStackBlitzUrl } from "./config.server.js";
|
|
18
|
+
import { getPreferences } from "./db.server.js";
|
|
19
|
+
import { getDirModifiedTime } from "./modified-time.server.js";
|
|
20
|
+
import { closeProcess, isAppRunning, runAppDev, waitOnApp, } from "./process-manager.server.js";
|
|
21
|
+
import { requestStorageify } from "./request-context.server.js";
|
|
22
|
+
import { getServerTimeHeader, time } from "./timing.server.js";
|
|
23
|
+
import { dayjs } from "./utils.server.js";
|
|
24
|
+
import { getErrorMessage } from "./utils.js";
|
|
25
25
|
global.__epicshop_apps_initialized__ ??= false;
|
|
26
26
|
export function setWorkshopRoot(root = process.env.EPICSHOP_CONTEXT_CWD ?? process.cwd()) {
|
|
27
27
|
process.env.EPICSHOP_CONTEXT_CWD = root;
|
|
@@ -1238,4 +1238,3 @@ export function getAppPathFromFilePath(filePath) {
|
|
|
1238
1238
|
// If we couldn't determine the app path, return null
|
|
1239
1239
|
return null;
|
|
1240
1240
|
}
|
|
1241
|
-
//# sourceMappingURL=apps.server.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as C from '@epic-web/cachified';
|
|
2
2
|
import { type CreateReporter } from '@epic-web/cachified';
|
|
3
3
|
import z from 'zod';
|
|
4
|
-
import { type Timings } from
|
|
4
|
+
import { type Timings } from "./timing.server.js";
|
|
5
5
|
/**
|
|
6
6
|
* Creates a cachified reporter that integrates with the Epic Workshop logger system.
|
|
7
7
|
* Uses the pattern `epic:cache:{name-of-cache}` for logger namespaces.
|
|
@@ -454,4 +454,3 @@ export declare function shouldForceFresh({ forceFresh, request, key, }: {
|
|
|
454
454
|
request?: Request;
|
|
455
455
|
key?: string;
|
|
456
456
|
}): Promise<boolean>;
|
|
457
|
-
//# sourceMappingURL=cache.server.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// eslint-disable-next-line import/order -- this must be first
|
|
2
|
-
import { getEnv } from
|
|
2
|
+
import { getEnv } from "./init-env.js";
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import * as C from '@epic-web/cachified';
|
|
5
5
|
import { remember } from '@epic-web/remember';
|
|
@@ -7,10 +7,10 @@ import fsExtra from 'fs-extra';
|
|
|
7
7
|
import { LRUCache } from 'lru-cache';
|
|
8
8
|
import md5 from 'md5-hex';
|
|
9
9
|
import z from 'zod';
|
|
10
|
-
import { resolveCacheDir } from
|
|
11
|
-
import { logger } from
|
|
12
|
-
import { cachifiedTimingReporter } from
|
|
13
|
-
import { checkConnection } from
|
|
10
|
+
import { resolveCacheDir } from "./data-storage.server.js";
|
|
11
|
+
import { logger } from "./logger.js";
|
|
12
|
+
import { cachifiedTimingReporter } from "./timing.server.js";
|
|
13
|
+
import { checkConnection } from "./utils.server.js";
|
|
14
14
|
const MAX_CACHE_FILE_SIZE = 3 * 1024 * 1024; // 3MB in bytes
|
|
15
15
|
const cacheDir = resolveCacheDir();
|
|
16
16
|
const log = logger('epic:cache');
|
|
@@ -618,4 +618,3 @@ export async function shouldForceFresh({ forceFresh, request, key, }) {
|
|
|
618
618
|
return false;
|
|
619
619
|
return fresh.split(',').includes(key);
|
|
620
620
|
}
|
|
621
|
-
//# sourceMappingURL=cache.server.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type Timings } from
|
|
1
|
+
import "./init-env.js";
|
|
2
|
+
import { type Timings } from "./timing.server.js";
|
|
3
3
|
export declare function compileMdx(file: string, { request, timings, forceFresh, }?: {
|
|
4
4
|
request?: Request;
|
|
5
5
|
timings?: Timings;
|
|
@@ -10,4 +10,3 @@ export declare function compileMdx(file: string, { request, timings, forceFresh,
|
|
|
10
10
|
epicVideoEmbeds: Array<string>;
|
|
11
11
|
}>;
|
|
12
12
|
export declare function compileMarkdownString(markdownString: string): Promise<string>;
|
|
13
|
-
//# sourceMappingURL=compile-mdx.server.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./init-env.js";
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { rehypeCodeBlocksShiki } from '@kentcdodds/md-temp';
|
|
@@ -10,8 +10,8 @@ import rehypeAutolinkHeadings from 'rehype-autolink-headings';
|
|
|
10
10
|
import emoji from 'remark-emoji';
|
|
11
11
|
import gfm from 'remark-gfm';
|
|
12
12
|
import { visit } from 'unist-util-visit';
|
|
13
|
-
import { cachified, compiledInstructionMarkdownCache, compiledMarkdownCache, shouldForceFresh, } from
|
|
14
|
-
import { checkConnection } from
|
|
13
|
+
import { cachified, compiledInstructionMarkdownCache, compiledMarkdownCache, shouldForceFresh, } from "./cache.server.js";
|
|
14
|
+
import { checkConnection } from "./utils.server.js";
|
|
15
15
|
function remarkMermaidCodeToSvg() {
|
|
16
16
|
return async (tree) => {
|
|
17
17
|
const promises = [];
|
|
@@ -305,4 +305,3 @@ async function queuedBundleMDX(...args) {
|
|
|
305
305
|
const result = await queue.add(() => bundleMDX(...args));
|
|
306
306
|
return result;
|
|
307
307
|
}
|
|
308
|
-
//# sourceMappingURL=compile-mdx.server.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// eslint-disable-next-line import/order -- this must be first
|
|
2
|
-
import { getEnv } from
|
|
2
|
+
import { getEnv } from "./init-env.js";
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import { handleGitHubRepoAndRoot } from
|
|
6
|
+
import { handleGitHubRepoAndRoot } from "./utils.js";
|
|
7
7
|
const getRootPkgJsonPath = () => path.join(getEnv().EPICSHOP_CONTEXT_CWD, 'package.json');
|
|
8
8
|
export const StackBlitzConfigSchema = z.object({
|
|
9
9
|
// we default this to `${exerciseTitle} (${type})`
|
|
@@ -320,4 +320,3 @@ export async function getAppConfig(fullPath) {
|
|
|
320
320
|
throw error;
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
|
-
//# sourceMappingURL=config.server.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./init-env.js";
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
declare const TokenSetSchema: z.ZodObject<{
|
|
4
4
|
access_token: z.ZodString;
|
|
@@ -519,4 +519,3 @@ export declare function muteNotification(id: string): Promise<string[]>;
|
|
|
519
519
|
export declare function setFontSizePreference(fontSize: number | undefined): Promise<number | undefined>;
|
|
520
520
|
export declare function getFontSizePreference(): Promise<number | null>;
|
|
521
521
|
export {};
|
|
522
|
-
//# sourceMappingURL=db.server.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./init-env.js";
|
|
2
2
|
import { randomUUID as cuid } from 'crypto';
|
|
3
3
|
import fsExtra from 'fs-extra';
|
|
4
4
|
import { redirect } from 'react-router';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import { getWorkshopConfig } from
|
|
7
|
-
import { saveJSON, loadJSON, migrateLegacyData } from
|
|
6
|
+
import { getWorkshopConfig } from "./config.server.js";
|
|
7
|
+
import { saveJSON, loadJSON, migrateLegacyData } from "./data-storage.server.js";
|
|
8
8
|
// Attempt migration from legacy ~/.epicshop
|
|
9
9
|
await migrateLegacyData().catch(() => { });
|
|
10
10
|
const TokenSetSchema = z.object({
|
|
@@ -281,4 +281,3 @@ export async function getFontSizePreference() {
|
|
|
281
281
|
const data = await readDb();
|
|
282
282
|
return data?.preferences?.fontSize ?? null;
|
|
283
283
|
}
|
|
284
|
-
//# sourceMappingURL=db.server.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type App } from
|
|
2
|
-
import { type Timings } from
|
|
1
|
+
import { type App } from "./apps.server.js";
|
|
2
|
+
import { type Timings } from "./timing.server.js";
|
|
3
3
|
export declare function getDiffFiles(app1: App, app2: App, { forceFresh, timings, request, }?: {
|
|
4
4
|
forceFresh?: boolean;
|
|
5
5
|
timings?: Timings;
|
|
@@ -15,4 +15,3 @@ export declare function getDiffCode(app1: App, app2: App, { forceFresh, timings,
|
|
|
15
15
|
request?: Request;
|
|
16
16
|
}): Promise<string>;
|
|
17
17
|
export declare function getDiffOutputWithRelativePaths(app1: App, app2: App): Promise<string>;
|
|
18
|
-
//# sourceMappingURL=diff.server.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// eslint-disable-next-line import/order -- this must be first
|
|
2
|
-
import { getEnv } from
|
|
2
|
+
import { getEnv } from "./init-env.js";
|
|
3
3
|
import os from 'os';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import { execa } from 'execa';
|
|
@@ -7,10 +7,10 @@ import fsExtra from 'fs-extra';
|
|
|
7
7
|
import ignore from 'ignore';
|
|
8
8
|
import parseGitDiff from 'parse-git-diff';
|
|
9
9
|
import { bundledLanguagesInfo } from 'shiki/langs';
|
|
10
|
-
import { getForceFreshForDir, getRelativePath, getWorkshopRoot, modifiedTimes, } from
|
|
11
|
-
import { cachified, copyUnignoredFilesCache, diffCodeCache, diffFilesCache, } from
|
|
12
|
-
import { compileMarkdownString } from
|
|
13
|
-
import { modifiedMoreRecentlyThan } from
|
|
10
|
+
import { getForceFreshForDir, getRelativePath, getWorkshopRoot, modifiedTimes, } from "./apps.server.js";
|
|
11
|
+
import { cachified, copyUnignoredFilesCache, diffCodeCache, diffFilesCache, } from "./cache.server.js";
|
|
12
|
+
import { compileMarkdownString } from "./compile-mdx.server.js";
|
|
13
|
+
import { modifiedMoreRecentlyThan } from "./modified-time.server.js";
|
|
14
14
|
const epicshopTempDir = path.join(os.tmpdir(), 'epicshop');
|
|
15
15
|
const isDeployed = getEnv().EPICSHOP_DEPLOYED;
|
|
16
16
|
const diffTmpDir = path.join(epicshopTempDir, 'diff');
|
|
@@ -441,4 +441,3 @@ export async function getDiffOutputWithRelativePaths(app1, app2) {
|
|
|
441
441
|
.replaceAll(app1CopyPath.slice(1), '.')
|
|
442
442
|
.replaceAll(app2CopyPath.slice(1), '.');
|
|
443
443
|
}
|
|
444
|
-
//# sourceMappingURL=diff.server.js.map
|
|
@@ -4,7 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
import md5 from 'md5-hex';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
import { handleGitHubRepoAndRoot } from
|
|
7
|
+
import { handleGitHubRepoAndRoot } from "./utils.js";
|
|
8
8
|
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
9
9
|
const schema = z
|
|
10
10
|
.object({
|
|
@@ -128,4 +128,3 @@ export function getEnv() {
|
|
|
128
128
|
SENTRY_PROJECT_ID: process.env.SENTRY_PROJECT_ID,
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
|
-
//# sourceMappingURL=env.server.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { type Timings } from
|
|
2
|
+
import { type Timings } from "./timing.server.js";
|
|
3
3
|
export type EpicVideoInfos = Record<string, Awaited<ReturnType<typeof getEpicVideoInfo>>>;
|
|
4
4
|
export declare function getEpicVideoInfos(epicWebUrls?: Array<string> | null, { request, timings }?: {
|
|
5
5
|
request?: Request;
|
|
@@ -234,4 +234,3 @@ export declare function getUserInfo({ timings, request, forceFresh, }?: {
|
|
|
234
234
|
} | null>;
|
|
235
235
|
export declare function warmCache(): Promise<void>;
|
|
236
236
|
export {};
|
|
237
|
-
//# sourceMappingURL=epic-api.server.d.ts.map
|
|
@@ -2,13 +2,13 @@ import { invariant } from '@epic-web/invariant';
|
|
|
2
2
|
import * as cookie from 'cookie';
|
|
3
3
|
import md5 from 'md5-hex';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import { getExerciseApp, getExercises, getWorkshopFinished, getWorkshopInstructions, } from
|
|
6
|
-
import { cachified, epicApiCache } from
|
|
7
|
-
import { getWorkshopConfig } from
|
|
8
|
-
import { getAuthInfo, setAuthInfo } from
|
|
9
|
-
import { getEnv } from
|
|
10
|
-
import { logger } from
|
|
11
|
-
import { getErrorMessage } from
|
|
5
|
+
import { getExerciseApp, getExercises, getWorkshopFinished, getWorkshopInstructions, } from "./apps.server.js";
|
|
6
|
+
import { cachified, epicApiCache } from "./cache.server.js";
|
|
7
|
+
import { getWorkshopConfig } from "./config.server.js";
|
|
8
|
+
import { getAuthInfo, setAuthInfo } from "./db.server.js";
|
|
9
|
+
import { getEnv } from "./init-env.js";
|
|
10
|
+
import { logger } from "./logger.js";
|
|
11
|
+
import { getErrorMessage } from "./utils.js";
|
|
12
12
|
// Module-level logger for epic-api operations
|
|
13
13
|
const log = logger('epic:api');
|
|
14
14
|
const Transcript = z
|
|
@@ -652,4 +652,3 @@ export async function getUserInfo({ timings, request, forceFresh, } = {}) {
|
|
|
652
652
|
export async function warmCache() {
|
|
653
653
|
await Promise.all([getUserInfo(), getProgress()]);
|
|
654
654
|
}
|
|
655
|
-
//# sourceMappingURL=epic-api.server.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./init-env.js";
|
|
2
2
|
export declare function checkForUpdates(): Promise<{
|
|
3
3
|
readonly updatesAvailable: false;
|
|
4
4
|
readonly message: "The app is deployed";
|
|
@@ -92,4 +92,3 @@ export declare function getCommitInfo(): Promise<{
|
|
|
92
92
|
} | null>;
|
|
93
93
|
export declare function getLatestWorkshopAppVersion(): Promise<string | null>;
|
|
94
94
|
export declare function checkForExerciseChanges(): Promise<boolean>;
|
|
95
|
-
//# sourceMappingURL=git.server.d.ts.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./init-env.js";
|
|
2
2
|
import fs from 'node:fs/promises';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { execa, execaCommand } from 'execa';
|
|
5
|
-
import { getWorkshopRoot } from
|
|
6
|
-
import { cachified, checkForUpdatesCache } from
|
|
7
|
-
import { getWorkshopConfig } from
|
|
8
|
-
import { getEnv } from
|
|
9
|
-
import { logger } from
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
5
|
+
import { getWorkshopRoot } from "./apps.server.js";
|
|
6
|
+
import { cachified, checkForUpdatesCache } from "./cache.server.js";
|
|
7
|
+
import { getWorkshopConfig } from "./config.server.js";
|
|
8
|
+
import { getEnv } from "./env.server.js";
|
|
9
|
+
import { logger } from "./logger.js";
|
|
10
|
+
import { checkConnection } from "./utils.server.js";
|
|
11
|
+
import { getErrorMessage } from "./utils.js";
|
|
12
12
|
const gitLog = logger('epic:git');
|
|
13
13
|
function dirHasTrackedFiles(cwd, dirPath) {
|
|
14
14
|
return execa('git', ['ls-files', dirPath], { cwd }).then((s) => s.stdout.trim().length > 0, () => true);
|
|
@@ -212,4 +212,3 @@ export async function checkForExerciseChanges() {
|
|
|
212
212
|
return false;
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
//# sourceMappingURL=git.server.js.map
|
package/dist/init-env.js
ADDED
|
@@ -6,7 +6,7 @@ import os from 'os';
|
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import fsExtra from 'fs-extra';
|
|
8
8
|
import shellQuote from 'shell-quote';
|
|
9
|
-
import { getRelativePath } from
|
|
9
|
+
import { getRelativePath } from "./apps.server.js";
|
|
10
10
|
function readablePath(filePath = '') {
|
|
11
11
|
const relative = getRelativePath(filePath);
|
|
12
12
|
const name = path.basename(relative);
|
|
@@ -376,4 +376,3 @@ export async function launchEditor(pathList, lineNumber = 1, colNumber = 1) {
|
|
|
376
376
|
});
|
|
377
377
|
});
|
|
378
378
|
}
|
|
379
|
-
//# sourceMappingURL=launch-editor.server.js.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./init-env.js";
|
|
2
2
|
declare function getDirModifiedTime(dir: string, { forceFresh }?: {
|
|
3
3
|
forceFresh?: boolean;
|
|
4
4
|
}): Promise<number>;
|
|
5
5
|
export declare function modifiedMoreRecentlyThan(time: number, ...dirs: Array<string>): Promise<boolean>;
|
|
6
6
|
declare function queuedGetDirModifiedTime(...args: Parameters<typeof getDirModifiedTime>): Promise<number>;
|
|
7
7
|
export { queuedGetDirModifiedTime as getDirModifiedTime };
|
|
8
|
-
//# sourceMappingURL=modified-time.server.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./init-env.js";
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { isGitIgnored } from 'globby';
|
|
5
5
|
import PQueue from 'p-queue';
|
|
6
|
-
import { cachified, dirModifiedTimeCache } from
|
|
6
|
+
import { cachified, dirModifiedTimeCache } from "./cache.server.js";
|
|
7
7
|
async function getDirModifiedTime(dir, { forceFresh = false } = {}) {
|
|
8
8
|
const result = await cachified({
|
|
9
9
|
key: dir,
|
|
@@ -77,4 +77,3 @@ async function queuedGetDirModifiedTime(...args) {
|
|
|
77
77
|
return result || -1;
|
|
78
78
|
}
|
|
79
79
|
export { queuedGetDirModifiedTime as getDirModifiedTime };
|
|
80
|
-
//# sourceMappingURL=modified-time.server.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// eslint-disable-next-line import/order -- this must be first
|
|
2
|
-
import { getEnv } from
|
|
2
|
+
import { getEnv } from "./init-env.js";
|
|
3
3
|
import json5 from 'json5';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import { cachified, notificationsCache } from
|
|
6
|
-
import { getWorkshopConfig } from
|
|
7
|
-
import { getMutedNotifications } from
|
|
5
|
+
import { cachified, notificationsCache } from "./cache.server.js";
|
|
6
|
+
import { getWorkshopConfig } from "./config.server.js";
|
|
7
|
+
import { getMutedNotifications } from "./db.server.js";
|
|
8
8
|
const NotificationSchema = z.object({
|
|
9
9
|
id: z.string(),
|
|
10
10
|
title: z.string(),
|
|
@@ -64,4 +64,3 @@ export async function getUnmutedNotifications() {
|
|
|
64
64
|
const visibleNotifications = notificationsToShow.filter((n) => !muted.includes(n.id));
|
|
65
65
|
return visibleNotifications;
|
|
66
66
|
}
|
|
67
|
-
//# sourceMappingURL=notifications.server.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./init-env.js";
|
|
2
2
|
import { expect, test } from '@playwright/test';
|
|
3
3
|
import crossSpawn from 'cross-spawn';
|
|
4
4
|
import z from 'zod';
|
|
5
|
-
import { getApps, isSolutionApp } from
|
|
5
|
+
import { getApps, isSolutionApp } from "./apps.server.js";
|
|
6
6
|
export async function getInBrowserTestPages() {
|
|
7
7
|
const apps = (await getApps())
|
|
8
8
|
.filter(isSolutionApp)
|
|
@@ -93,4 +93,3 @@ export function setupInBrowserTests() {
|
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
-
//# sourceMappingURL=playwright.server.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./init-env.js";
|
|
2
2
|
import { type ChildProcess } from 'child_process';
|
|
3
3
|
import closeWithGrace from 'close-with-grace';
|
|
4
|
-
import { type App } from
|
|
4
|
+
import { type App } from "./apps.server.js";
|
|
5
5
|
type DevProcessesMap = Map<string, {
|
|
6
6
|
color: (typeof colors)[number];
|
|
7
7
|
process: ChildProcess;
|
|
@@ -83,4 +83,3 @@ export declare function closeProcess(key: string): Promise<void>;
|
|
|
83
83
|
export declare function stopPort(port: string | number): Promise<void>;
|
|
84
84
|
export declare function waitForPortToBeAvailable(port: string | number): Promise<void>;
|
|
85
85
|
export {};
|
|
86
|
-
//# sourceMappingURL=process-manager.server.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./init-env.js";
|
|
2
2
|
import { spawn } from 'child_process';
|
|
3
3
|
import net from 'node:net';
|
|
4
4
|
import { remember } from '@epic-web/remember';
|
|
@@ -6,9 +6,9 @@ import chalk from 'chalk';
|
|
|
6
6
|
import closeWithGrace from 'close-with-grace';
|
|
7
7
|
import findProcessDefault from 'find-process';
|
|
8
8
|
import fkill from 'fkill';
|
|
9
|
-
import { getWorkshopUrl } from
|
|
10
|
-
import { getEnv } from
|
|
11
|
-
import { getErrorMessage } from
|
|
9
|
+
import { getWorkshopUrl } from "./config.server.js";
|
|
10
|
+
import { getEnv } from "./env.server.js";
|
|
11
|
+
import { getErrorMessage } from "./utils.js";
|
|
12
12
|
// https://github.com/yibn2008/find-process/issues/85
|
|
13
13
|
const findProcess = ('default' in findProcessDefault
|
|
14
14
|
? findProcessDefault.default
|
|
@@ -383,4 +383,3 @@ export async function waitForPortToBeAvailable(port) {
|
|
|
383
383
|
console.error('Timed out waiting for the port to become available');
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
//# sourceMappingURL=process-manager.server.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./init-env.js";
|
|
2
2
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
3
3
|
export type RequestContextStore = {
|
|
4
4
|
getExercisesPromise?: Promise<any>;
|
|
@@ -7,4 +7,3 @@ export type RequestContextStore = {
|
|
|
7
7
|
};
|
|
8
8
|
export declare const requestContext: AsyncLocalStorage<RequestContextStore>;
|
|
9
9
|
export declare function requestStorageify<T extends (...args: any[]) => Promise<any>>(fn: T, key?: string): T;
|
|
10
|
-
//# sourceMappingURL=request-context.server.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./init-env.js";
|
|
2
2
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
3
3
|
import { remember } from '@epic-web/remember';
|
|
4
4
|
// this is important to make it global so even if somehow we have two versions of the workshop-utils,
|
|
@@ -17,4 +17,3 @@ export function requestStorageify(fn, key) {
|
|
|
17
17
|
return promise;
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
//# sourceMappingURL=request-context.server.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./init-env.js";
|
|
2
2
|
import { type CreateReporter } from '@epic-web/cachified';
|
|
3
3
|
export type Timings = Record<string, Array<{
|
|
4
4
|
desc?: string;
|
|
@@ -18,4 +18,3 @@ export declare function time<ReturnType>(fn: Promise<ReturnType> | (() => Return
|
|
|
18
18
|
export declare function getServerTimeHeader(timings?: Timings): string;
|
|
19
19
|
export declare function combineServerTimings(headers1: Headers, headers2: Headers): string;
|
|
20
20
|
export declare function cachifiedTimingReporter<Value>(timings?: Timings, timingKey?: string): undefined | CreateReporter<Value>;
|
|
21
|
-
//# sourceMappingURL=timing.server.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./init-env.js";
|
|
2
2
|
export function makeTimings(type, desc) {
|
|
3
3
|
const timings = {
|
|
4
4
|
[type]: [{ desc, start: performance.now() }],
|
|
@@ -96,4 +96,3 @@ export function cachifiedTimingReporter(timings, timingKey) {
|
|
|
96
96
|
};
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
//# sourceMappingURL=timing.server.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// eslint-disable-next-line import/order -- this must be first
|
|
2
|
-
import { getEnv } from
|
|
2
|
+
import { getEnv } from "./init-env.js";
|
|
3
3
|
import { randomUUID as cuid } from 'crypto';
|
|
4
4
|
import * as cookie from 'cookie';
|
|
5
|
-
import { getAuthInfo, getClientId } from
|
|
5
|
+
import { getAuthInfo, getClientId } from "./db.server.js";
|
|
6
6
|
export async function getUserId({ request }) {
|
|
7
7
|
if (getEnv().EPICSHOP_DEPLOYED) {
|
|
8
8
|
const cookieHeader = request.headers.get('cookie');
|
|
@@ -37,4 +37,3 @@ export async function getUserId({ request }) {
|
|
|
37
37
|
export function getSetClientIdCookieHeader(clientId) {
|
|
38
38
|
return `clientId=${clientId}; Path=/; HttpOnly; SameSite=Lax`;
|
|
39
39
|
}
|
|
40
|
-
//# sourceMappingURL=user.server.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./init-env.js";
|
|
2
2
|
import dayjsLib from 'dayjs';
|
|
3
3
|
export declare const dayjs: typeof dayjsLib;
|
|
4
4
|
export declare function getErrorMessage(error: unknown, fallbackMessage?: string): string;
|
|
@@ -9,4 +9,3 @@ export declare function handleGitHubRepoAndRoot({ githubRepo, githubRoot, }: {
|
|
|
9
9
|
githubRepo: string;
|
|
10
10
|
githubRoot: string;
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./init-env.js";
|
|
2
2
|
import { remember } from '@epic-web/remember';
|
|
3
3
|
import dayjsLib from 'dayjs';
|
|
4
4
|
import relativeTimePlugin from 'dayjs/plugin/relativeTime.js';
|
|
@@ -36,4 +36,3 @@ export function handleGitHubRepoAndRoot({ githubRepo, githubRoot, }) {
|
|
|
36
36
|
}
|
|
37
37
|
return { githubRepo, githubRoot };
|
|
38
38
|
}
|
|
39
|
-
//# sourceMappingURL=utils.js.map
|