protobufjs 6.8.8 → 6.8.9

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 (104) hide show
  1. package/LICENSE +39 -39
  2. package/README.md +879 -879
  3. package/cli/LICENSE +33 -33
  4. package/cli/README.md +11 -11
  5. package/cli/index.d.ts +3 -3
  6. package/cli/index.js +3 -3
  7. package/cli/lib/tsd-jsdoc/LICENSE +20 -20
  8. package/cli/lib/tsd-jsdoc/README.md +23 -23
  9. package/cli/lib/tsd-jsdoc/plugin.js +21 -21
  10. package/cli/lib/tsd-jsdoc/publish.js +693 -693
  11. package/cli/lib/tsd-jsdoc.json +18 -18
  12. package/cli/package.standalone.json +31 -31
  13. package/cli/pbjs.d.ts +9 -9
  14. package/cli/pbjs.js +329 -329
  15. package/cli/pbts.d.ts +9 -9
  16. package/cli/pbts.js +197 -197
  17. package/cli/targets/json-module.js +38 -38
  18. package/cli/targets/json.js +8 -8
  19. package/cli/targets/proto.js +326 -326
  20. package/cli/targets/proto2.js +10 -10
  21. package/cli/targets/proto3.js +10 -10
  22. package/cli/targets/static-module.js +29 -29
  23. package/cli/targets/static.js +702 -702
  24. package/cli/util.js +183 -183
  25. package/cli/wrappers/amd.js +7 -7
  26. package/cli/wrappers/closure.js +7 -7
  27. package/cli/wrappers/commonjs.js +7 -7
  28. package/cli/wrappers/default.js +15 -15
  29. package/cli/wrappers/es6.js +5 -5
  30. package/dist/README.md +31 -31
  31. package/dist/light/README.md +31 -31
  32. package/dist/light/protobuf.js +6030 -6030
  33. package/dist/light/protobuf.js.map +1 -1
  34. package/dist/light/protobuf.min.js +1 -1
  35. package/dist/light/protobuf.min.js.map +1 -1
  36. package/dist/minimal/README.md +31 -31
  37. package/dist/minimal/protobuf.js +1876 -1876
  38. package/dist/minimal/protobuf.js.map +1 -1
  39. package/dist/minimal/protobuf.min.js +1 -1
  40. package/dist/minimal/protobuf.min.js.map +1 -1
  41. package/dist/protobuf.js +7595 -7595
  42. package/dist/protobuf.js.map +1 -1
  43. package/dist/protobuf.min.js +1 -1
  44. package/dist/protobuf.min.js.map +1 -1
  45. package/ext/debug/README.md +4 -4
  46. package/ext/debug/index.js +71 -71
  47. package/ext/descriptor/README.md +72 -72
  48. package/ext/descriptor/index.js +1052 -1052
  49. package/ext/descriptor/test.js +54 -54
  50. package/google/LICENSE +27 -27
  51. package/google/README.md +1 -1
  52. package/google/api/annotations.proto +10 -10
  53. package/google/protobuf/descriptor.proto +286 -286
  54. package/google/protobuf/source_context.proto +7 -7
  55. package/index.js +4 -4
  56. package/light.d.ts +2 -2
  57. package/light.js +3 -3
  58. package/minimal.d.ts +2 -2
  59. package/minimal.js +4 -4
  60. package/package-lock.json +1748 -642
  61. package/package.json +119 -122
  62. package/scripts/changelog.js +150 -150
  63. package/scripts/postinstall.js +35 -35
  64. package/src/common.js +399 -399
  65. package/src/converter.js +293 -293
  66. package/src/decoder.js +106 -106
  67. package/src/encoder.js +99 -99
  68. package/src/enum.js +181 -181
  69. package/src/field.js +371 -371
  70. package/src/index-light.js +104 -104
  71. package/src/index-minimal.js +36 -36
  72. package/src/index.js +12 -12
  73. package/src/mapfield.js +126 -126
  74. package/src/message.js +138 -138
  75. package/src/method.js +151 -151
  76. package/src/namespace.js +433 -433
  77. package/src/object.js +200 -200
  78. package/src/oneof.js +203 -203
  79. package/src/parse.js +758 -758
  80. package/src/reader.js +405 -405
  81. package/src/reader_buffer.js +44 -44
  82. package/src/root.js +351 -351
  83. package/src/roots.js +18 -18
  84. package/src/rpc/service.js +142 -142
  85. package/src/rpc.js +36 -36
  86. package/src/service.js +167 -167
  87. package/src/tokenize.js +397 -397
  88. package/src/type.js +589 -589
  89. package/src/types.js +196 -196
  90. package/src/typescript.jsdoc +15 -15
  91. package/src/util/longbits.js +200 -200
  92. package/src/util/minimal.js +414 -414
  93. package/src/util.js +178 -178
  94. package/src/verifier.js +176 -176
  95. package/src/wrappers.js +83 -83
  96. package/src/writer.js +459 -459
  97. package/src/writer_buffer.js +81 -81
  98. package/tsconfig.json +6 -6
  99. package/cli/node_modules/os-tmpdir/index.js +0 -25
  100. package/cli/node_modules/os-tmpdir/license +0 -21
  101. package/cli/node_modules/os-tmpdir/readme.md +0 -32
  102. package/cli/node_modules/tmp/LICENSE +0 -21
  103. package/cli/node_modules/tmp/README.md +0 -314
  104. package/cli/node_modules/tmp/lib/tmp.js +0 -611
