@adviser/cement 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
package/node/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./node_file_service";
2
2
  export * from "./node_sys_abstraction";
3
+ export * from "./mock_file_service";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC"}
package/node/index.js CHANGED
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./node_file_service"), exports);
18
18
  __exportStar(require("./node_sys_abstraction"), exports);
19
+ __exportStar(require("./mock_file_service"), exports);
19
20
  //# sourceMappingURL=index.js.map
package/node/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,yDAAuC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,yDAAuC;AACvC,sDAAoC"}
@@ -6,6 +6,7 @@ export interface FileCollector {
6
6
  }
7
7
  export declare class MockFileService extends NodeFileService {
8
8
  readonly files: Record<string, FileCollector>;
9
+ abs(fname: string): string;
9
10
  create(fname: string): Promise<NamedWritableStream>;
10
11
  }
11
12
  //# sourceMappingURL=mock_file_service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mock_file_service.d.ts","sourceRoot":"","sources":["../../src/node/mock_file_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,eAAgB,SAAQ,eAAe;IAClD,QAAQ,CAAC,KAAK,gCAAuC;IAEtC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;CA0BnE"}
1
+ {"version":3,"file":"mock_file_service.d.ts","sourceRoot":"","sources":["../../src/node/mock_file_service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,eAAgB,SAAQ,eAAe;IAClD,QAAQ,CAAC,KAAK,gCAAuC;IAE5C,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAIpB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;CA2BnE"}
@@ -7,16 +7,20 @@ class MockFileService extends node_file_service_1.NodeFileService {
7
7
  super(...arguments);
8
8
  this.files = {};
9
9
  }
10
+ abs(fname) {
11
+ return this.join("/mock/", fname);
12
+ }
10
13
  async create(fname) {
11
14
  let oName = fname;
12
15
  if (!this.isAbsolute(fname)) {
13
- oName = this.abs(fname);
16
+ oName = await this.abs(fname);
14
17
  }
15
18
  const fc = {
16
19
  name: oName,
17
20
  content: "",
18
21
  };
19
22
  this.files[oName] = fc;
23
+ this.files[fname] = fc;
20
24
  const decoder = new TextDecoder();
21
25
  return {
22
26
  name: oName,
@@ -1 +1 @@
1
- {"version":3,"file":"mock_file_service.js","sourceRoot":"","sources":["../../src/node/mock_file_service.ts"],"names":[],"mappings":";;;AACA,2DAAsD;AAOtD,MAAa,eAAgB,SAAQ,mCAAe;IAApD;;QACW,UAAK,GAAG,EAAmC,CAAC;IA4BvD,CAAC;IA1BU,KAAK,CAAC,MAAM,CAAC,KAAa;QACjC,IAAI,KAAK,GAAG,KAAK,CAAC;QAClB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QAED,MAAM,EAAE,GAAG;YACT,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,EAAE;SACZ,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAElC,OAAO;YACL,IAAI,EAAE,KAAK;YACX,MAAM,EAAE,IAAI,cAAc,CAAa;gBACrC,KAAK,CAAC,KAAK;oBACT,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAClD,CAAC;gBACD,KAAK,KAAI,CAAC;gBACV,KAAK;oBACH,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;gBACrC,CAAC;aACF,CAAC;SACH,CAAC;IACJ,CAAC;CACF;AA7BD,0CA6BC"}
1
+ {"version":3,"file":"mock_file_service.js","sourceRoot":"","sources":["../../src/node/mock_file_service.ts"],"names":[],"mappings":";;;AACA,2DAAsD;AAOtD,MAAa,eAAgB,SAAQ,mCAAe;IAApD;;QACW,UAAK,GAAG,EAAmC,CAAC;IAiCvD,CAAC;IA/BU,GAAG,CAAC,KAAa;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;IAEQ,KAAK,CAAC,MAAM,CAAC,KAAa;QACjC,IAAI,KAAK,GAAG,KAAK,CAAC;QAClB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,KAAK,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;QAED,MAAM,EAAE,GAAG;YACT,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,EAAE;SACZ,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAElC,OAAO;YACL,IAAI,EAAE,KAAK;YACX,MAAM,EAAE,IAAI,cAAc,CAAa;gBACrC,KAAK,CAAC,KAAK;oBACT,EAAE,CAAC,OAAO,GAAG,EAAE,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAClD,CAAC;gBACD,KAAK,KAAI,CAAC;gBACV,KAAK;oBACH,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;gBACrC,CAAC;aACF,CAAC;SACH,CAAC;IACJ,CAAC;CACF;AAlCD,0CAkCC"}
@@ -3,11 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const mock_file_service_1 = require("./mock_file_service");
4
4
  it("writeFileString", async () => {
5
5
  const f = new mock_file_service_1.MockFileService();
6
- const fname = f.abs("test.txt");
7
- await f.writeFileString(fname, "hello");
6
+ await f.writeFileString("test", "hello");
8
7
  expect(f.files).toEqual({
9
- [fname]: {
10
- name: fname,
8
+ "/mock/test": {
9
+ content: "hello",
10
+ name: "/mock/test",
11
+ },
12
+ test: {
13
+ name: "/mock/test",
11
14
  content: "hello",
12
15
  },
13
16
  });
@@ -1 +1 @@
1
- {"version":3,"file":"mock_file_service.test.js","sourceRoot":"","sources":["../../src/node/mock_file_service.test.ts"],"names":[],"mappings":";;AAAA,2DAAsD;AAEtD,EAAE,CAAC,iBAAiB,EAAE,KAAK,IAAI,EAAE;IAC/B,MAAM,CAAC,GAAG,IAAI,mCAAe,EAAE,CAAC;IAChC,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAChC,MAAM,CAAC,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;QACtB,CAAC,KAAK,CAAC,EAAE;YACP,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,OAAO;SACjB;KACF,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"mock_file_service.test.js","sourceRoot":"","sources":["../../src/node/mock_file_service.test.ts"],"names":[],"mappings":";;AAAA,2DAAsD;AAEtD,EAAE,CAAC,iBAAiB,EAAE,KAAK,IAAI,EAAE;IAC/B,MAAM,CAAC,GAAG,IAAI,mCAAe,EAAE,CAAC;IAChC,MAAM,CAAC,CAAC,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;QACtB,YAAY,EAAE;YACZ,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE,YAAY;SACnB;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,OAAO;SACjB;KACF,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adviser/cement",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "better try/catch/finally handling",
5
5
  "main": "index.js",
6
6
  "keywords": [],
@@ -12,15 +12,15 @@
12
12
  "homepage": "https://github.com/mabels/cement#readme",
13
13
  "devDependencies": {
14
14
  "@types/jest": "^29.5.12",
15
- "@types/node": "^20.11.17",
15
+ "@types/node": "^20.12.3",
16
16
  "@typescript-eslint/eslint-plugin": "^6.21.0",
17
17
  "@typescript-eslint/parser": "^6.21.0",
18
- "eslint": "^8.56.0",
18
+ "eslint": "^8.57.0",
19
19
  "jest": "^29.7.0",
20
20
  "prettier": "^3.2.5",
21
21
  "ts-jest": "^29.1.2",
22
22
  "ts-node": "^10.9.2",
23
- "typescript": "^5.3.3"
23
+ "typescript": "^5.4.3"
24
24
  },
25
25
  "engines": {
26
26
  "node": ">=16"