@ms-cloudpack/cli 0.31.7 → 0.33.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.
Files changed (81) hide show
  1. package/lib/commands/bundle/bundle.js +2 -1
  2. package/lib/commands/bundle/bundle.js.map +1 -1
  3. package/lib/commands/bundle/types.d.ts +4 -0
  4. package/lib/commands/bundle/types.js.map +1 -1
  5. package/lib/commands/init/evaluateImportsForOverrides.d.ts +4 -1
  6. package/lib/commands/init/evaluateImportsForOverrides.js +8 -4
  7. package/lib/commands/init/evaluateImportsForOverrides.js.map +1 -1
  8. package/lib/commands/init/evaluateImportsForOverrides.test.js +67 -0
  9. package/lib/commands/init/evaluateImportsForOverrides.test.js.map +1 -0
  10. package/lib/commands/init/index.js +1 -1
  11. package/lib/commands/init/index.js.map +1 -1
  12. package/lib/commands/init/init.js +10 -5
  13. package/lib/commands/init/init.js.map +1 -1
  14. package/lib/commands/init/init.test.js +3 -3
  15. package/lib/commands/init/init.test.js.map +1 -1
  16. package/lib/commands/init/preparePackageOverride.d.ts +0 -1
  17. package/lib/commands/init/preparePackageOverride.js +2 -5
  18. package/lib/commands/init/preparePackageOverride.js.map +1 -1
  19. package/lib/commands/start/appServer/createRoutes.d.ts +3 -1
  20. package/lib/commands/start/appServer/createRoutes.js.map +1 -1
  21. package/lib/commands/start/appServer/handleSessionVersion.d.ts +1 -1
  22. package/lib/commands/start/appServer/handleSessionVersion.js.map +1 -1
  23. package/lib/commands/start/appServer/setHeaders.d.ts +1 -1
  24. package/lib/commands/start/appServer/setHeaders.js.map +1 -1
  25. package/lib/commands/start/appServer/startAppServer.d.ts +3 -1
  26. package/lib/commands/start/appServer/startAppServer.js.map +1 -1
  27. package/lib/commands/start/createBundleTask.d.ts +2 -1
  28. package/lib/commands/start/createBundleTask.js.map +1 -1
  29. package/lib/commands/start/createSession.d.ts +3 -1
  30. package/lib/commands/start/createSession.js +2 -1
  31. package/lib/commands/start/createSession.js.map +1 -1
  32. package/lib/commands/start/createSession.test.js +3 -3
  33. package/lib/commands/start/createSession.test.js.map +1 -1
  34. package/lib/commands/start/start.js +5 -5
  35. package/lib/commands/start/start.js.map +1 -1
  36. package/lib/commands/start/startBundleServer.d.ts +3 -1
  37. package/lib/commands/start/startBundleServer.js +1 -0
  38. package/lib/commands/start/startBundleServer.js.map +1 -1
  39. package/lib/commands/start/types.d.ts +1 -0
  40. package/lib/commands/start/types.js.map +1 -1
  41. package/lib/common/createPackageOverrideTransform.d.ts +1 -1
  42. package/lib/common/createPackageOverrideTransform.js.map +1 -1
  43. package/lib/index.d.ts +3 -1
  44. package/lib/index.js.map +1 -1
  45. package/lib/initTelemetry.js +1 -1
  46. package/lib/initTelemetry.js.map +1 -1
  47. package/lib/tasks/bundleTask.js +2 -1
  48. package/lib/tasks/bundleTask.js.map +1 -1
  49. package/lib/types.d.ts +6 -199
  50. package/lib/types.js.map +1 -1
  51. package/package.json +7 -5
  52. package/lib/commands/start/TaskRunner.d.ts +0 -40
  53. package/lib/commands/start/TaskRunner.js +0 -119
  54. package/lib/commands/start/TaskRunner.js.map +0 -1
  55. package/lib/commands/start/addOverride.d.ts +0 -7
  56. package/lib/commands/start/addOverride.js +0 -63
  57. package/lib/commands/start/addOverride.js.map +0 -1
  58. package/lib/commands/start/addOverride.test.js +0 -254
  59. package/lib/commands/start/addOverride.test.js.map +0 -1
  60. package/lib/commands/start/startApiServer.d.ts +0 -19
  61. package/lib/commands/start/startApiServer.js +0 -303
  62. package/lib/commands/start/startApiServer.js.map +0 -1
  63. package/lib/commands/start/startWatcher.d.ts +0 -7
  64. package/lib/commands/start/startWatcher.js +0 -51
  65. package/lib/commands/start/startWatcher.js.map +0 -1
  66. package/lib/commands/start/taskRunner.test.d.ts +0 -1
  67. package/lib/commands/start/taskRunner.test.js +0 -80
  68. package/lib/commands/start/taskRunner.test.js.map +0 -1
  69. package/lib/commands/start/validateOverride.d.ts +0 -7
  70. package/lib/commands/start/validateOverride.js +0 -28
  71. package/lib/commands/start/validateOverride.js.map +0 -1
  72. package/lib/commands/start/validateOverride.test.d.ts +0 -1
  73. package/lib/commands/start/validateOverride.test.js +0 -137
  74. package/lib/commands/start/validateOverride.test.js.map +0 -1
  75. package/lib/common/config.d.ts +0 -31
  76. package/lib/common/config.js +0 -54
  77. package/lib/common/config.js.map +0 -1
  78. package/lib/common/configTemplate.d.ts +0 -13
  79. package/lib/common/configTemplate.js +0 -16
  80. package/lib/common/configTemplate.js.map +0 -1
  81. /package/lib/commands/{start/addOverride.test.d.ts → init/evaluateImportsForOverrides.test.d.ts} +0 -0