package/package.json CHANGED
@@ -1,122 +1,119 @@
1
- {
2
- "name": "protobufjs",
3
- "version": "6.8.8",
4
- "versionScheme": "~",
5
- "description": "Protocol Buffers for JavaScript (& TypeScript).",
6
- "author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
7
- "license": "BSD-3-Clause",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/dcodeIO/protobuf.js.git"
11
- },
12
- "bugs": "https://github.com/dcodeIO/protobuf.js/issues",
13
- "homepage": "http://dcode.io/protobuf.js",
14
- "keywords": [
15
- "protobuf",
16
- "protocol-buffers",
17
- "serialization",
18
- "typescript"
19
- ],
20
- "main": "index.js",
21
- "types": "index.d.ts",
22
- "bin": {
23
- "pbjs": "bin/pbjs",
24
- "pbts": "bin/pbts"
25
- },
26
- "scripts": {
27
- "bench": "node bench",
28
- "build": "gulp --gulpfile scripts/gulpfile.js",
29
- "changelog": "node scripts/changelog -w",
30
- "coverage": "istanbul --config=config/istanbul.json cover node_modules/tape/bin/tape tests/*.js tests/node/*.js",
31
- "docs": "jsdoc -c config/jsdoc.json -R README.md --verbose --pedantic",
32
- "lint": "eslint **/*.js -c config/eslint.json && tslint **/*.d.ts -e **/node_modules/** -t stylish -c config/tslint.json",
33
- "pages": "node scripts/pages",
34
- "prepublish": "node scripts/prepublish",
35
- "postinstall": "node scripts/postinstall",
36
- "prof": "node bench/prof",
37
- "test": "tape -r ./lib/tape-adapter tests/*.js tests/node/*.js",
38
- "test-types": "tsc tests/comp_typescript.ts --lib es2015 --strictNullChecks --experimentalDecorators --emitDecoratorMetadata && tsc tests/data/test.js.ts --lib es2015 --noEmit --strictNullChecks && tsc tests/data/rpc.ts --lib es2015 --noEmit --strictNullChecks",
39
- "types": "node bin/pbts --main --global protobuf --out index.d.ts src/ lib/aspromise/index.js lib/base64/index.js lib/codegen/index.js lib/eventemitter/index.js lib/float/index.js lib/fetch/index.js lib/inquire/index.js lib/path/index.js lib/pool/index.js lib/utf8/index.js && npm run test-types",
40
- "make": "npm run test && npm run types && npm run build && npm run lint",
41
- "release": "npm run make && npm run changelog"
42
- },
43
- "dependencies": {
44
- "@protobufjs/aspromise": "^1.1.2",
45
- "@protobufjs/base64": "^1.1.2",
46
- "@protobufjs/codegen": "^2.0.4",
47
- "@protobufjs/eventemitter": "^1.1.0",
48
- "@protobufjs/fetch": "^1.1.0",
49
- "@protobufjs/float": "^1.0.2",
50
- "@protobufjs/inquire": "^1.1.0",
51
- "@protobufjs/path": "^1.1.2",
52
- "@protobufjs/pool": "^1.1.0",
53
- "@protobufjs/utf8": "^1.1.0",
54
- "@types/long": "^4.0.0",
55
- "@types/node": "^10.1.0",
56
- "long": "^4.0.0"
57
- },
58
- "devDependencies": {
59
- "benchmark": "^2.1.4",
60
- "browserify": "^16.2.2",
61
- "browserify-wrap": "^1.0.2",
62
- "bundle-collapser": "^1.3.0",
63
- "chalk": "^2.4.1",
64
- "escodegen": "^1.9.1",
65
- "eslint": "^4.19.1",
66
- "espree": "^3.5.4",
67
- "estraverse": "^4.2.0",
68
- "gh-pages": "^1.1.0",
69
- "git-raw-commits": "^1.3.6",
70
- "git-semver-tags": "^1.3.6",
71
- "glob": "^7.1.2",
72
- "google-protobuf": "^3.5.0",
73
- "gulp": "^4.0.0",
74
- "gulp-header": "^2.0.5",
75
- "gulp-if": "^2.0.1",
76
- "gulp-sourcemaps": "^2.6.4",
77
- "gulp-uglify": "^3.0.0",
78
- "istanbul": "^0.4.5",
79
- "jaguarjs-jsdoc": "github:dcodeIO/jaguarjs-jsdoc",
80
- "jsdoc": "^3.5.5",
81
- "minimist": "^1.2.0",
82
- "reflect-metadata": "^0.1.12",
83
- "semver": "^5.5.0",
84
- "tape": "^4.9.0",
85
- "tmp": "0.0.33",
86
- "tslint": "^5.10.0",
87
- "typescript": "^2.8.3",
88
- "uglify-js": "^3.3.25",
89
- "vinyl-buffer": "^1.0.1",
90
- "vinyl-fs": "^3.0.3",
91
- "vinyl-source-stream": "^2.0.0"
92
- },
93
- "cliDependencies": [
94
- "semver",
95
- "chalk",
96
- "glob",
97
- "jsdoc",
98
- "minimist",
99
- "tmp",
100
- "uglify-js",
101
- "espree",
102
- "escodegen",
103
- "estraverse"
104
- ],
105
- "files": [
106
- "index.js",
107
- "index.d.ts",
108
- "light.d.ts",
109
- "light.js",
110
- "minimal.d.ts",
111
- "minimal.js",
112
- "package-lock.json",
113
- "tsconfig.json",
114
- "scripts/postinstall.js",
115
- "bin/**",
116
- "cli/**",
117
- "dist/**",
118
- "ext/**",
119
- "google/**",
120
- "src/**"
121
- ]
122
- }
1
+ {
2
+ "name": "protobufjs",
3
+ "version": "6.8.9",
4
+ "versionScheme": "~",
5
+ "description": "Protocol Buffers for JavaScript (& TypeScript).",
6
+ "author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
7
+ "license": "BSD-3-Clause",
8
+ "repository": "protobufjs/protobuf.js",
9
+ "bugs": "https://github.com/dcodeIO/protobuf.js/issues",
10
+ "homepage": "http://dcode.io/protobuf.js",
11
+ "keywords": [
12
+ "protobuf",
13
+ "protocol-buffers",
14
+ "serialization",
15
+ "typescript"
16
+ ],
17
+ "main": "index.js",
18
+ "types": "index.d.ts",
19
+ "bin": {
20
+ "pbjs": "bin/pbjs",
21
+ "pbts": "bin/pbts"
22
+ },
23
+ "scripts": {
24
+ "bench": "node bench",
25
+ "build": "gulp --gulpfile scripts/gulpfile.js",
26
+ "changelog": "node scripts/changelog -w",
27
+ "coverage": "nyc tape -r ./lib/tape-adapter tests/*.js tests/node/*.js",
28
+ "docs": "jsdoc -c config/jsdoc.json -R README.md --verbose --pedantic",
29
+ "lint": "eslint **/*.js -c config/eslint.json && tslint **/*.d.ts -e **/node_modules/** -t stylish -c config/tslint.json",
30
+ "pages": "node scripts/pages",
31
+ "prepublish": "node scripts/prepublish",
32
+ "postinstall": "node scripts/postinstall",
33
+ "prof": "node bench/prof",
34
+ "test": "tape -r ./lib/tape-adapter tests/*.js tests/node/*.js",
35
+ "test-types": "tsc tests/comp_typescript.ts --lib es2015 --strictNullChecks --experimentalDecorators --emitDecoratorMetadata && tsc tests/data/test.js.ts --lib es2015 --noEmit --strictNullChecks && tsc tests/data/rpc.ts --lib es2015 --noEmit --strictNullChecks",
36
+ "types": "node bin/pbts --main --global protobuf --out index.d.ts src/ lib/aspromise/index.js lib/base64/index.js lib/codegen/index.js lib/eventemitter/index.js lib/float/index.js lib/fetch/index.js lib/inquire/index.js lib/path/index.js lib/pool/index.js lib/utf8/index.js && npm run test-types",
37
+ "make": "npm run test && npm run types && npm run build && npm run lint",
38
+ "release": "npm run make && npm run changelog"
39
+ },
40
+ "dependencies": {
41
+ "@protobufjs/aspromise": "^1.1.2",
42
+ "@protobufjs/base64": "^1.1.2",
43
+ "@protobufjs/codegen": "^2.0.4",
44
+ "@protobufjs/eventemitter": "^1.1.0",
45
+ "@protobufjs/fetch": "^1.1.0",
46
+ "@protobufjs/float": "^1.0.2",
47
+ "@protobufjs/inquire": "^1.1.0",
48
+ "@protobufjs/path": "^1.1.2",
49
+ "@protobufjs/pool": "^1.1.0",
50
+ "@protobufjs/utf8": "^1.1.0",
51
+ "@types/long": "^4.0.0",
52
+ "@types/node": "^10.1.0",
53
+ "long": "^4.0.0"
54
+ },
55
+ "devDependencies": {
56
+ "benchmark": "^2.1.4",
57
+ "browserify": "^16.2.2",
58
+ "browserify-wrap": "^1.0.2",
59
+ "bundle-collapser": "^1.3.0",
60
+ "chalk": "^2.4.1",
61
+ "escodegen": "^1.9.1",
62
+ "eslint": "^4.19.1",
63
+ "espree": "^3.5.4",
64
+ "estraverse": "^4.2.0",
65
+ "gh-pages": "^2.2.0",
66
+ "git-raw-commits": "^1.3.6",
67
+ "git-semver-tags": "^1.3.6",
68
+ "glob": "^7.1.2",
69
+ "google-protobuf": "^3.5.0",
70
+ "gulp": "^4.0.2",
71
+ "gulp-header": "^2.0.5",
72
+ "gulp-if": "^2.0.1",
73
+ "gulp-sourcemaps": "^2.6.4",
74
+ "gulp-uglify": "^3.0.0",
75
+ "jaguarjs-jsdoc": "github:dcodeIO/jaguarjs-jsdoc",
76
+ "jsdoc": "^3.6.3",
77
+ "minimist": "^1.2.0",
78
+ "nyc": "^15.0.0",
79
+ "reflect-metadata": "^0.1.12",
80
+ "semver": "^5.5.0",
81
+ "tape": "^4.9.0",
82
+ "tmp": "0.0.33",
83
+ "tslint": "^5.10.0",
84
+ "typescript": "^2.8.3",
85
+ "uglify-js": "^3.3.25",
86
+ "vinyl-buffer": "^1.0.1",
87
+ "vinyl-fs": "^3.0.3",
88
+ "vinyl-source-stream": "^2.0.0"
89
+ },
90
+ "cliDependencies": [
91
+ "semver",
92
+ "chalk",
93
+ "glob",
94
+ "jsdoc",
95
+ "minimist",
96
+ "tmp",
97
+ "uglify-js",
98
+ "espree",
99
+ "escodegen",
100
+ "estraverse"
101
+ ],
102
+ "files": [
103
+ "index.js",
104
+ "index.d.ts",
105
+ "light.d.ts",
106
+ "light.js",
107
+ "minimal.d.ts",
108
+ "minimal.js",
109
+ "package-lock.json",
110
+ "tsconfig.json",
111
+ "scripts/postinstall.js",
112
+ "bin/**",
113
+ "cli/**",
114
+ "dist/**",
115
+ "ext/**",
116
+ "google/**",
117
+ "src/**"
118
+ ]
119
+ }
@@ -1,150 +1,150 @@
1
- "use strict";
2
-
3
- var path = require("path"),
4
- fs = require("fs");
5
-
6
- var gitSemverTags = require("git-semver-tags"),
7
- gitRawCommits = require("git-raw-commits"),
8
- minimist = require("minimist");
9
-
10
- var basedir = path.join(__dirname, "..");
11
- var pkg = require(basedir + "/package.json");
12
-
13
- var argv = minimist(process.argv, {
14
- alias: {
15
- tag : "t",
16
- write : "w"
17
- },
18
- string: [ "tag" ],
19
- boolean: [ "write" ],
20
- default: {
21
- tag: null,
22
- write: false
23
- }
24
- });
25
-
26
- // categories to be used in the future and regexes for lazy / older subjects
27
- var validCategories = {
28
- "Breaking": null,
29
- "Fixed": /fix|properly|prevent|correctly/i,
30
- "New": /added|initial/i,
31
- "CLI": /pbjs|pbts|CLI/,
32
- "Docs": /README/i,
33
- "Other": null
34
- };
35
- var breakingFallback = /removed|stripped|dropped/i;
36
-
37
- var repo = "https://github.com/dcodeIO/protobuf.js";
38
-
39
- gitSemverTags(function(err, tags) {
40
- if (err)
41
- throw err;
42
-
43
- var categories = {};
44
- Object.keys(validCategories).forEach(function(category) {
45
- categories[category] = [];
46
- });
47
- var output = [];
48
-
49
- var from = tags[0];
50
- var to = "HEAD";
51
- var tag;
52
- if (argv.tag) {
53
- var idx = tags.indexOf(argv.tag);
54
- if (idx < 0)
55
- throw Error("no such tag: " + argv.tag);
56
- from = tags[idx + 1];
57
- tag = to = tags[idx];
58
- } else
59
- tag = pkg.version;
60
-
61
- var commits = gitRawCommits({
62
- from: from,
63
- to: to,
64
- merges: false,
65
- format: "%B%n#%H"
66
- });
67
-
68
- commits.on("error", function(err) {
69
- throw err;
70
- });
71
-
72
- commits.on("data", function(chunk) {
73
- var message = chunk.toString("utf8").trim();
74
- var match = /#([0-9a-f]{40})$/.exec(message);
75
- var hash;
76
- if (match) {
77
- message = message.substring(0, message.length - match[1].length).trim();
78
- hash = match[1];
79
- }
80
- message.split(";").forEach(function(message) {
81
- if (/^(Merge pull request |Post-merge)/.test(message))
82
- return;
83
- var match = /^(\w+):/i.exec(message = message.trim());
84
- var category;
85
- if (match && match[1] in validCategories) {
86
- category = match[1];
87
- message = message.substring(match[1].length + 1).trim();
88
- } else {
89
- var keys = Object.keys(validCategories);
90
- for (var i = 0; i < keys.length; ++i) {
91
- var re = validCategories[keys[i]];
92
- if (re && re.test(message)) {
93
- category = keys[i];
94
- break;
95
- }
96
- }
97
- message = message.replace(/^(\w+):/i, "").trim();
98
- }
99
- if (!category) {
100
- if (breakingFallback.test(message))
101
- category = "Breaking";
102
- else
103
- category = "Other";
104
- }
105
- var nl = message.indexOf("\n");
106
- if (nl > -1)
107
- message = message.substring(0, nl).trim();
108
- if (!hash || message.length < 12)
109
- return;
110
- message = message.replace(/\[ci skip\]/, "").trim();
111
- categories[category].push({
112
- text: message,
113
- hash: hash
114
- });
115
- });
116
- });
117
-
118
- commits.on("end", function() {
119
- output.push("# [" + tag + "](" + repo + "/releases/tag/" + tag + ")\n");
120
- Object.keys(categories).forEach(function(category) {
121
- var messages = categories[category];
122
- if (!messages.length)
123
- return;
124
- output.push("\n## " + category + "\n");
125
- messages.forEach(function(message) {
126
- var text = message.text.replace(/#(\d+)/g, "[#$1](" + repo + "/issues/$1)");
127
- output.push("[:hash:](" + repo + "/commit/" + message.hash + ") " + text + "<br />\n");
128
- });
129
- });
130
- var current;
131
- try {
132
- current = fs.readFileSync(basedir + "/CHANGELOG.md").toString("utf8");
133
- } catch (e) {
134
- current = "";
135
- }
136
- var re = new RegExp("^# \\[" + tag + "\\]");
137
- if (re.test(current)) { // regenerated, replace
138
- var pos = current.indexOf("# [", 1);
139
- if (pos > -1)
140
- current = current.substring(pos).trim();
141
- else
142
- current = "";
143
- }
144
- var contents = output.join("") + "\n" + current;
145
- if (argv.write)
146
- fs.writeFileSync(basedir + "/CHANGELOG.md", contents, "utf8");
147
- else
148
- process.stdout.write(contents);
149
- });
150
- });
1
+ "use strict";
2
+
3
+ var path = require("path"),
4
+ fs = require("fs");
5
+
6
+ var gitSemverTags = require("git-semver-tags"),
7
+ gitRawCommits = require("git-raw-commits"),
8
+ minimist = require("minimist");
9
+
10
+ var basedir = path.join(__dirname, "..");
11
+ var pkg = require(basedir + "/package.json");
12
+
13
+ var argv = minimist(process.argv, {
14
+ alias: {
15
+ tag : "t",
16
+ write : "w"
17
+ },
18
+ string: [ "tag" ],
19
+ boolean: [ "write" ],
20
+ default: {
21
+ tag: null,
22
+ write: false
23
+ }
24
+ });
25
+
26
+ // categories to be used in the future and regexes for lazy / older subjects
27
+ var validCategories = {
28
+ "Breaking": null,
29
+ "Fixed": /fix|properly|prevent|correctly/i,
30
+ "New": /added|initial/i,
31
+ "CLI": /pbjs|pbts|CLI/,
32
+ "Docs": /README/i,
33
+ "Other": null
34
+ };
35
+ var breakingFallback = /removed|stripped|dropped/i;
36
+
37
+ var repo = "https://github.com/dcodeIO/protobuf.js";
38
+
39
+ gitSemverTags(function(err, tags) {
40
+ if (err)
41
+ throw err;
42
+
43
+ var categories = {};
44
+ Object.keys(validCategories).forEach(function(category) {
45
+ categories[category] = [];
46
+ });
47
+ var output = [];
48
+
49
+ var from = tags[0];
50
+ var to = "HEAD";
51
+ var tag;
52
+ if (argv.tag) {
53
+ var idx = tags.indexOf(argv.tag);
54
+ if (idx < 0)
55
+ throw Error("no such tag: " + argv.tag);
56
+ from = tags[idx + 1];
57
+ tag = to = tags[idx];
58
+ } else
59
+ tag = pkg.version;
60
+
61
+ var commits = gitRawCommits({
62
+ from: from,
63
+ to: to,
64
+ merges: false,
65
+ format: "%B%n#%H"
66
+ });
67
+
68
+ commits.on("error", function(err) {
69
+ throw err;
70
+ });
71
+
72
+ commits.on("data", function(chunk) {
73
+ var message = chunk.toString("utf8").trim();
74
+ var match = /#([0-9a-f]{40})$/.exec(message);
75
+ var hash;
76
+ if (match) {
77
+ message = message.substring(0, message.length - match[1].length).trim();
78
+ hash = match[1];
79
+ }
80
+ message.split(";").forEach(function(message) {
81
+ if (/^(Merge pull request |Post-merge)/.test(message))
82
+ return;
83
+ var match = /^(\w+):/i.exec(message = message.trim());
84
+ var category;
85
+ if (match && match[1] in validCategories) {
86
+ category = match[1];
87
+ message = message.substring(match[1].length + 1).trim();
88
+ } else {
89
+ var keys = Object.keys(validCategories);
90
+ for (var i = 0; i < keys.length; ++i) {
91
+ var re = validCategories[keys[i]];
92
+ if (re && re.test(message)) {
93
+ category = keys[i];
94
+ break;
95
+ }
96
+ }
97
+ message = message.replace(/^(\w+):/i, "").trim();
98
+ }
99
+ if (!category) {
100
+ if (breakingFallback.test(message))
101
+ category = "Breaking";
102
+ else
103
+ category = "Other";
104
+ }
105
+ var nl = message.indexOf("\n");
106
+ if (nl > -1)
107
+ message = message.substring(0, nl).trim();
108
+ if (!hash || message.length < 12)
109
+ return;
110
+ message = message.replace(/\[ci skip\]/, "").trim();
111
+ categories[category].push({
112
+ text: message,
113
+ hash: hash
114
+ });
115
+ });
116
+ });
117
+
118
+ commits.on("end", function() {
119
+ output.push("# [" + tag + "](" + repo + "/releases/tag/" + tag + ")\n");
120
+ Object.keys(categories).forEach(function(category) {
121
+ var messages = categories[category];
122
+ if (!messages.length)
123
+ return;
124
+ output.push("\n## " + category + "\n");
125
+ messages.forEach(function(message) {
126
+ var text = message.text.replace(/#(\d+)/g, "[#$1](" + repo + "/issues/$1)");
127
+ output.push("[:hash:](" + repo + "/commit/" + message.hash + ") " + text + "<br />\n");
128
+ });
129
+ });
130
+ var current;
131
+ try {
132
+ current = fs.readFileSync(basedir + "/CHANGELOG.md").toString("utf8");
133
+ } catch (e) {
134
+ current = "";
135
+ }
136
+ var re = new RegExp("^# \\[" + tag + "\\]");
137
+ if (re.test(current)) { // regenerated, replace
138
+ var pos = current.indexOf("# [", 1);
139
+ if (pos > -1)
140
+ current = current.substring(pos).trim();
141
+ else
142
+ current = "";
143
+ }
144
+ var contents = output.join("") + "\n" + current;
145
+ if (argv.write)
146
+ fs.writeFileSync(basedir + "/CHANGELOG.md", contents, "utf8");
147
+ else
148
+ process.stdout.write(contents);
149
+ });
150
+ });
@@ -1,35 +1,35 @@
1
- "use strict";
2
-
3
- var path = require("path"),
4
- fs = require("fs"),
5
- pkg = require(path.join(__dirname, "..", "package.json"));
6
-
7
- // ensure that there is a node_modules folder for cli dependencies
8
- try { fs.mkdirSync(path.join(__dirname, "..", "cli", "node_modules")); } catch (e) {/**/}
9
-
10
- // check version scheme used by dependents
11
- if (!pkg.versionScheme)
12
- return;
13
-
14
- var warn = process.stderr.isTTY
15
- ? "\x1b[30m\x1b[43mWARN\x1b[0m \x1b[35m" + path.basename(process.argv[1], ".js") + "\x1b[0m"
16
- : "WARN " + path.basename(process.argv[1], ".js");
17
-
18
- var basePkg;
19
- try {
20
- basePkg = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "..", "package.json")));
21
- } catch (e) {
22
- return;
23
- }
24
-
25
- [
26
- "dependencies",
27
- "devDependencies",
28
- "optionalDependencies",
29
- "peerDependencies"
30
- ]
31
- .forEach(function(check) {
32
- var version = basePkg && basePkg[check] && basePkg[check][pkg.name];
33
- if (typeof version === "string" && version.charAt(0) !== pkg.versionScheme)
34
- process.stderr.write(pkg.name + " " + warn + " " + pkg.name + "@" + version + " is configured as a dependency of " + basePkg.name + ". use " + pkg.name + "@" + pkg.versionScheme + version.substring(1) + " instead for API compatibility.\n");
35
- });
1
+ "use strict";
2
+
3
+ var path = require("path"),
4
+ fs = require("fs"),
5
+ pkg = require(path.join(__dirname, "..", "package.json"));
6
+
7
+ // ensure that there is a node_modules folder for cli dependencies
8
+ try { fs.mkdirSync(path.join(__dirname, "..", "cli", "node_modules")); } catch (e) {/**/}
9
+
10
+ // check version scheme used by dependents
11
+ if (!pkg.versionScheme)
12
+ return;
13
+
14
+ var warn = process.stderr.isTTY
15
+ ? "\x1b[30m\x1b[43mWARN\x1b[0m \x1b[35m" + path.basename(process.argv[1], ".js") + "\x1b[0m"
16
+ : "WARN " + path.basename(process.argv[1], ".js");
17
+
18
+ var basePkg;
19
+ try {
20
+ basePkg = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "..", "package.json")));
21
+ } catch (e) {
22
+ return;
23
+ }
24
+
25
+ [
26
+ "dependencies",
27
+ "devDependencies",
28
+ "optionalDependencies",
29
+ "peerDependencies"
30
+ ]
31
+ .forEach(function(check) {
32
+ var version = basePkg && basePkg[check] && basePkg[check][pkg.name];
33
+ if (typeof version === "string" && version.charAt(0) !== pkg.versionScheme)
34
+ process.stderr.write(pkg.name + " " + warn + " " + pkg.name + "@" + version + " is configured as a dependency of " + basePkg.name + ". use " + pkg.name + "@" + pkg.versionScheme + version.substring(1) + " instead for API compatibility.\n");
35
+ });