projen 0.80.6 → 0.80.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/.jsii +41 -41
- package/lib/awscdk/auto-discover.js +5 -5
- package/lib/awscdk/awscdk-app-java.js +1 -1
- package/lib/awscdk/awscdk-app-py.js +1 -1
- package/lib/awscdk/awscdk-app-ts.js +1 -1
- package/lib/awscdk/awscdk-construct.js +2 -2
- package/lib/awscdk/awscdk-deps-java.js +1 -1
- package/lib/awscdk/awscdk-deps-js.js +1 -1
- package/lib/awscdk/awscdk-deps-py.js +1 -1
- package/lib/awscdk/awscdk-deps.js +1 -1
- package/lib/awscdk/cdk-config.js +1 -1
- package/lib/awscdk/cdk-tasks.js +1 -1
- package/lib/awscdk/integration-test.js +1 -1
- package/lib/awscdk/lambda-extension.js +1 -1
- package/lib/awscdk/lambda-function.js +2 -2
- package/lib/build/build-workflow.js +1 -1
- package/lib/cdk/auto-discover-base.js +2 -2
- package/lib/cdk/construct-lib.js +1 -1
- package/lib/cdk/integration-test-base.js +1 -1
- package/lib/cdk/jsii-docgen.js +1 -1
- package/lib/cdk/jsii-project.js +1 -1
- package/lib/cdk8s/auto-discover.js +2 -2
- package/lib/cdk8s/cdk8s-app-py.js +1 -1
- package/lib/cdk8s/cdk8s-app-ts.js +1 -1
- package/lib/cdk8s/cdk8s-construct.js +1 -1
- package/lib/cdk8s/cdk8s-deps-py.js +1 -1
- package/lib/cdk8s/cdk8s-deps.js +1 -1
- package/lib/cdk8s/integration-test.js +1 -1
- package/lib/cdktf/cdktf-construct.js +1 -1
- package/lib/circleci/circleci.js +1 -1
- package/lib/component.js +1 -1
- package/lib/dependencies.js +1 -1
- package/lib/dev-env.js +1 -1
- package/lib/docker-compose/docker-compose-service.js +1 -1
- package/lib/docker-compose/docker-compose.js +1 -1
- package/lib/file.js +1 -1
- package/lib/gitattributes.js +1 -1
- package/lib/github/actions-provider.js +1 -1
- package/lib/github/auto-approve.js +1 -1
- package/lib/github/auto-merge.js +1 -1
- package/lib/github/dependabot.js +1 -1
- package/lib/github/github-credentials.js +1 -1
- package/lib/github/github-project.js +1 -1
- package/lib/github/github.js +1 -1
- package/lib/github/mergify.js +1 -1
- package/lib/github/pr-template.js +1 -1
- package/lib/github/pull-request-lint.js +1 -1
- package/lib/github/stale.js +1 -1
- package/lib/github/task-workflow-job.js +1 -1
- package/lib/github/task-workflow.js +1 -1
- package/lib/github/workflow-actions.js +1 -1
- package/lib/github/workflow-jobs.js +1 -1
- package/lib/github/workflow-steps.js +1 -1
- package/lib/github/workflows.js +1 -1
- package/lib/gitlab/configuration.js +1 -1
- package/lib/gitlab/gitlab-configuration.js +1 -1
- package/lib/gitlab/nested-configuration.js +1 -1
- package/lib/gitpod.js +1 -1
- package/lib/ignore-file.js +1 -1
- package/lib/ini.js +1 -1
- package/lib/java/java-project.js +1 -1
- package/lib/java/junit.js +1 -1
- package/lib/java/maven-compile.js +1 -1
- package/lib/java/maven-packaging.js +1 -1
- package/lib/java/maven-sample.js +1 -1
- package/lib/java/pom.js +1 -1
- package/lib/java/projenrc.js +1 -1
- package/lib/javascript/bundler.js +1 -1
- package/lib/javascript/eslint.js +1 -1
- package/lib/javascript/jest.js +4 -4
- package/lib/javascript/license-checker.js +1 -1
- package/lib/javascript/node-package.js +1 -1
- package/lib/javascript/node-project.js +1 -1
- package/lib/javascript/npm-config.js +1 -1
- package/lib/javascript/prettier.js +1 -1
- package/lib/javascript/projenrc.js +1 -1
- package/lib/javascript/typescript-config.js +2 -2
- package/lib/javascript/upgrade-dependencies.js +2 -2
- package/lib/javascript/yarnrc.js +1 -1
- package/lib/json-patch.js +1 -1
- package/lib/json.js +1 -1
- package/lib/license.js +1 -1
- package/lib/logger.js +1 -1
- package/lib/makefile.js +1 -1
- package/lib/object-file.js +1 -1
- package/lib/project-build.js +1 -1
- package/lib/project-tree.js +1 -1
- package/lib/project.js +1 -1
- package/lib/projects.js +1 -1
- package/lib/projenrc-json.js +2 -2
- package/lib/projenrc.js +1 -1
- package/lib/python/pip.js +1 -1
- package/lib/python/poetry.d.ts +7 -3
- package/lib/python/poetry.js +43 -21
- package/lib/python/projenrc.js +1 -1
- package/lib/python/pytest-sample.js +1 -1
- package/lib/python/pytest.js +1 -1
- package/lib/python/python-project.js +1 -1
- package/lib/python/python-sample.js +1 -1
- package/lib/python/requirements-file.js +1 -1
- package/lib/python/setuppy.js +1 -1
- package/lib/python/setuptools.js +1 -1
- package/lib/python/venv.js +1 -1
- package/lib/readme.js +1 -1
- package/lib/release/publisher.js +1 -1
- package/lib/release/release-trigger.js +1 -1
- package/lib/release/release.js +1 -1
- package/lib/renovatebot.js +1 -1
- package/lib/sample-file.js +2 -2
- package/lib/semver.js +1 -1
- package/lib/source-code.js +1 -1
- package/lib/task-runtime.js +1 -1
- package/lib/task.js +1 -1
- package/lib/tasks.js +1 -1
- package/lib/testing.js +1 -1
- package/lib/textfile.js +1 -1
- package/lib/toml.js +10 -8
- package/lib/typescript/projenrc-ts.js +1 -1
- package/lib/typescript/projenrc.js +1 -1
- package/lib/typescript/typescript-typedoc.js +1 -1
- package/lib/typescript/typescript.js +6 -6
- package/lib/version.js +2 -2
- package/lib/vscode/devcontainer.js +1 -1
- package/lib/vscode/extensions.js +1 -1
- package/lib/vscode/launch-config.js +1 -1
- package/lib/vscode/settings.js +1 -1
- package/lib/vscode/vscode.js +1 -1
- package/lib/web/next.js +3 -3
- package/lib/web/postcss.js +1 -1
- package/lib/web/react.js +4 -4
- package/lib/web/tailwind.js +1 -1
- package/lib/xmlfile.js +1 -1
- package/lib/yaml.js +1 -1
- package/node_modules/json2toml/CHANGELOG.md +128 -0
- package/node_modules/json2toml/LICENSE.txt +18 -0
- package/node_modules/json2toml/README.md +52 -0
- package/node_modules/json2toml/index.d.ts +13 -0
- package/node_modules/json2toml/index.js +160 -0
- package/node_modules/json2toml/package.json +62 -0
- package/node_modules/lodash.isdate/LICENSE +47 -0
- package/node_modules/lodash.isdate/README.md +18 -0
- package/node_modules/lodash.isdate/index.js +119 -0
- package/node_modules/lodash.isdate/package.json +17 -0
- package/node_modules/lodash.isempty/LICENSE +47 -0
- package/node_modules/lodash.isempty/README.md +18 -0
- package/node_modules/lodash.isempty/index.js +582 -0
- package/node_modules/lodash.isempty/package.json +17 -0
- package/node_modules/lodash.isplainobject/LICENSE +47 -0
- package/node_modules/lodash.isplainobject/README.md +18 -0
- package/node_modules/lodash.isplainobject/index.js +139 -0
- package/node_modules/lodash.isplainobject/package.json +17 -0
- package/node_modules/strftime/Changelog.md +286 -0
- package/node_modules/strftime/Makefile +15 -0
- package/node_modules/strftime/Readme.md +208 -0
- package/node_modules/strftime/bower.json +13 -0
- package/node_modules/strftime/component.json +16 -0
- package/node_modules/strftime/package.json +53 -0
- package/node_modules/strftime/strftime-min.js +21 -0
- package/node_modules/strftime/strftime.js +854 -0
- package/node_modules/strftime/test.js +271 -0
- package/package.json +4 -3
- package/node_modules/@iarna/toml/LICENSE +0 -14
- package/node_modules/@iarna/toml/README.md +0 -301
- package/node_modules/@iarna/toml/index.d.ts +0 -57
- package/node_modules/@iarna/toml/lib/create-date.js +0 -23
- package/node_modules/@iarna/toml/lib/create-datetime-float.js +0 -24
- package/node_modules/@iarna/toml/lib/create-datetime.js +0 -10
- package/node_modules/@iarna/toml/lib/create-time.js +0 -22
- package/node_modules/@iarna/toml/lib/format-num.js +0 -6
- package/node_modules/@iarna/toml/lib/parser-debug.js +0 -60
- package/node_modules/@iarna/toml/lib/parser.js +0 -127
- package/node_modules/@iarna/toml/lib/toml-parser.js +0 -1379
- package/node_modules/@iarna/toml/package.json +0 -82
- package/node_modules/@iarna/toml/parse-async.js +0 -30
- package/node_modules/@iarna/toml/parse-pretty-error.js +0 -33
- package/node_modules/@iarna/toml/parse-stream.js +0 -80
- package/node_modules/@iarna/toml/parse-string.js +0 -18
- package/node_modules/@iarna/toml/parse.js +0 -5
- package/node_modules/@iarna/toml/stringify.js +0 -296
- package/node_modules/@iarna/toml/toml.js +0 -3
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Based on CoffeeScript by andrewschaaf on github
|
|
4
|
+
//
|
|
5
|
+
// TODO:
|
|
6
|
+
// - past and future dates, especially < 1900 and > 2100
|
|
7
|
+
// - look for edge cases
|
|
8
|
+
|
|
9
|
+
var assert = require('assert'),
|
|
10
|
+
libFilename = process.argv[2] || './strftime.js',
|
|
11
|
+
strftime = require(libFilename),
|
|
12
|
+
strftimeUTC = strftime.utc(),
|
|
13
|
+
Time = new Date(1307472705067); // Tue, 07 Jun 2011 18:51:45 GMT
|
|
14
|
+
|
|
15
|
+
assert.fn = function(value, msg) {
|
|
16
|
+
assert.equal(typeof value, 'function', msg);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
function assertFormat(time, format, expected, name, strftime) {
|
|
20
|
+
var actual = strftime(format, time);
|
|
21
|
+
assert.equal(actual, expected, name + '("' + format + '", ' + time + ') is ' + JSON.stringify(actual) + ', expected ' + JSON.stringify(expected));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
assert.format = function(format, expected, expectedUTC, time) {
|
|
25
|
+
time = time || Time;
|
|
26
|
+
if (expected) { assertFormat(time, format, expected, 'strftime', strftime); }
|
|
27
|
+
assertFormat(time, format, expectedUTC || expected, 'strftime.utc()', strftimeUTC);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/// check exports
|
|
31
|
+
assert.fn(strftime.localize);
|
|
32
|
+
assert.fn(strftime.timezone);
|
|
33
|
+
assert.fn(strftime.utc);
|
|
34
|
+
ok('Exports');
|
|
35
|
+
|
|
36
|
+
/// time zones
|
|
37
|
+
if (process.env.TZ == 'America/Vancouver') {
|
|
38
|
+
testTimezone('America/Vancouver');
|
|
39
|
+
assert.format('%C', '01', '01', new Date(100, 0, 1));
|
|
40
|
+
assert.format('%X', '11:51:45 AM', '06:51:45 PM');
|
|
41
|
+
assert.format('%c', 'Tue 07 Jun 2011 11:51:45 AM Pacific Daylight Saving Time', 'Tue 07 Jun 2011 06:51:45 PM GMT');
|
|
42
|
+
assert.format('%j', '097', '098', new Date(1365390736236));
|
|
43
|
+
assert.format('%x', '06/07/11');
|
|
44
|
+
assert.format('%U', '12', null, new Date('2017-03-25 00:00:00 +0000'));
|
|
45
|
+
assert.format('%U', '12', '13', new Date('2017-03-26 00:00:00 +0000'));
|
|
46
|
+
assert.format('%U', '13', null, new Date('2017-03-27 00:00:00 +0000'));
|
|
47
|
+
assert.format('%U', '13', '14', new Date('2017-04-02 00:00:00 +0000'));
|
|
48
|
+
|
|
49
|
+
// Test dates crossing a DST boundary.
|
|
50
|
+
var dstStart = +new Date('2016-11-06 01:50:00');
|
|
51
|
+
assert.format('%T', '01:50:00', '08:50:00', new Date(dstStart))
|
|
52
|
+
assert.format('%T', '01:00:00', '09:00:00', new Date(dstStart + 10 * 60 * 1000))
|
|
53
|
+
|
|
54
|
+
ok('Time zones (' + process.env.TZ + ')');
|
|
55
|
+
}
|
|
56
|
+
else if (process.env.TZ == 'Europe/Amsterdam') {
|
|
57
|
+
testTimezone('Europe/Amsterdam');
|
|
58
|
+
assert.format('%C', '01', '00', new Date(100, 0, 1));
|
|
59
|
+
assert.format('%X', '08:51:45 PM', '06:51:45 PM');
|
|
60
|
+
assert.format('%c', 'Tue 07 Jun 2011 08:51:45 PM Central European Summer Time', 'Tue 07 Jun 2011 06:51:45 PM GMT');
|
|
61
|
+
assert.format('%j', '098', '098', new Date(1365390736236));
|
|
62
|
+
assert.format('%x', '06/07/11');
|
|
63
|
+
assert.format('%U', '12', null, new Date('2017-03-25 00:00:00 +0000'));
|
|
64
|
+
assert.format('%U', '13', null, new Date('2017-03-26 00:00:00 +0000'));
|
|
65
|
+
assert.format('%U', '13', null, new Date('2017-03-27 00:00:00 +0000'));
|
|
66
|
+
assert.format('%U', '14', null, new Date('2017-04-02 00:00:00 +0000'));
|
|
67
|
+
|
|
68
|
+
// Test dates crossing a DST boundary.
|
|
69
|
+
var dstStart = +new Date('2016-10-30 02:50:00');
|
|
70
|
+
assert.format('%T', '02:50:00', '00:50:00', new Date(dstStart))
|
|
71
|
+
assert.format('%T', '02:00:00', '01:00:00', new Date(dstStart + 10 * 60 * 1000))
|
|
72
|
+
|
|
73
|
+
ok('Time zones (' + process.env.TZ + ')');
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
assert(false, '(Current timezone has no tests: ' + (process.env.TZ || 'none') + ')');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/// check all formats in GMT, most coverage
|
|
80
|
+
assert.format('%A', 'Tuesday');
|
|
81
|
+
assert.format('%a', 'Tue');
|
|
82
|
+
assert.format('%B', 'June');
|
|
83
|
+
assert.format('%b', 'Jun');
|
|
84
|
+
assert.format('%C', '20');
|
|
85
|
+
assert.format('%D', '06/07/11');
|
|
86
|
+
assert.format('%d', '07');
|
|
87
|
+
assert.format('%-d', '7');
|
|
88
|
+
assert.format('%_d', ' 7');
|
|
89
|
+
assert.format('%0d', '07');
|
|
90
|
+
assert.format('%e', ' 7');
|
|
91
|
+
assert.format('%F', '2011-06-07');
|
|
92
|
+
assert.format('%H', null, '18');
|
|
93
|
+
assert.format('%h', 'Jun');
|
|
94
|
+
assert.format('%I', null, '06');
|
|
95
|
+
assert.format('%-I', null, '6');
|
|
96
|
+
assert.format('%_I', null, ' 6');
|
|
97
|
+
assert.format('%0I', null, '06');
|
|
98
|
+
assert.format('%j', null, '158');
|
|
99
|
+
assert.format('%k', null, '18');
|
|
100
|
+
assert.format('%L', '067');
|
|
101
|
+
assert.format('%l', null, ' 6');
|
|
102
|
+
assert.format('%-l', null, '6');
|
|
103
|
+
assert.format("%-y", "1", null, new Date('2001-02-03T04:05:06'))
|
|
104
|
+
assert.format("%-y", "23", null, new Date('2023-02-03T04:05:06'))
|
|
105
|
+
assert.format('%_l', null, ' 6');
|
|
106
|
+
assert.format('%0l', null, '06');
|
|
107
|
+
assert.format('%M', null, '51');
|
|
108
|
+
assert.format('%m', '06');
|
|
109
|
+
assert.format('%n', '\n');
|
|
110
|
+
assert.format('%o', '7th');
|
|
111
|
+
assert.format('%P', null, 'pm');
|
|
112
|
+
assert.format('%p', null, 'PM');
|
|
113
|
+
assert.format('%R', null, '18:51');
|
|
114
|
+
assert.format('%r', null, '06:51:45 PM');
|
|
115
|
+
assert.format('%S', '45');
|
|
116
|
+
assert.format('%s', '1307472705');
|
|
117
|
+
assert.format('%T', null, '18:51:45');
|
|
118
|
+
assert.format('%t', '\t');
|
|
119
|
+
assert.format('%U', '23');
|
|
120
|
+
assert.format('%U', '24', null, new Date(+Time + 5 * 86400000));
|
|
121
|
+
assert.format('%u', '2');
|
|
122
|
+
assert.format('%v', ' 7-Jun-2011');
|
|
123
|
+
assert.format('%W', '23');
|
|
124
|
+
assert.format('%W', '23', null, new Date(+Time + 5 * 86400000));
|
|
125
|
+
assert.format('%w', '2');
|
|
126
|
+
assert.format('%Y', '2011');
|
|
127
|
+
assert.format('%y', '11');
|
|
128
|
+
assert.format('%Z', null, 'GMT');
|
|
129
|
+
assert.format('%z', null, '+0000');
|
|
130
|
+
assert.format('%:z', null, '+00:00');
|
|
131
|
+
assert.format('%%', '%'); // literal percent sign
|
|
132
|
+
assert.format('%g', '%g'); // unrecognized directive
|
|
133
|
+
assert.format('%F %T', null, '1970-01-01 00:00:00', new Date(0));
|
|
134
|
+
assert.format('%U', null, '12', new Date('2017-03-25 00:00:00 +0000'));
|
|
135
|
+
assert.format('%U', null, '13', new Date('2017-03-26 00:00:00 +0000'));
|
|
136
|
+
assert.format('%U', null, '13', new Date('2017-03-27 00:00:00 +0000'));
|
|
137
|
+
assert.format('%U', null, '14', new Date('2017-04-02 00:00:00 +0000'));
|
|
138
|
+
ok('GMT');
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
/// locales
|
|
142
|
+
|
|
143
|
+
var it_IT = {
|
|
144
|
+
days: words('domenica lunedi martedi mercoledi giovedi venerdi sabato'),
|
|
145
|
+
shortDays: words('dom lun mar mer gio ven sab'),
|
|
146
|
+
months: words('gennaio febbraio marzo aprile maggio giugno luglio agosto settembre ottobre novembre dicembre'),
|
|
147
|
+
shortMonths: words('gen feb mar apr mag giu lug ago set ott nov dic'),
|
|
148
|
+
AM: 'it$AM',
|
|
149
|
+
PM: 'it$PM',
|
|
150
|
+
am: 'it$am',
|
|
151
|
+
pm: 'it$pm',
|
|
152
|
+
formats: {
|
|
153
|
+
D: 'it$%m/%d/%y',
|
|
154
|
+
F: 'it$%Y-%m-%d',
|
|
155
|
+
R: 'it$%H:%M',
|
|
156
|
+
T: 'it$%H:%M:%S',
|
|
157
|
+
X: '%T',
|
|
158
|
+
c: '%a %b %d %X %Y',
|
|
159
|
+
r: 'it$%I:%M:%S %p',
|
|
160
|
+
v: 'it$%e-%b-%Y',
|
|
161
|
+
x: '%D'
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
var strftimeIT = strftime.localize(it_IT),
|
|
166
|
+
strftimeITUTC = strftimeIT.utc();
|
|
167
|
+
assert.format_it = function(format, expected, expectedUTC) {
|
|
168
|
+
if (expected) { assertFormat(Time, format, expected, 'strftime.localize(it_IT)', strftimeIT); }
|
|
169
|
+
assertFormat(Time, format, expectedUTC || expected, 'strftime.localize(it_IT).utc()', strftimeITUTC);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
assert.format_it('%A', 'martedi');
|
|
173
|
+
assert.format_it('%a', 'mar');
|
|
174
|
+
assert.format_it('%B', 'giugno');
|
|
175
|
+
assert.format_it('%b', 'giu');
|
|
176
|
+
assert.format_it('%c', null, 'mar giu 07 it$18:51:45 2011');
|
|
177
|
+
assert.format_it('%D', 'it$06/07/11');
|
|
178
|
+
assert.format_it('%F', 'it$2011-06-07');
|
|
179
|
+
assert.format_it('%p', null, 'it$PM');
|
|
180
|
+
assert.format_it('%P', null, 'it$pm');
|
|
181
|
+
assert.format_it('%R', null, 'it$18:51');
|
|
182
|
+
assert.format_it('%r', null, 'it$06:51:45 it$PM');
|
|
183
|
+
assert.format_it('%T', null, 'it$18:51:45');
|
|
184
|
+
assert.format_it('%v', 'it$ 7-giu-2011');
|
|
185
|
+
assert.format_it('%x', null, 'it$06/07/11');
|
|
186
|
+
assert.format_it('%X', null, 'it$18:51:45');
|
|
187
|
+
ok('Localization');
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
/// timezones
|
|
191
|
+
|
|
192
|
+
assert.formatTZ = function(format, expected, tz, time) {
|
|
193
|
+
assertFormat(time || Time, format, expected, 'strftime.timezone(' + tz + ')', strftime.timezone(tz));
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
assert.formatTZ('%F %r %z', '2011-06-07 06:51:45 PM +0000', 0);
|
|
197
|
+
assert.formatTZ('%F %r %z', '2011-06-07 06:51:45 PM +0000', '+0000');
|
|
198
|
+
assert.formatTZ('%F %r %z', '2011-06-07 08:51:45 PM +0200', 120);
|
|
199
|
+
assert.formatTZ('%F %r %z', '2011-06-07 08:51:45 PM +0200', '+0200');
|
|
200
|
+
assert.formatTZ('%F %r %z', '2011-06-07 11:51:45 AM -0700', -420);
|
|
201
|
+
assert.formatTZ('%F %r %z', '2011-06-07 11:51:45 AM -0700', '-0700');
|
|
202
|
+
assert.formatTZ('%F %r %z', '2011-06-07 11:21:45 AM -0730', '-0730');
|
|
203
|
+
assert.formatTZ('%F %r %:z', '2011-06-07 11:21:45 AM -07:30', '-0730');
|
|
204
|
+
ok('Time zone offset');
|
|
205
|
+
|
|
206
|
+
/// caching
|
|
207
|
+
(function() {
|
|
208
|
+
// this test fails when the 2 calls cross a millisecond boundary, so try a number of times
|
|
209
|
+
var CacheAttempts = 10;
|
|
210
|
+
var MaxFailures = 1;
|
|
211
|
+
var failures = 0;
|
|
212
|
+
for (var i = 0; i < CacheAttempts; ++i) {
|
|
213
|
+
var expectedMillis = strftime('%L');
|
|
214
|
+
var millis = strftime('%L');
|
|
215
|
+
if (expectedMillis != millis) {
|
|
216
|
+
++failures;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (failures > MaxFailures) {
|
|
220
|
+
assert.fail('timestamp caching appears to be broken (' + failures + ' failed attempts out of ' + CacheAttempts + ')');
|
|
221
|
+
}
|
|
222
|
+
}());
|
|
223
|
+
ok('Cached timestamps');
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
/// helpers
|
|
227
|
+
|
|
228
|
+
function words(s) { return (s || '').split(' '); }
|
|
229
|
+
|
|
230
|
+
function ok(s) { console.log('[ \033[32mOK\033[0m ] ' + s); }
|
|
231
|
+
|
|
232
|
+
// Pass a regex or string that matches the timezone abbrev, e.g. %Z above.
|
|
233
|
+
// Don't pass GMT! Every date includes it and it will fail.
|
|
234
|
+
// Be careful if you pass a regex, it has to quack like the default one.
|
|
235
|
+
function testTimezone(regex) {
|
|
236
|
+
regex = typeof regex === 'string' ? RegExp('\\((' + regex + ')\\)$') : regex;
|
|
237
|
+
var match = Time.toString().match(regex);
|
|
238
|
+
if (match) {
|
|
239
|
+
var off = Time.getTimezoneOffset(),
|
|
240
|
+
hourOff = off / 60,
|
|
241
|
+
hourDiff = Math.floor(hourOff),
|
|
242
|
+
hours = 18 - hourDiff,
|
|
243
|
+
padSpace24 = hours < 10 ? ' ' : '',
|
|
244
|
+
padZero24 = hours < 10 ? '0' : '',
|
|
245
|
+
hour24 = String(hours),
|
|
246
|
+
padSpace12 = (hours % 12) < 10 ? ' ' : '',
|
|
247
|
+
padZero12 = (hours % 12) < 10 ? '0' : '',
|
|
248
|
+
hour12 = String(hours % 12),
|
|
249
|
+
sign = hourDiff < 0 ? '+' : '-',
|
|
250
|
+
minDiff = Time.getTimezoneOffset() - (hourDiff * 60),
|
|
251
|
+
mins = String(51 - minDiff),
|
|
252
|
+
tz = match[1],
|
|
253
|
+
ampm = hour12 == hour24 ? 'AM' : 'PM',
|
|
254
|
+
R = hour24 + ':' + mins,
|
|
255
|
+
r = padZero12 + hour12 + ':' + mins + ':45 ' + ampm,
|
|
256
|
+
T = R + ':45';
|
|
257
|
+
assert.format('%H', padZero24 + hour24, '18');
|
|
258
|
+
assert.format('%I', padZero12 + hour12, '06');
|
|
259
|
+
assert.format('%k', padSpace24 + hour24, '18');
|
|
260
|
+
assert.format('%l', padSpace12 + hour12, ' 6');
|
|
261
|
+
assert.format('%M', mins);
|
|
262
|
+
assert.format('%P', ampm.toLowerCase(), 'pm');
|
|
263
|
+
assert.format('%p', ampm, 'PM');
|
|
264
|
+
assert.format('%R', R, '18:51');
|
|
265
|
+
assert.format('%r', r, '06:51:45 PM');
|
|
266
|
+
assert.format('%T', T, '18:51:45');
|
|
267
|
+
assert.format('%Z', tz, 'GMT');
|
|
268
|
+
assert.format('%z', sign + '0' + Math.abs(hourDiff) + '00', '+0000');
|
|
269
|
+
assert.format('%:z', sign + '0' + Math.abs(hourDiff) + ':00', '+00:00');
|
|
270
|
+
}
|
|
271
|
+
}
|
package/package.json
CHANGED
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"organization": true
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
+
"@iarna/toml": "^2.2.5",
|
|
52
53
|
"@types/conventional-changelog-config-spec": "^2.1.5",
|
|
53
54
|
"@types/glob": "^7.2.0",
|
|
54
55
|
"@types/ini": "^1.3.34",
|
|
@@ -83,7 +84,6 @@
|
|
|
83
84
|
"constructs": "^10.0.0"
|
|
84
85
|
},
|
|
85
86
|
"dependencies": {
|
|
86
|
-
"@iarna/toml": "^2.2.5",
|
|
87
87
|
"case": "^1.6.3",
|
|
88
88
|
"chalk": "^4.1.2",
|
|
89
89
|
"comment-json": "4.2.2",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"fast-json-patch": "^3.1.1",
|
|
93
93
|
"glob": "^8",
|
|
94
94
|
"ini": "^2.0.0",
|
|
95
|
+
"json2toml": "^6.1.0",
|
|
95
96
|
"semver": "^7.6.0",
|
|
96
97
|
"shx": "^0.3.4",
|
|
97
98
|
"xmlbuilder2": "^3.1.1",
|
|
@@ -99,7 +100,6 @@
|
|
|
99
100
|
"yargs": "^17.7.2"
|
|
100
101
|
},
|
|
101
102
|
"bundledDependencies": [
|
|
102
|
-
"@iarna/toml",
|
|
103
103
|
"case",
|
|
104
104
|
"chalk",
|
|
105
105
|
"comment-json",
|
|
@@ -107,6 +107,7 @@
|
|
|
107
107
|
"fast-json-patch",
|
|
108
108
|
"glob",
|
|
109
109
|
"ini",
|
|
110
|
+
"json2toml",
|
|
110
111
|
"semver",
|
|
111
112
|
"shx",
|
|
112
113
|
"xmlbuilder2",
|
|
@@ -126,7 +127,7 @@
|
|
|
126
127
|
},
|
|
127
128
|
"main": "lib/index.js",
|
|
128
129
|
"license": "Apache-2.0",
|
|
129
|
-
"version": "0.80.
|
|
130
|
+
"version": "0.80.7",
|
|
130
131
|
"jest": {
|
|
131
132
|
"maxWorkers": "50%",
|
|
132
133
|
"testMatch": [
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2016, Rebecca Turner <me@re-becca.org>
|
|
2
|
-
|
|
3
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
4
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
5
|
-
copyright notice and this permission notice appear in all copies.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
8
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
9
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
10
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
11
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
12
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
13
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
-
|
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
# @iarna/toml
|
|
2
|
-
|
|
3
|
-
Better TOML parsing and stringifying all in that familiar JSON interface.
|
|
4
|
-
|
|
5
|
-
[](https://coveralls.io/github/iarna/iarna-toml)
|
|
6
|
-
|
|
7
|
-
# ** TOML 0.5.0 **
|
|
8
|
-
|
|
9
|
-
### TOML Spec Support
|
|
10
|
-
|
|
11
|
-
The most recent version as of 2018-07-26: [v0.5.0](https://github.com/mojombo/toml/blob/master/versions/en/toml-v0.5.0.md)
|
|
12
|
-
|
|
13
|
-
### Example
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
const TOML = require('@iarna/toml')
|
|
17
|
-
const obj = TOML.parse(`[abc]
|
|
18
|
-
foo = 123
|
|
19
|
-
bar = [1,2,3]`)
|
|
20
|
-
/* obj =
|
|
21
|
-
{abc: {foo: 123, bar: [1,2,3]}}
|
|
22
|
-
*/
|
|
23
|
-
const str = TOML.stringify(obj)
|
|
24
|
-
/* str =
|
|
25
|
-
[abc]
|
|
26
|
-
foo = 123
|
|
27
|
-
bar = [ 1, 2, 3 ]
|
|
28
|
-
*/
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Visit the project github [for more examples](https://github.com/iarna/iarna-toml/tree/latest/examples)!
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Why @iarna/toml
|
|
35
|
-
|
|
36
|
-
* See [TOML-SPEC-SUPPORT](https://shared.by.re-becca.org/misc/TOML-SPEC-SUPPORT.html)
|
|
37
|
-
for a comparison of which TOML features are supported by the various
|
|
38
|
-
Node.js TOML parsers.
|
|
39
|
-
* BigInt support on Node 10!
|
|
40
|
-
* 100% test coverage.
|
|
41
|
-
* Fast parsing. It's as much as 100 times
|
|
42
|
-
faster than `toml` and 3 times faster than `toml-j0.4`. However a recent
|
|
43
|
-
newcomer [`@ltd/j-toml`](https://www.npmjs.com/package/@ltd/j-toml) has
|
|
44
|
-
appeared with 0.5 support and astoundingly fast parsing speeds for large
|
|
45
|
-
text blocks. All I can say is you'll have to test your specific work loads
|
|
46
|
-
if you want to know which of @iarna/toml and @ltd/j-toml is faster for
|
|
47
|
-
you, as we currently excell in different areas.
|
|
48
|
-
* Careful adherence to spec. Tests go beyond simple coverage.
|
|
49
|
-
* Smallest parser bundle (if you use `@iarna/toml/parse-string`).
|
|
50
|
-
* No deps.
|
|
51
|
-
* Detailed and easy to read error messages‼
|
|
52
|
-
|
|
53
|
-
```console
|
|
54
|
-
> TOML.parse(src)
|
|
55
|
-
Error: Unexpected character, expecting string, number, datetime, boolean, inline array or inline table at row 6, col 5, pos 87:
|
|
56
|
-
5: "abc\"" = { abc=123,def="abc" }
|
|
57
|
-
6> foo=sdkfj
|
|
58
|
-
^
|
|
59
|
-
7:
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## TOML.parse(str) → Object [(example)](https://github.com/iarna/iarna-toml/blob/latest/examples/parse.js)
|
|
63
|
-
|
|
64
|
-
Also available with: `require('@iarna/toml/parse-string')`
|
|
65
|
-
|
|
66
|
-
Synchronously parse a TOML string and return an object.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## TOML.stringify(obj) → String [(example)](https://github.com/iarna/iarna-toml/blob/latest/examples/stringify.js)
|
|
70
|
-
|
|
71
|
-
Also available with: `require('@iarna/toml/stringify)`
|
|
72
|
-
|
|
73
|
-
Serialize an object as TOML.
|
|
74
|
-
|
|
75
|
-
## [your-object].toJSON
|
|
76
|
-
|
|
77
|
-
If an object `TOML.stringify` is serializing has a `toJSON` method then it
|
|
78
|
-
will call it to transform the object before serializing it. This matches
|
|
79
|
-
the behavior of `JSON.stringify`.
|
|
80
|
-
|
|
81
|
-
The one exception to this is that `toJSON` is not called for `Date` objects
|
|
82
|
-
because `JSON` represents dates as strings and TOML can represent them natively.
|
|
83
|
-
|
|
84
|
-
[`moment`](https://www.npmjs.com/package/moment) objects are treated the
|
|
85
|
-
same as native `Date` objects, in this respect.
|
|
86
|
-
|
|
87
|
-
## TOML.stringify.value(obj) -> String
|
|
88
|
-
|
|
89
|
-
Also available with: `require('@iarna/toml/stringify').value`
|
|
90
|
-
|
|
91
|
-
Serialize a value as TOML would. This is a fragment and not a complete
|
|
92
|
-
valid TOML document.
|
|
93
|
-
|
|
94
|
-
## Promises and Streaming
|
|
95
|
-
|
|
96
|
-
The parser provides alternative async and streaming interfaces, for times
|
|
97
|
-
that you're working with really absurdly big TOML files and don't want to
|
|
98
|
-
tie-up the event loop while it parses.
|
|
99
|
-
|
|
100
|
-
### TOML.parse.async(str[, opts]) → Promise(Object) [(example)](https://github.com/iarna/iarna-toml/blob/latest/examples/parse-async.js)
|
|
101
|
-
|
|
102
|
-
Also available with: `require('@iarna/toml/parse-async')`
|
|
103
|
-
|
|
104
|
-
`opts.blocksize` is the amount text to parser per pass through the event loop. Defaults to 40kb.
|
|
105
|
-
|
|
106
|
-
Asynchronously parse a TOML string and return a promise of the resulting object.
|
|
107
|
-
|
|
108
|
-
### TOML.parse.stream(readable) → Promise(Object) [(example)](https://github.com/iarna/iarna-toml/blob/latest/examples/parse-stream-readable.js)
|
|
109
|
-
|
|
110
|
-
Also available with: `require('@iarna/toml/parse-stream')`
|
|
111
|
-
|
|
112
|
-
Given a readable stream, parse it as it feeds us data. Return a promise of the resulting object.
|
|
113
|
-
|
|
114
|
-
### readable.pipe(TOML.parse.stream()) → Transform [(example)](https://github.com/iarna/iarna-toml/blob/latest/examples/parse-stream-through.js)
|
|
115
|
-
|
|
116
|
-
Also available with: `require('@iarna/toml/parse-stream')`
|
|
117
|
-
|
|
118
|
-
Returns a transform stream in object mode. When it completes, emit the
|
|
119
|
-
resulting object. Only one object will ever be emitted.
|
|
120
|
-
|
|
121
|
-
## Lowlevel Interface [(example)](https://github.com/iarna/iarna-toml/blob/latest/examples/parse-lowlevel.js) [(example w/ parser debugging)](https://github.com/iarna/iarna-toml/blob/latest/examples/parse-lowlevel-debug.js)
|
|
122
|
-
|
|
123
|
-
You construct a parser object, per TOML file you want to process:
|
|
124
|
-
|
|
125
|
-
```js
|
|
126
|
-
const TOMLParser = require('@iarna/toml/lib/toml-parser.js')
|
|
127
|
-
const parser = new TOMLParser()
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
Then you call the `parse` method for each chunk as you read them, or in a
|
|
131
|
-
single call:
|
|
132
|
-
|
|
133
|
-
```js
|
|
134
|
-
parser.parse(`hello = 'world'`)
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
And finally, you call the `finish` method to complete parsing and retrieve
|
|
138
|
-
the resulting object.
|
|
139
|
-
|
|
140
|
-
```js
|
|
141
|
-
const data = parser.finish()
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
Both the `parse` method and `finish` method will throw if they find a
|
|
145
|
-
problem with the string they were given. Error objects thrown from the
|
|
146
|
-
parser have `pos`, `line` and `col` attributes. `TOML.parse` adds a visual
|
|
147
|
-
summary of where in the source string there were issues using
|
|
148
|
-
`parse-pretty-error` and you can too:
|
|
149
|
-
|
|
150
|
-
```js
|
|
151
|
-
const prettyError = require('./parse-pretty-error.js')
|
|
152
|
-
const newErr = prettyError(err, sourceString)
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
## What's Different
|
|
156
|
-
|
|
157
|
-
Version 2 of this module supports TOML 0.5.0. Other modules currently
|
|
158
|
-
published to the npm registry support 0.4.0. 0.5.0 is mostly backwards
|
|
159
|
-
compatible with 0.4.0, but if you have need, you can install @iarna/toml@1
|
|
160
|
-
to get a version of this module that supports 0.4.0. Please see the
|
|
161
|
-
[CHANGELOG](CHANGELOG.md#2.0.0) for details on exactly whats changed.
|
|
162
|
-
|
|
163
|
-
## TOML we can't do
|
|
164
|
-
|
|
165
|
-
* `-nan` is a valid TOML value and is converted into `NaN`. There is no way to
|
|
166
|
-
produce `-nan` when stringifying. Stringification will produce positive `nan`.
|
|
167
|
-
* Detecting and erroring on invalid utf8 documents: This is because Node's
|
|
168
|
-
UTF8 processing converts invalid sequences into the placeholder character
|
|
169
|
-
and does not have facilities for reporting these as errors instead. We
|
|
170
|
-
_can_ detect the placeholder character, but it's valid to intentionally
|
|
171
|
-
include them in documents, so erroring on them is not great.
|
|
172
|
-
* On versions of Node < 10, very large Integer values will lose precision.
|
|
173
|
-
On Node >=10, bigints are used.
|
|
174
|
-
* Floating/local dates and times are still represented by JavaScript Date
|
|
175
|
-
objects, which don't actually support these concepts. The objects
|
|
176
|
-
returned have been modified so that you can determine what kind of thing
|
|
177
|
-
they are (with `isFloating`, `isDate`, `isTime` properties) and that
|
|
178
|
-
their ISO representation (via `toISOString`) is representative of their
|
|
179
|
-
TOML value. They will correctly round trip if you pass them to
|
|
180
|
-
`TOML.stringify`.
|
|
181
|
-
* Binary, hexadecimal and octal values are converted to ordinary integers and
|
|
182
|
-
will be decimal if you stringify them.
|
|
183
|
-
|
|
184
|
-
## Changes
|
|
185
|
-
|
|
186
|
-
I write a by hand, honest-to-god,
|
|
187
|
-
[CHANGELOG](https://github.com/iarna/iarna-toml/blob/latest/CHANGELOG.md)
|
|
188
|
-
for this project. It's a description of what went into a release that you
|
|
189
|
-
the consumer of the module could care about, not a list of git commits, so
|
|
190
|
-
please check it out!
|
|
191
|
-
|
|
192
|
-
## Benchmarks
|
|
193
|
-
|
|
194
|
-
You can run them yourself with:
|
|
195
|
-
|
|
196
|
-
```console
|
|
197
|
-
$ npm run benchmark
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
The results below are from my desktop using Node 13.13.0. The library
|
|
201
|
-
versions tested were `@iarna/toml@2.2.4`, `toml-j0.4@1.1.1`, `toml@3.0.0`,
|
|
202
|
-
`@sgarciac/bombadil@2.3.0`, `@ltd/j-toml@0.5.107`, and `fast-toml@0.5.4`. The speed value is
|
|
203
|
-
megabytes-per-second that the parser can process of that document type.
|
|
204
|
-
Bigger is better. The percentage after average results is the margin of error.
|
|
205
|
-
|
|
206
|
-
New here is fast-toml. fast-toml is very fast, for some datatypes, but it
|
|
207
|
-
also is missing most error checking demanded by the spec. For 0.4, it is
|
|
208
|
-
complete except for detail of multiline strings caught by the compliance
|
|
209
|
-
tests. Its support for 0.5 is incomplete. Check out the
|
|
210
|
-
[spec compliance](https://shared.by.re-becca.org/misc/TOML-SPEC-SUPPORT.html) doc
|
|
211
|
-
for details.
|
|
212
|
-
|
|
213
|
-
As this table is getting a little wide, with how npm and github display it,
|
|
214
|
-
you can also view it seperately in the
|
|
215
|
-
[BENCHMARK](https://shared.by.re-becca.org/misc/BENCHMARK.html) document.
|
|
216
|
-
|
|
217
|
-
| | @iarna/<wbr>toml | toml-j0.4 | toml | @sgarciac/<wbr>bombadil | @ltd/<wbr>j-toml | fast-toml |
|
|
218
|
-
| - | :---------: | :-------: | :--: | :----------------: | :---------: | :-------: |
|
|
219
|
-
| **Overall** | 28MB/sec<br><small>0.35%</small> | 6.5MB/sec<br><small>0.25%</small> | 0.2MB/sec<br><small>0.70%</small> | - | 35MB/sec<br><small>0.23%</small> | - |
|
|
220
|
-
| **Spec Example: v0.4.0** | 26MB/sec<br><small>0.37%</small> | 10MB/sec<br><small>0.27%</small> | 1MB/sec<br><small>0.42%</small> | 1.2MB/sec<br><small>0.95%</small> | 28MB/sec<br><small>0.31%</small> | - |
|
|
221
|
-
| **Spec Example: Hard Unicode** | 64MB/sec<br><small>0.59%</small> | 18MB/sec<br><small>0.12%</small> | 2MB/sec<br><small>0.20%</small> | 0.6MB/sec<br><small>0.53%</small> | 68MB/sec<br><small>0.31%</small> | 78MB/sec<br><small>0.28%</small> |
|
|
222
|
-
| **Types: Array, Inline** | 7.3MB/sec<br><small>0.60%</small> | 4MB/sec<br><small>0.16%</small> | 0.1MB/sec<br><small>0.91%</small> | 1.3MB/sec<br><small>0.81%</small> | 10MB/sec<br><small>0.35%</small> | 9MB/sec<br><small>0.16%</small> |
|
|
223
|
-
| **Types: Array** | 6.8MB/sec<br><small>0.19%</small> | 6.7MB/sec<br><small>0.15%</small> | 0.2MB/sec<br><small>0.79%</small> | 1.2MB/sec<br><small>0.93%</small> | 8.8MB/sec<br><small>0.47%</small> | 27MB/sec<br><small>0.21%</small> |
|
|
224
|
-
| **Types: Boolean,** | 21MB/sec<br><small>0.20%</small> | 9.4MB/sec<br><small>0.17%</small> | 0.2MB/sec<br><small>0.96%</small> | 1.8MB/sec<br><small>0.70%</small> | 16MB/sec<br><small>0.20%</small> | 8.4MB/sec<br><small>0.22%</small> |
|
|
225
|
-
| **Types: Datetime** | 18MB/sec<br><small>0.14%</small> | 11MB/sec<br><small>0.15%</small> | 0.3MB/sec<br><small>0.85%</small> | 1.6MB/sec<br><small>0.45%</small> | 9.8MB/sec<br><small>0.48%</small> | 6.5MB/sec<br><small>0.23%</small> |
|
|
226
|
-
| **Types: Float** | 8.8MB/sec<br><small>0.09%</small> | 5.9MB/sec<br><small>0.14%</small> | 0.2MB/sec<br><small>0.51%</small> | 2.1MB/sec<br><small>0.82%</small> | 14MB/sec<br><small>0.15%</small> | 7.9MB/sec<br><small>0.14%</small> |
|
|
227
|
-
| **Types: Int** | 5.9MB/sec<br><small>0.11%</small> | 4.5MB/sec<br><small>0.28%</small> | 0.1MB/sec<br><small>0.78%</small> | 1.5MB/sec<br><small>0.64%</small> | 10MB/sec<br><small>0.14%</small> | 8MB/sec<br><small>0.17%</small> |
|
|
228
|
-
| **Types: Literal String, 7 char** | 26MB/sec<br><small>0.29%</small> | 8.5MB/sec<br><small>0.32%</small> | 0.3MB/sec<br><small>0.84%</small> | 2.3MB/sec<br><small>1.02%</small> | 23MB/sec<br><small>0.15%</small> | 13MB/sec<br><small>0.15%</small> |
|
|
229
|
-
| **Types: Literal String, 92 char** | 46MB/sec<br><small>0.19%</small> | 11MB/sec<br><small>0.20%</small> | 0.3MB/sec<br><small>0.56%</small> | 12MB/sec<br><small>0.92%</small> | 101MB/sec<br><small>0.17%</small> | 75MB/sec<br><small>0.29%</small> |
|
|
230
|
-
| **Types: Literal String, Multiline, 1079 char** | 22MB/sec<br><small>0.42%</small> | 6.7MB/sec<br><small>0.55%</small> | 0.9MB/sec<br><small>0.78%</small> | 44MB/sec<br><small>1.00%</small> | 350MB/sec<br><small>0.16%</small> | 636MB/sec<br><small>0.16%</small> |
|
|
231
|
-
| **Types: Basic String, 7 char** | 25MB/sec<br><small>0.15%</small> | 7.3MB/sec<br><small>0.18%</small> | 0.2MB/sec<br><small>0.96%</small> | 2.2MB/sec<br><small>1.09%</small> | 14MB/sec<br><small>0.16%</small> | 12MB/sec<br><small>0.22%</small> |
|
|
232
|
-
| **Types: Basic String, 92 char** | 43MB/sec<br><small>0.30%</small> | 7.2MB/sec<br><small>0.16%</small> | 0.1MB/sec<br><small>4.04%</small> | 12MB/sec<br><small>1.33%</small> | 71MB/sec<br><small>0.19%</small> | 70MB/sec<br><small>0.23%</small> |
|
|
233
|
-
| **Types: Basic String, 1079 char** | 24MB/sec<br><small>0.45%</small> | 5.8MB/sec<br><small>0.17%</small> | 0.1MB/sec<br><small>3.64%</small> | 44MB/sec<br><small>1.05%</small> | 93MB/sec<br><small>0.29%</small> | 635MB/sec<br><small>0.28%</small> |
|
|
234
|
-
| **Types: Table, Inline** | 9.7MB/sec<br><small>0.10%</small> | 5.5MB/sec<br><small>0.22%</small> | 0.1MB/sec<br><small>0.87%</small> | 1.4MB/sec<br><small>1.18%</small> | 8.7MB/sec<br><small>0.60%</small> | 8.7MB/sec<br><small>0.22%</small> |
|
|
235
|
-
| **Types: Table** | 7.1MB/sec<br><small>0.14%</small> | 5.6MB/sec<br><small>0.42%</small> | 0.1MB/sec<br><small>0.65%</small> | 1.4MB/sec<br><small>1.11%</small> | 7.4MB/sec<br><small>0.70%</small> | 18MB/sec<br><small>0.20%</small> |
|
|
236
|
-
| **Scaling: Array, Inline, 1000 elements** | 40MB/sec<br><small>0.21%</small> | 2.4MB/sec<br><small>0.19%</small> | 0.1MB/sec<br><small>0.35%</small> | 1.6MB/sec<br><small>1.02%</small> | 17MB/sec<br><small>0.15%</small> | 32MB/sec<br><small>0.16%</small> |
|
|
237
|
-
| **Scaling: Array, Nested, 1000 deep** | 2MB/sec<br><small>0.15%</small> | 1.7MB/sec<br><small>0.26%</small> | 0.3MB/sec<br><small>0.58%</small> | - | 1.8MB/sec<br><small>0.74%</small> | 13MB/sec<br><small>0.20%</small> |
|
|
238
|
-
| **Scaling: Literal String, 40kb** | 61MB/sec<br><small>0.18%</small> | 10MB/sec<br><small>0.15%</small> | 3MB/sec<br><small>0.84%</small> | 12MB/sec<br><small>0.51%</small> | 551MB/sec<br><small>0.44%</small> | 19kMB/sec<br><small>0.19%</small> |
|
|
239
|
-
| **Scaling: Literal String, Multiline, 40kb** | 62MB/sec<br><small>0.16%</small> | 5MB/sec<br><small>0.45%</small> | 0.2MB/sec<br><small>1.70%</small> | 11MB/sec<br><small>0.74%</small> | 291MB/sec<br><small>0.24%</small> | 21kMB/sec<br><small>0.22%</small> |
|
|
240
|
-
| **Scaling: Basic String, Multiline, 40kb** | 62MB/sec<br><small>0.18%</small> | 5.8MB/sec<br><small>0.38%</small> | 2.9MB/sec<br><small>0.86%</small> | 11MB/sec<br><small>0.41%</small> | 949MB/sec<br><small>0.44%</small> | 26kMB/sec<br><small>0.16%</small> |
|
|
241
|
-
| **Scaling: Basic String, 40kb** | 59MB/sec<br><small>0.20%</small> | 6.3MB/sec<br><small>0.17%</small> | 0.2MB/sec<br><small>1.95%</small> | 12MB/sec<br><small>0.44%</small> | 508MB/sec<br><small>0.35%</small> | 18kMB/sec<br><small>0.15%</small> |
|
|
242
|
-
| **Scaling: Table, Inline, 1000 elements** | 28MB/sec<br><small>0.12%</small> | 8.2MB/sec<br><small>0.19%</small> | 0.3MB/sec<br><small>0.89%</small> | 2.3MB/sec<br><small>1.14%</small> | 5.3MB/sec<br><small>0.24%</small> | 13MB/sec<br><small>0.20%</small> |
|
|
243
|
-
| **Scaling: Table, Inline, Nested, 1000 deep** | 7.8MB/sec<br><small>0.28%</small> | 5MB/sec<br><small>0.20%</small> | 0.1MB/sec<br><small>0.84%</small> | - | 3.2MB/sec<br><small>0.52%</small> | 10MB/sec<br><small>0.23%</small> |
|
|
244
|
-
|
|
245
|
-
## Tests
|
|
246
|
-
|
|
247
|
-
The test suite is maintained at 100% coverage: [](https://coveralls.io/github/iarna/iarna-toml)
|
|
248
|
-
|
|
249
|
-
The spec was carefully hand converted into a series of test framework
|
|
250
|
-
independent (and mostly language independent) assertions, as pairs of TOML
|
|
251
|
-
and YAML files. You can find those files here:
|
|
252
|
-
[spec-test](https://github.com/iarna/iarna-toml/blob/latest/test/spec-test/).
|
|
253
|
-
A number of examples of invalid Unicode were also written, but are difficult
|
|
254
|
-
to make use of in Node.js where Unicode errors are silently hidden. You can
|
|
255
|
-
find those here: [spec-test-disabled](https://github.com/iarna/iarna-toml/blob/latest/test/spec-test-disabled/).
|
|
256
|
-
|
|
257
|
-
Further tests were written to increase coverage to 100%, these may be more
|
|
258
|
-
implementation specific, but they can be found in [coverage](https://github.com/iarna/iarna-toml/blob/latest/test/coverage.js) and
|
|
259
|
-
[coverage-error](https://github.com/iarna/iarna-toml/blob/latest/test/coverage-error.js).
|
|
260
|
-
|
|
261
|
-
I've also written some quality assurance style tests, which don't contribute
|
|
262
|
-
to coverage but do cover scenarios that could easily be problematic for some
|
|
263
|
-
implementations can be found in:
|
|
264
|
-
[test/qa.js](https://github.com/iarna/iarna-toml/blob/latest/test/qa.js) and
|
|
265
|
-
[test/qa-error.js](https://github.com/iarna/iarna-toml/blob/latest/test/qa-error.js).
|
|
266
|
-
|
|
267
|
-
All of the official example files from the TOML spec are run through this
|
|
268
|
-
parser and compared to the official YAML files when available. These files are from the TOML spec as of:
|
|
269
|
-
[357a4ba6](https://github.com/toml-lang/toml/tree/357a4ba6782e48ff26e646780bab11c90ed0a7bc)
|
|
270
|
-
and specifically are:
|
|
271
|
-
|
|
272
|
-
* [github.com/toml-lang/toml/tree/357a4ba6/examples](https://github.com/toml-lang/toml/tree/357a4ba6782e48ff26e646780bab11c90ed0a7bc/examples)
|
|
273
|
-
* [github.com/toml-lang/toml/tree/357a4ba6/tests](https://github.com/toml-lang/toml/tree/357a4ba6782e48ff26e646780bab11c90ed0a7bc/tests)
|
|
274
|
-
|
|
275
|
-
The stringifier is tested by round-tripping these same files, asserting that
|
|
276
|
-
`TOML.parse(sourcefile)` deepEqual
|
|
277
|
-
`TOML.parse(TOML.stringify(TOML.parse(sourcefile))`. This is done in
|
|
278
|
-
[test/roundtrip-examples.js](https://github.com/iarna/iarna-toml/blob/latest/test/round-tripping.js)
|
|
279
|
-
There are also some tests written to complete coverage from stringification in:
|
|
280
|
-
[test/stringify.js](https://github.com/iarna/iarna-toml/blob/latest/test/stringify.js)
|
|
281
|
-
|
|
282
|
-
Tests for the async and streaming interfaces are in [test/async.js](https://github.com/iarna/iarna-toml/blob/latest/test/async.js) and [test/stream.js](https://github.com/iarna/iarna-toml/blob/latest/test/stream.js) respectively.
|
|
283
|
-
|
|
284
|
-
Tests for the parsers debugging mode live in [test/devel.js](https://github.com/iarna/iarna-toml/blob/latest/test/devel.js).
|
|
285
|
-
|
|
286
|
-
And finally, many more stringification tests were borrowed from [@othiym23](https://github.com/othiym23)'s
|
|
287
|
-
[toml-stream](https://npmjs.com/package/toml-stream) module. They were fetched as of
|
|
288
|
-
[b6f1e26b572d49742d49fa6a6d11524d003441fa](https://github.com/othiym23/toml-stream/tree/b6f1e26b572d49742d49fa6a6d11524d003441fa/test) and live in
|
|
289
|
-
[test/toml-stream](https://github.com/iarna/iarna-toml/blob/latest/test/toml-stream/).
|
|
290
|
-
|
|
291
|
-
## Improvements to make
|
|
292
|
-
|
|
293
|
-
* In stringify:
|
|
294
|
-
* Any way to produce comments. As a JSON stand-in I'm not too worried
|
|
295
|
-
about this. That said, a document orientated fork is something I'd like
|
|
296
|
-
to look at eventually…
|
|
297
|
-
* Stringification could use some work on its error reporting. It reports
|
|
298
|
-
_what's_ wrong, but not where in your data structure it was.
|
|
299
|
-
* Further optimize the parser:
|
|
300
|
-
* There are some debugging assertions left in the main parser, these should be moved to a subclass.
|
|
301
|
-
* Make the whole debugging parser thing work as a mixin instead of as a superclass.
|