@cobol-ts/yaml-jsyaml 0.0.0-stage → 0.0.8
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 +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/src/js.yaml.d.ts +3 -0
- package/dist/src/js.yaml.js +18 -0
- package/dist/src/js.yaml.js.map +1 -0
- package/dist/src/js.yaml.spec.d.ts +1 -0
- package/dist/src/js.yaml.spec.js +13 -0
- package/dist/src/js.yaml.spec.js.map +1 -0
- package/package.json +62 -3
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @cobol-ts/yaml-jsyaml
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `js-yaml` implementation of `@cobol-ts/yaml`. Parses with JSON schema and rejects duplicate mapping keys.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/js.yaml';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./src/js.yaml"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsYamlParser = void 0;
|
|
4
|
+
const js_yaml_1 = require("js-yaml");
|
|
5
|
+
/** js-yaml belongs at this adapter boundary; callers consume YamlParser. */
|
|
6
|
+
exports.jsYamlParser = {
|
|
7
|
+
parse(source) {
|
|
8
|
+
try {
|
|
9
|
+
// JSON_SCHEMA avoids implicit Date / timestamp objects in config.
|
|
10
|
+
// json:false (the default) rejects duplicate YAML mapping keys.
|
|
11
|
+
return { value: (0, js_yaml_1.load)(source, { schema: js_yaml_1.JSON_SCHEMA, json: false }) };
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
return { errors: [error instanceof Error ? error.message : String(error)] };
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=js.yaml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"js.yaml.js","sourceRoot":"","sources":["../../src/js.yaml.ts"],"names":[],"mappings":";;;AAAA,qCAAyC;AAGzC,4EAA4E;AAC/D,QAAA,YAAY,GAAe;IACpC,KAAK,CAAC,MAAM;QACR,IAAI,CAAC;YACD,kEAAkE;YAClE,gEAAgE;YAChE,OAAO,EAAC,KAAK,EAAE,IAAA,cAAI,EAAC,MAAM,EAAE,EAAC,MAAM,EAAE,qBAAW,EAAE,IAAI,EAAE,KAAK,EAAC,CAAC,EAAC,CAAA;QACpE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,EAAC,MAAM,EAAE,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAC,CAAA;QAC7E,CAAC;IACL,CAAC;CACJ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const js_yaml_1 = require("./js.yaml");
|
|
4
|
+
describe('jsYamlParser', () => {
|
|
5
|
+
it('reads nested configuration as ordinary values', () => {
|
|
6
|
+
expect(js_yaml_1.jsYamlParser.parse('graph:\n score: 42\n enabled: true\n')).toEqual({ value: { graph: { score: 42, enabled: true } } });
|
|
7
|
+
});
|
|
8
|
+
it('rejects duplicate keys', () => {
|
|
9
|
+
const result = js_yaml_1.jsYamlParser.parse('score: 1\nscore: 2\n');
|
|
10
|
+
expect('errors' in result).toEqual(true);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=js.yaml.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"js.yaml.spec.js","sourceRoot":"","sources":["../../src/js.yaml.spec.ts"],"names":[],"mappings":";;AAAA,uCAAsC;AAEtC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACrD,MAAM,CAAC,sBAAY,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAC,EAAC,EAAC,CAAC,CAAA;IAC9H,CAAC,CAAC,CAAA;IACF,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAC9B,MAAM,MAAM,GAAG,sBAAY,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAA;QACzD,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5C,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,65 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cobol-ts/yaml-jsyaml",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "js-yaml adapter for the generic YAML parsing interface",
|
|
4
|
+
"version": "0.0.8",
|
|
5
|
+
"main": "dist/index",
|
|
6
|
+
"types": "dist/index",
|
|
7
|
+
"browserslist": {
|
|
8
|
+
"development": [
|
|
9
|
+
"last 1 chrome version",
|
|
10
|
+
"last 1 firefox version",
|
|
11
|
+
"last 1 safari version"
|
|
12
|
+
],
|
|
13
|
+
"production": [
|
|
14
|
+
">0.2%",
|
|
15
|
+
"not dead",
|
|
16
|
+
"not op_mini all"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"js-yaml": "^4.1.0",
|
|
21
|
+
"@cobol-ts/yaml": "0.0.8",
|
|
22
|
+
"@cobol-ts/errors": "0.0.8"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/js-yaml": "^4.0.9",
|
|
26
|
+
"typescript": "^5.2.2",
|
|
27
|
+
"@testing-library/jest-dom": "^6.1.4",
|
|
28
|
+
"@types/jest": "^29.0.0",
|
|
29
|
+
"@types/node": "^14.0.0",
|
|
30
|
+
"jest": "^29.0.0",
|
|
31
|
+
"ts-jest": "^29.0.0"
|
|
32
|
+
},
|
|
33
|
+
"eslintConfig": {
|
|
34
|
+
"extends": [
|
|
35
|
+
"react-app",
|
|
36
|
+
"react-app/jest"
|
|
37
|
+
],
|
|
38
|
+
"overrides": [
|
|
39
|
+
{
|
|
40
|
+
"files": [
|
|
41
|
+
"**/*.stories.*"
|
|
42
|
+
],
|
|
43
|
+
"rules": {
|
|
44
|
+
"import/no-anonymous-default-export": "off"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"files": [
|
|
50
|
+
"dist/index.js",
|
|
51
|
+
"dist/index.d.ts",
|
|
52
|
+
"dist/src/",
|
|
53
|
+
"build/",
|
|
54
|
+
"dist/**/*"
|
|
55
|
+
],
|
|
56
|
+
"keywords": [
|
|
57
|
+
"indexing"
|
|
58
|
+
],
|
|
59
|
+
"license": "MIT",
|
|
60
|
+
"repository": "git@github.com:intellimaintain/intellimaintain.git",
|
|
61
|
+
"scripts": {
|
|
62
|
+
"test": "jest --config jest.config.json --env node",
|
|
63
|
+
"test:watch": "npm run test -- --watch"
|
|
64
|
+
}
|
|
6
65
|
}
|