@@ -1,7 +0,0 @@
1
- import type { ApiServer, Task } from '../../types.js';
2
- export declare function startWatcher(addTask: ApiServer['addTask']): {
3
- watch: <TReturn>(task: Task<TReturn>, options?: {
4
- onSuccess?: () => void;
5
- onDispose?: () => void;
6
- }) => void;
7
- };
@@ -1,51 +0,0 @@
1
- import chokidar from 'chokidar';
2
- export function startWatcher(addTask) {
3
- const watched = new Set();
4
- return {
5
- watch: (task, options) => {
6
- const { id, name, dir } = task;
7
- // Have a single watcher per bundle request.
8
- if (watched.has(id) || !dir) {
9
- return;
10
- }
11
- watched.add(id);
12
- console.debug(`Initializing file watcher for ${name}`);
13
- // TODO: This is a bit of a hack. We should be able to use the watch API, but it doesn't seem to work.
14
- const watcher = chokidar.watch(dir).on('change', (event) => {
15
- console.debug(`Detected change "${event}", rebuilding "${name}"`);
16
- (async () => {
17
- // Start tracking work.
18
- let rebuilt = false;
19
- try {
20
- await addTask(task, { rerun: true });
21
- rebuilt = true;
22
- }
23
- catch (err) {
24
- console.error(`Error rebuilding "${name}":`, err?.stack || err);
25
- }
26
- const errors = task.getErrors?.();
27
- if (rebuilt && !errors?.length) {
28
- console.debug(`Notifying rebuild: ${name}`);
29
- options?.onSuccess?.();
30
- }
31
- else if (errors) {
32
- console.debug(`${name} ${errors.length} errors`);
33
- }
34
- })().catch(() => {
35
- // no-op
36
- });
37
- });
38
- task.dispose = async () => {
39
- try {
40
- await watcher.close();
41
- }
42
- catch {
43
- // ignore
44
- }
45
- task.onDispose?.();
46
- watched.delete(id);
47
- };
48
- },
49
- };
50
- }
51
- //# sourceMappingURL=startWatcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"startWatcher.js","sourceRoot":"","sources":["../../../src/commands/start/startWatcher.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAGhC,MAAM,UAAU,YAAY,CAAC,OAA6B;IACxD,MAAM,OAAO,GAAgB,IAAI,GAAG,EAAE,CAAC;IAEvC,OAAO;QACL,KAAK,EAAE,CAAU,IAAmB,EAAE,OAA4D,EAAE,EAAE;YACpG,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;YAC/B,4CAA4C;YAC5C,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;gBAC3B,OAAO;aACR;YAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAEhB,OAAO,CAAC,KAAK,CAAC,iCAAiC,IAAI,EAAE,CAAC,CAAC;YAEvD,sGAAsG;YACtG,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE;gBACjE,OAAO,CAAC,KAAK,CAAC,oBAAoB,KAAK,kBAAkB,IAAI,GAAG,CAAC,CAAC;gBAElE,CAAC,KAAK,IAAI,EAAE;oBACV,uBAAuB;oBACvB,IAAI,OAAO,GAAG,KAAK,CAAC;oBACpB,IAAI;wBACF,MAAM,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;wBACrC,OAAO,GAAG,IAAI,CAAC;qBAChB;oBAAC,OAAO,GAAG,EAAE;wBACZ,OAAO,CAAC,KAAK,CAAC,qBAAqB,IAAI,IAAI,EAAG,GAAa,EAAE,KAAK,IAAI,GAAG,CAAC,CAAC;qBAC5E;oBACD,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;oBAClC,IAAI,OAAO,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE;wBAC9B,OAAO,CAAC,KAAK,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC;wBAC5C,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC;qBACxB;yBAAM,IAAI,MAAM,EAAE;wBACjB,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,MAAM,CAAC,MAAM,SAAS,CAAC,CAAC;qBAClD;gBACH,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;oBACd,QAAQ;gBACV,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,OAAO,GAAG,KAAK,IAAI,EAAE;gBACxB,IAAI;oBACF,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;iBACvB;gBAAC,MAAM;oBACN,SAAS;iBACV;gBAED,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;gBAEnB,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACrB,CAAC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import chokidar from 'chokidar';\nimport type { ApiServer, Task } from '../../types.js';\n\nexport function startWatcher(addTask: ApiServer['addTask']) {\n const watched: Set<string> = new Set();\n\n return {\n watch: <TReturn>(task: Task<TReturn>, options?: { onSuccess?: () => void; onDispose?: () => void }) => {\n const { id, name, dir } = task;\n // Have a single watcher per bundle request.\n if (watched.has(id) || !dir) {\n return;\n }\n\n watched.add(id);\n\n console.debug(`Initializing file watcher for ${name}`);\n\n // TODO: This is a bit of a hack. We should be able to use the watch API, but it doesn't seem to work.\n const watcher = chokidar.watch(dir).on('change', (event: string) => {\n console.debug(`Detected change \"${event}\", rebuilding \"${name}\"`);\n\n (async () => {\n // Start tracking work.\n let rebuilt = false;\n try {\n await addTask(task, { rerun: true });\n rebuilt = true;\n } catch (err) {\n console.error(`Error rebuilding \"${name}\":`, (err as Error)?.stack || err);\n }\n const errors = task.getErrors?.();\n if (rebuilt && !errors?.length) {\n console.debug(`Notifying rebuild: ${name}`);\n options?.onSuccess?.();\n } else if (errors) {\n console.debug(`${name} ${errors.length} errors`);\n }\n })().catch(() => {\n // no-op\n });\n });\n\n task.dispose = async () => {\n try {\n await watcher.close();\n } catch {\n // ignore\n }\n\n task.onDispose?.();\n\n watched.delete(id);\n };\n },\n };\n}\n"]}
@@ -1 +0,0 @@
1
- export {};
@@ -1,80 +0,0 @@
1
- import { describe, it, expect, jest } from '@jest/globals';
2
- import { TaskRunner } from './TaskRunner.js';
3
- const tasks = [
4
- {
5
- name: 'Task 1',
6
- id: '1',
7
- execute: () => new Promise((r) => r('first test value')),
8
- },
9
- {
10
- name: 'Task 2',
11
- id: '1',
12
- execute: () => new Promise((r) => r('second test value')),
13
- },
14
- ];
15
- describe('addTask', () => {
16
- it('resolves the promise', async () => {
17
- const taskRunner = new TaskRunner();
18
- expect(await taskRunner.add(tasks[0])).toEqual('first test value');
19
- });
20
- it('returns previous completed task with same id', async () => {
21
- const taskRunner = new TaskRunner();
22
- await taskRunner.add(tasks[0]);
23
- // Task Runner should return task with same id
24
- // since previous task is already completed.
25
- expect(await taskRunner.add(tasks[1])).toEqual('first test value');
26
- });
27
- it('returns previous pending task with same id', async () => {
28
- const taskRunner = new TaskRunner();
29
- const task = taskRunner.add(tasks[0]);
30
- // Even though task[0].excute() and task[1].execute() return different strings,
31
- // since their tasks share id, the task runner will return the promise of the first.
32
- expect(await taskRunner.add(tasks[1])).toEqual('first test value');
33
- expect(await task).toEqual('first test value');
34
- });
35
- it('reruns completed tasks when rerun is set', async () => {
36
- const taskRunner = new TaskRunner();
37
- await taskRunner.add(tasks[0]);
38
- // Returns task[1].execute() string as the Task is flagged for rerun.
39
- expect(await taskRunner.add(tasks[1], { rerun: true })).toEqual('second test value');
40
- });
41
- it('reruns pending tasks when rerun is set', async () => {
42
- const taskRunner = new TaskRunner();
43
- const task1 = taskRunner.add(tasks[0]);
44
- const task2 = await taskRunner.add(tasks[1], { rerun: true });
45
- // Returns task[0].execute() string as the Task reuses the promise.
46
- expect(task2).toEqual('first test value');
47
- expect(await task1).toEqual('first test value');
48
- });
49
- it('reuses pending promise when rerun is set', async () => {
50
- const taskRunner = new TaskRunner();
51
- const firstTask = taskRunner.add(tasks[0]);
52
- const secondTask = taskRunner.add(tasks[1], { rerun: true });
53
- expect(firstTask).toEqual(secondTask);
54
- expect(await firstTask).toEqual(await secondTask);
55
- });
56
- });
57
- describe('resetTask', () => {
58
- it('reruns task', async () => {
59
- const taskRunner = new TaskRunner();
60
- const mockFunc = jest
61
- .fn()
62
- .mockReturnValueOnce(Promise.resolve('result1'))
63
- .mockReturnValueOnce(Promise.resolve('result2'));
64
- const task = {
65
- name: 'Mock Task',
66
- id: 'mock',
67
- execute: mockFunc,
68
- };
69
- await taskRunner.add(task);
70
- await taskRunner.reset('mock');
71
- expect(mockFunc).toHaveBeenCalledTimes(2);
72
- });
73
- it('returns correct result by id', async () => {
74
- const taskRunner = new TaskRunner();
75
- const firstTask = await taskRunner.add(tasks[0]);
76
- const secondTask = await taskRunner.reset(tasks[0].id);
77
- expect(secondTask).toEqual(firstTask);
78
- });
79
- });
80
- //# sourceMappingURL=taskRunner.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"taskRunner.test.js","sourceRoot":"","sources":["../../../src/commands/start/taskRunner.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,MAAM,KAAK,GAAwB;IACjC;QACE,IAAI,EAAE,QAAQ;QACd,EAAE,EAAE,GAAG;QACP,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,OAAO,CAAS,C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C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, it, expect, jest } from '@jest/globals';\nimport { TaskRunner } from './TaskRunner.js';\nimport type { Task } from '../../types.js';\n\nconst tasks: Array<Task<string>> = [\n {\n name: 'Task 1',\n id: '1',\n execute: () => new Promise<string>((r) => r('first test value')),\n },\n {\n name: 'Task 2',\n id: '1',\n execute: () => new Promise<string>((r) => r('second test value')),\n },\n];\n\ndescribe('addTask', () => {\n it('resolves the promise', async () => {\n const taskRunner = new TaskRunner();\n\n expect(await taskRunner.add(tasks[0])).toEqual('first test value');\n });\n\n it('returns previous completed task with same id', async () => {\n const taskRunner = new TaskRunner();\n\n await taskRunner.add(tasks[0]);\n\n // Task Runner should return task with same id\n // since previous task is already completed.\n expect(await taskRunner.add(tasks[1])).toEqual('first test value');\n });\n\n it('returns previous pending task with same id', async () => {\n const taskRunner = new TaskRunner();\n\n const task = taskRunner.add(tasks[0]);\n\n // Even though task[0].excute() and task[1].execute() return different strings,\n // since their tasks share id, the task runner will return the promise of the first.\n expect(await taskRunner.add(tasks[1])).toEqual('first test value');\n expect(await task).toEqual('first test value');\n });\n\n it('reruns completed tasks when rerun is set', async () => {\n const taskRunner = new TaskRunner();\n\n await taskRunner.add(tasks[0]);\n\n // Returns task[1].execute() string as the Task is flagged for rerun.\n expect(await taskRunner.add(tasks[1], { rerun: true })).toEqual('second test value');\n });\n\n it('reruns pending tasks when rerun is set', async () => {\n const taskRunner = new TaskRunner();\n\n const task1 = taskRunner.add(tasks[0]);\n const task2 = await taskRunner.add(tasks[1], { rerun: true });\n\n // Returns task[0].execute() string as the Task reuses the promise.\n expect(task2).toEqual('first test value');\n expect(await task1).toEqual('first test value');\n });\n\n it('reuses pending promise when rerun is set', async () => {\n const taskRunner = new TaskRunner();\n\n const firstTask = taskRunner.add(tasks[0]);\n\n const secondTask = taskRunner.add(tasks[1], { rerun: true });\n\n expect(firstTask).toEqual(secondTask);\n expect(await firstTask).toEqual(await secondTask);\n });\n});\n\ndescribe('resetTask', () => {\n it('reruns task', async () => {\n const taskRunner = new TaskRunner();\n\n const mockFunc = jest\n .fn()\n .mockReturnValueOnce(Promise.resolve('result1'))\n .mockReturnValueOnce(Promise.resolve('result2')) as unknown as () => Promise<string>;\n\n const task = {\n name: 'Mock Task',\n id: 'mock',\n execute: mockFunc,\n };\n\n await taskRunner.add(task);\n await taskRunner.reset('mock');\n\n expect(mockFunc).toHaveBeenCalledTimes(2);\n });\n\n it('returns correct result by id', async () => {\n const taskRunner = new TaskRunner();\n const firstTask = await taskRunner.add(tasks[0]);\n const secondTask = await taskRunner.reset(tasks[0].id);\n expect(secondTask).toEqual(firstTask);\n });\n});\n"]}
@@ -1,7 +0,0 @@
1
- import type { Session } from '../../types.js';
2
- export declare function validateOverride({ session, packageName, importPath, filename, }: {
3
- session: Session;
4
- packageName: string;
5
- importPath: string;
6
- filename?: string;
7
- }): Promise<boolean>;
@@ -1,28 +0,0 @@
1
- import { findResolveMapEntry, findFileInPackage } from '@ms-cloudpack/package-utilities';
2
- import { slash } from '@ms-cloudpack/path-string-parsing';
3
- import { parseRequestInfo } from './parseRequestInfo.js';
4
- export async function validateOverride({ session, packageName, importPath, filename, }) {
5
- let definition = undefined;
6
- if (filename) {
7
- const requestPath = slash(new URL(filename).pathname);
8
- const { packageName: name, version } = parseRequestInfo(requestPath);
9
- definition = { name, version };
10
- }
11
- const entry = findResolveMapEntry({
12
- packageName,
13
- resolveMap: session.resolveMap,
14
- definition,
15
- });
16
- if (entry === undefined) {
17
- return false;
18
- }
19
- const { filePath } = await findFileInPackage({
20
- packagePath: entry.path,
21
- filePath: importPath,
22
- });
23
- if (filePath) {
24
- return true;
25
- }
26
- return false;
27
- }
28
- //# sourceMappingURL=validateOverride.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateOverride.js","sourceRoot":"","sources":["../../../src/commands/start/validateOverride.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EACrC,OAAO,EACP,WAAW,EACX,UAAU,EACV,QAAQ,GAMT;IACC,IAAI,UAAU,GAAG,SAAS,CAAC;IAE3B,IAAI,QAAQ,EAAE;QACZ,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;QACtD,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;QACrE,UAAU,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;KAChC;IAED,MAAM,KAAK,GAAG,mBAAmB,CAAC;QAChC,WAAW;QACX,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,UAAU;KACX,CAAC,CAAC;IAEH,IAAI,KAAK,KAAK,SAAS,EAAE;QACvB,OAAO,KAAK,CAAC;KACd;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,iBAAiB,CAAC;QAC3C,WAAW,EAAE,KAAK,CAAC,IAAI;QACvB,QAAQ,EAAE,UAAU;KACrB,CAAC,CAAC;IAEH,IAAI,QAAQ,EAAE;QACZ,OAAO,IAAI,CAAC;KACb;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { findResolveMapEntry, findFileInPackage } from '@ms-cloudpack/package-utilities';\nimport { slash } from '@ms-cloudpack/path-string-parsing';\nimport type { Session } from '../../types.js';\nimport { parseRequestInfo } from './parseRequestInfo.js';\n\nexport async function validateOverride({\n session,\n packageName,\n importPath,\n filename,\n}: {\n session: Session;\n packageName: string;\n importPath: string;\n filename?: string;\n}) {\n let definition = undefined;\n\n if (filename) {\n const requestPath = slash(new URL(filename).pathname);\n const { packageName: name, version } = parseRequestInfo(requestPath);\n definition = { name, version };\n }\n\n const entry = findResolveMapEntry({\n packageName,\n resolveMap: session.resolveMap,\n definition,\n });\n\n if (entry === undefined) {\n return false;\n }\n\n const { filePath } = await findFileInPackage({\n packagePath: entry.path,\n filePath: importPath,\n });\n\n if (filePath) {\n return true;\n }\n return false;\n}\n"]}
@@ -1 +0,0 @@
1
- export {};
@@ -1,137 +0,0 @@
1
- import { describe, it, expect, afterEach } from '@jest/globals';
2
- import { createResolveMap } from '@ms-cloudpack/package-utilities';
3
- import { createTestFileStructure } from '@ms-cloudpack/test-utilities';
4
- import { validateOverride } from './validateOverride.js';
5
- import fs from 'fs';
6
- const { rm } = fs.promises;
7
- describe('validateOverride', () => {
8
- let testPath;
9
- afterEach(async () => {
10
- if (testPath) {
11
- await rm(testPath, { recursive: true });
12
- testPath = undefined;
13
- }
14
- });
15
- it('returns true when the file is found', async () => {
16
- testPath = await createTestFileStructure({
17
- 'package.json': {
18
- name: 'test-project-1',
19
- version: '0.0.1',
20
- type: 'module',
21
- exports: {
22
- '.': './lib/index.js',
23
- },
24
- dependencies: {
25
- b: '^1.0.0',
26
- },
27
- },
28
- 'src/index.ts': `import { b2 } from 'b/other/path/file'; export const a = 'a' + b2();`,
29
- 'node_modules/b/package.json': {
30
- name: 'b',
31
- version: '1.0.0',
32
- main: 'index.js',
33
- },
34
- 'node_modules/b/index.js': `export const b = () => 'b';`,
35
- 'node_modules/b/other/path/file.js': `export const b2 = () => 'b2';`,
36
- });
37
- const result = await validateOverride({
38
- session: {
39
- resolveMap: await createResolveMap({ appPath: testPath }),
40
- },
41
- packageName: 'b',
42
- importPath: 'other/path/file',
43
- filename: 'http://localhost/test-project-1@0.0.1/src/index.ts',
44
- });
45
- expect(result).toEqual(true);
46
- });
47
- it('returns true when the file is found without filename', async () => {
48
- testPath = await createTestFileStructure({
49
- 'package.json': {
50
- name: 'test-project-1',
51
- version: '0.0.1',
52
- type: 'module',
53
- exports: {
54
- '.': './lib/index.js',
55
- },
56
- dependencies: {
57
- b: '^1.0.0',
58
- },
59
- },
60
- 'src/index.ts': `import { b2 } from 'b/other/path/file'; export const a = 'a' + b2();`,
61
- 'node_modules/b/package.json': {
62
- name: 'b',
63
- version: '1.0.0',
64
- main: 'index.js',
65
- },
66
- 'node_modules/b/index.js': `export const b = () => 'b';`,
67
- 'node_modules/b/other/path/file.js': `export const b2 = () => 'b2';`,
68
- });
69
- const result = await validateOverride({
70
- session: {
71
- resolveMap: await createResolveMap({ appPath: testPath }),
72
- },
73
- packageName: 'b',
74
- importPath: 'other/path/file',
75
- });
76
- expect(result).toEqual(true);
77
- });
78
- it('returns false when the package is not a dependency', async () => {
79
- testPath = await createTestFileStructure({
80
- 'package.json': {
81
- name: 'test-project-1',
82
- version: '0.0.1',
83
- type: 'module',
84
- exports: {
85
- '.': './lib/index.js',
86
- },
87
- },
88
- 'src/index.ts': `import { b2 } from 'b/other/path/file'; export const a = 'a' + b2();`,
89
- 'node_modules/b/package.json': {
90
- name: 'b',
91
- version: '1.0.0',
92
- main: 'index.js',
93
- },
94
- 'node_modules/b/index.js': `export const b = () => 'b';`,
95
- 'node_modules/b/other/path/file.js': `export const b2 = () => 'b2';`,
96
- });
97
- const result = await validateOverride({
98
- session: {
99
- resolveMap: await createResolveMap({ appPath: testPath }),
100
- },
101
- packageName: 'b',
102
- importPath: 'other/path/file',
103
- });
104
- expect(result).toEqual(false);
105
- });
106
- it('returns false when the file does not exist', async () => {
107
- testPath = await createTestFileStructure({
108
- 'package.json': {
109
- name: 'test-project-1',
110
- version: '0.0.1',
111
- type: 'module',
112
- exports: {
113
- '.': './lib/index.js',
114
- },
115
- dependencies: {
116
- b: '^1.0.0',
117
- },
118
- },
119
- 'src/index.ts': `import { b2 } from 'b/other/path/file'; export const a = 'a' + b2();`,
120
- 'node_modules/b/package.json': {
121
- name: 'b',
122
- version: '1.0.0',
123
- main: 'index.js',
124
- },
125
- 'node_modules/b/index.js': `export const b = () => 'b';`,
126
- });
127
- const result = await validateOverride({
128
- session: {
129
- resolveMap: await createResolveMap({ appPath: testPath }),
130
- },
131
- packageName: 'b',
132
- importPath: 'other/path/file',
133
- });
134
- expect(result).toEqual(false);
135
- });
136
- });
137
- //# sourceMappingURL=validateOverride.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateOverride.test.js","sourceRoot":"","sources":["../../../src/commands/start/validateOverride.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC;AAE3B,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,QAA4B,CAAC;IAEjC,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,IAAI,QAAQ,EAAE;YACZ,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YACxC,QAAQ,GAAG,SAAS,CAAC;SACtB;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;QACnD,QAAQ,GAAG,MAAM,uBAAuB,CAAC;YACvC,cAAc,EAAE;gBACd,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,OAAO;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE;oBACP,GAAG,EAAE,gBAAgB;iBACtB;gBACD,YAAY,EAAE;oBACZ,CAAC,EAAE,QAAQ;iBACZ;aACF;YACD,cAAc,EAAE,sEAAsE;YACtF,6BAA6B,EAAE;gBAC7B,IAAI,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AyB,EAAE,6BAA6B;SACzD,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC;YACpC,OAAO,EAAE;gBACP,UAAU,EAAE,MAAM,gBAAgB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;aAC/C;YACZ,WAAW,EAAE,GAAG;YAChB,UAAU,EAAE,iBAAiB;SAC9B,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, it, expect, afterEach } from '@jest/globals';\nimport { createResolveMap } from '@ms-cloudpack/package-utilities';\nimport { createTestFileStructure } from '@ms-cloudpack/test-utilities';\nimport type { Session } from '../../types.js';\nimport { validateOverride } from './validateOverride.js';\nimport fs from 'fs';\n\nconst { rm } = fs.promises;\n\ndescribe('validateOverride', () => {\n let testPath: string | undefined;\n\n afterEach(async () => {\n if (testPath) {\n await rm(testPath, { recursive: true });\n testPath = undefined;\n }\n });\n\n it('returns true when the file is found', async () => {\n testPath = await createTestFileStructure({\n 'package.json': {\n name: 'test-project-1',\n version: '0.0.1',\n type: 'module',\n exports: {\n '.': './lib/index.js',\n },\n dependencies: {\n b: '^1.0.0',\n },\n },\n 'src/index.ts': `import { b2 } from 'b/other/path/file'; export const a = 'a' + b2();`,\n 'node_modules/b/package.json': {\n name: 'b',\n version: '1.0.0',\n main: 'index.js',\n },\n 'node_modules/b/index.js': `export const b = () => 'b';`,\n 'node_modules/b/other/path/file.js': `export const b2 = () => 'b2';`,\n });\n\n const result = await validateOverride({\n session: {\n resolveMap: await createResolveMap({ appPath: testPath }),\n } as Session,\n packageName: 'b',\n importPath: 'other/path/file',\n filename: 'http://localhost/test-project-1@0.0.1/src/index.ts',\n });\n\n expect(result).toEqual(true);\n });\n\n it('returns true when the file is found without filename', async () => {\n testPath = await createTestFileStructure({\n 'package.json': {\n name: 'test-project-1',\n version: '0.0.1',\n type: 'module',\n exports: {\n '.': './lib/index.js',\n },\n dependencies: {\n b: '^1.0.0',\n },\n },\n 'src/index.ts': `import { b2 } from 'b/other/path/file'; export const a = 'a' + b2();`,\n 'node_modules/b/package.json': {\n name: 'b',\n version: '1.0.0',\n main: 'index.js',\n },\n 'node_modules/b/index.js': `export const b = () => 'b';`,\n 'node_modules/b/other/path/file.js': `export const b2 = () => 'b2';`,\n });\n\n const result = await validateOverride({\n session: {\n resolveMap: await createResolveMap({ appPath: testPath }),\n } as Session,\n packageName: 'b',\n importPath: 'other/path/file',\n });\n\n expect(result).toEqual(true);\n });\n\n it('returns false when the package is not a dependency', async () => {\n testPath = await createTestFileStructure({\n 'package.json': {\n name: 'test-project-1',\n version: '0.0.1',\n type: 'module',\n exports: {\n '.': './lib/index.js',\n },\n },\n 'src/index.ts': `import { b2 } from 'b/other/path/file'; export const a = 'a' + b2();`,\n 'node_modules/b/package.json': {\n name: 'b',\n version: '1.0.0',\n main: 'index.js',\n },\n 'node_modules/b/index.js': `export const b = () => 'b';`,\n 'node_modules/b/other/path/file.js': `export const b2 = () => 'b2';`,\n });\n\n const result = await validateOverride({\n session: {\n resolveMap: await createResolveMap({ appPath: testPath }),\n } as Session,\n packageName: 'b',\n importPath: 'other/path/file',\n });\n\n expect(result).toEqual(false);\n });\n\n it('returns false when the file does not exist', async () => {\n testPath = await createTestFileStructure({\n 'package.json': {\n name: 'test-project-1',\n version: '0.0.1',\n type: 'module',\n exports: {\n '.': './lib/index.js',\n },\n dependencies: {\n b: '^1.0.0',\n },\n },\n 'src/index.ts': `import { b2 } from 'b/other/path/file'; export const a = 'a' + b2();`,\n 'node_modules/b/package.json': {\n name: 'b',\n version: '1.0.0',\n main: 'index.js',\n },\n 'node_modules/b/index.js': `export const b = () => 'b';`,\n });\n\n const result = await validateOverride({\n session: {\n resolveMap: await createResolveMap({ appPath: testPath }),\n } as Session,\n packageName: 'b',\n importPath: 'other/path/file',\n });\n\n expect(result).toEqual(false);\n });\n});\n"]}
@@ -1,31 +0,0 @@
1
- import type { CloudpackConfig } from '../types.js';
2
- export declare const configFileName = "cloudpack.config.json";
3
- /**
4
- * @param cwd base path of the config file
5
- * @returns the path of the config file
6
- */
7
- export declare function getConfigPath(cwd?: string): string;
8
- /**
9
- * Reads the config file synchronously
10
- * @param cwd base path of the config file
11
- * @returns cloudpack config object or empty object if no config file exists.
12
- */
13
- export declare function readConfigSync(cwd?: string): CloudpackConfig;
14
- /**
15
- * Reads the config file asynchronously
16
- * @param cwd base path of the config file
17
- * @returns cloudpack config object or empty object if no config file exists.
18
- */
19
- export declare function readConfig(cwd?: string): Promise<CloudpackConfig>;
20
- /**
21
- * Writes the config file asynchronously
22
- * @param config updated config object to be written
23
- * @param cwd base path of the config file
24
- */
25
- export declare function writeConfig(config: CloudpackConfig, cwd?: string): Promise<void>;
26
- /**
27
- * Writes the config file synchronously
28
- * @param config updated config object to be written
29
- * @param cwd base path of the config file
30
- */
31
- export declare function writeConfigSync(config: CloudpackConfig, cwd?: string): void;
@@ -1,54 +0,0 @@
1
- import path from 'path';
2
- import { readJson, readJsonSync, writeJson, writeJsonSync } from '@ms-cloudpack/json-utilities';
3
- export const configFileName = 'cloudpack.config.json';
4
- /**
5
- * @param cwd base path of the config file
6
- * @returns the path of the config file
7
- */
8
- export function getConfigPath(cwd) {
9
- const basePath = cwd || process.cwd();
10
- return path.join(basePath, configFileName);
11
- }
12
- /**
13
- * Reads the config file synchronously
14
- * @param cwd base path of the config file
15
- * @returns cloudpack config object or empty object if no config file exists.
16
- */
17
- export function readConfigSync(cwd) {
18
- const filePath = getConfigPath(cwd);
19
- const config = readJsonSync(filePath) || {};
20
- return config;
21
- }
22
- /**
23
- * Reads the config file asynchronously
24
- * @param cwd base path of the config file
25
- * @returns cloudpack config object or empty object if no config file exists.
26
- */
27
- export async function readConfig(cwd) {
28
- const filePath = getConfigPath(cwd);
29
- const config = (await readJson(filePath)) || {};
30
- return config;
31
- }
32
- /**
33
- * Writes the config file asynchronously
34
- * @param config updated config object to be written
35
- * @param cwd base path of the config file
36
- */
37
- export async function writeConfig(config, cwd) {
38
- const filePath = getConfigPath(cwd);
39
- return writeJson(filePath, {
40
- ...config,
41
- });
42
- }
43
- /**
44
- * Writes the config file synchronously
45
- * @param config updated config object to be written
46
- * @param cwd base path of the config file
47
- */
48
- export function writeConfigSync(config, cwd) {
49
- const filePath = getConfigPath(cwd);
50
- return writeJsonSync(filePath, {
51
- ...config,
52
- });
53
- }
54
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/common/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAEhG,MAAM,CAAC,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAEtD;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,GAAY;IACxC,MAAM,QAAQ,GAAG,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACtC,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;AAC7C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAAY;IACzC,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,MAAM,GAAoB,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IAE7D,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAY;IAC3C,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,MAAM,GAAoB,CAAC,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;IAEjE,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAuB,EAAE,GAAY;IACrE,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAEpC,OAAO,SAAS,CAAC,QAAQ,EAAE;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAuB,EAAE,GAAY;IACnE,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAEpC,OAAO,aAAa,CAAC,QAAQ,EAAE;QAC7B,GAAG,MAAM;KACV,CAAC,CAAC;AACL,CAAC","sourcesContent":["import path from 'path';\nimport type { CloudpackConfig } from '../types.js';\nimport { readJson, readJsonSync, writeJson, writeJsonSync } from '@ms-cloudpack/json-utilities';\n\nexport const configFileName = 'cloudpack.config.json';\n\n/**\n * @param cwd base path of the config file\n * @returns the path of the config file\n */\nexport function getConfigPath(cwd?: string) {\n const basePath = cwd || process.cwd();\n return path.join(basePath, configFileName);\n}\n\n/**\n * Reads the config file synchronously\n * @param cwd base path of the config file\n * @returns cloudpack config object or empty object if no config file exists.\n */\nexport function readConfigSync(cwd?: string) {\n const filePath = getConfigPath(cwd);\n const config: CloudpackConfig = readJsonSync(filePath) || {};\n\n return config;\n}\n\n/**\n * Reads the config file asynchronously\n * @param cwd base path of the config file\n * @returns cloudpack config object or empty object if no config file exists.\n */\nexport async function readConfig(cwd?: string) {\n const filePath = getConfigPath(cwd);\n const config: CloudpackConfig = (await readJson(filePath)) || {};\n\n return config;\n}\n\n/**\n * Writes the config file asynchronously\n * @param config updated config object to be written\n * @param cwd base path of the config file\n */\nexport async function writeConfig(config: CloudpackConfig, cwd?: string) {\n const filePath = getConfigPath(cwd);\n\n return writeJson(filePath, {\n ...config,\n });\n}\n\n/**\n * Writes the config file synchronously\n * @param config updated config object to be written\n * @param cwd base path of the config file\n */\nexport function writeConfigSync(config: CloudpackConfig, cwd?: string) {\n const filePath = getConfigPath(cwd);\n\n return writeJsonSync(filePath, {\n ...config,\n });\n}\n"]}
@@ -1,13 +0,0 @@
1
- export declare const configTemplate: {
2
- packageOverrides: {
3
- name: string;
4
- versionRequirement: string;
5
- overrides: {
6
- exports: {
7
- '.': string;
8
- './path': string;
9
- './other-path': string;
10
- };
11
- };
12
- }[];
13
- };
@@ -1,16 +0,0 @@
1
- export const configTemplate = {
2
- packageOverrides: [
3
- {
4
- name: 'package-name',
5
- versionRequirement: '*',
6
- overrides: {
7
- exports: {
8
- '.': './index.js',
9
- './path': './path.js',
10
- './other-path': './other-path.js',
11
- },
12
- },
13
- },
14
- ],
15
- };
16
- //# sourceMappingURL=configTemplate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"configTemplate.js","sourceRoot":"","sources":["../../src/common/configTemplate.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,gBAAgB,EAAE;QAChB;YACE,IAAI,EAAE,cAAc;YACpB,kBAAkB,EAAE,GAAG;YACvB,SAAS,EAAE;gBACT,OAAO,EAAE;oBACP,GAAG,EAAE,YAAY;oBACjB,QAAQ,EAAE,WAAW;oBACrB,cAAc,EAAE,iBAAiB;iBAClC;aACF;SACF;KACF;CACF,CAAC","sourcesContent":["export const configTemplate = {\n packageOverrides: [\n {\n name: 'package-name',\n versionRequirement: '*',\n overrides: {\n exports: {\n '.': './index.js',\n './path': './path.js',\n './other-path': './other-path.js',\n },\n },\n },\n ],\n};\n"]}