flashtrace 0.1.0 → 0.1.2
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/LICENSE +201 -201
- package/README.md +52 -52
- package/dist/flashtrace.mjs +194 -157
- package/package.json +40 -40
package/LICENSE
CHANGED
|
@@ -1,201 +1,201 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright [yyyy] [name of copyright owner]
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<a href="https://github.com/flashtrace">
|
|
3
|
-
<img src="https://github.com/flashtrace.png" alt="flashtrace logo" width="120">
|
|
4
|
-
</a>
|
|
5
|
-
</p>
|
|
6
|
-
|
|
7
|
-
<h3 align="center">flashtrace</h3>
|
|
8
|
-
|
|
9
|
-
<p align="center">
|
|
10
|
-
Lightning-fast, reference-based requirement tracing that works anywhere.
|
|
11
|
-
</p>
|
|
12
|
-
|
|
13
|
-
<p align="center">
|
|
14
|
-
<a href="https://github.com/flashtrace/flashtrace/blob/main/docs/index.md">
|
|
15
|
-
<img src="https://img.shields.io/badge/Spec-Driven-8e4d13.svg?labelColor=1e1e1e" alt="Spec-driven documentation." />
|
|
16
|
-
</a>
|
|
17
|
-
<a href="https://github.com/flashtrace/flashtrace/blob/main/CLAUDE.md">
|
|
18
|
-
<img src="https://img.shields.io/badge/Agent-Native-d97d0e.svg?labelColor=1e1e1e" alt="This repository was created agent-native." />
|
|
19
|
-
</a>
|
|
20
|
-
<a href="https://github.com/flashtrace/flashtrace/blob/main/LICENSE">
|
|
21
|
-
<img src="https://img.shields.io/badge/License-Apache_2.0-f9c21d.svg?labelColor=1e1e1e" alt="Released under the Apache 2.0 license." />
|
|
22
|
-
</a>
|
|
23
|
-
</p>
|
|
24
|
-
|
|
25
|
-
## Getting Started
|
|
26
|
-
|
|
27
|
-
To use flashtrace in your project,
|
|
28
|
-
|
|
29
|
-
- either download `dist/flashtrace.mjs` into your own repository and run `node flashtrace.mjs`
|
|
30
|
-
- or run `npm install flashtrace -D` to add it as a proper dev dependency to your project.
|
|
31
|
-
|
|
32
|
-
You can then execute `npx flashtrace` to run the tracing.
|
|
33
|
-
Read our [Usage Guide](docs/USAGE.md) for more details.
|
|
34
|
-
Node >= 18 is required for flashtrace to work.
|
|
35
|
-
|
|
36
|
-
## About flashtrace
|
|
37
|
-
|
|
38
|
-
Let's be honest: This project started when I needed it myself.
|
|
39
|
-
So on the good side, this thing works.
|
|
40
|
-
On the bad side, it might not yet fit your case perfectly.
|
|
41
|
-
But we are open to adapt and we are actively working on widening our coverage area.
|
|
42
|
-
Tell us about your use case - we are happy to have a look and will try to make flashtrace available to anyone!
|
|
43
|
-
|
|
44
|
-
## Community
|
|
45
|
-
|
|
46
|
-
We are available for any questions, ideas and problems.
|
|
47
|
-
Just search or start a thread in our [GitHub Discussions](https://github.com/flashtrace/flashtrace/discussions).
|
|
48
|
-
|
|
49
|
-
If you want to contribute to this repository, read our [Contributing Guidelines](CONTRIBUTING.md).
|
|
50
|
-
|
|
51
|
-
## License
|
|
52
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://github.com/flashtrace">
|
|
3
|
+
<img src="https://github.com/flashtrace.png" alt="flashtrace logo" width="120">
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<h3 align="center">flashtrace</h3>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
Lightning-fast, reference-based requirement tracing that works anywhere.
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<a href="https://github.com/flashtrace/flashtrace/blob/main/docs/index.md">
|
|
15
|
+
<img src="https://img.shields.io/badge/Spec-Driven-8e4d13.svg?labelColor=1e1e1e" alt="Spec-driven documentation." />
|
|
16
|
+
</a>
|
|
17
|
+
<a href="https://github.com/flashtrace/flashtrace/blob/main/CLAUDE.md">
|
|
18
|
+
<img src="https://img.shields.io/badge/Agent-Native-d97d0e.svg?labelColor=1e1e1e" alt="This repository was created agent-native." />
|
|
19
|
+
</a>
|
|
20
|
+
<a href="https://github.com/flashtrace/flashtrace/blob/main/LICENSE">
|
|
21
|
+
<img src="https://img.shields.io/badge/License-Apache_2.0-f9c21d.svg?labelColor=1e1e1e" alt="Released under the Apache 2.0 license." />
|
|
22
|
+
</a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
## Getting Started
|
|
26
|
+
|
|
27
|
+
To use flashtrace in your project,
|
|
28
|
+
|
|
29
|
+
- either download `dist/flashtrace.mjs` into your own repository and run `node flashtrace.mjs`
|
|
30
|
+
- or run `npm install flashtrace -D` to add it as a proper dev dependency to your project.
|
|
31
|
+
|
|
32
|
+
You can then execute `npx flashtrace` to run the tracing.
|
|
33
|
+
Read our [Usage Guide](docs/USAGE.md) for more details.
|
|
34
|
+
Node >= 18 is required for flashtrace to work.
|
|
35
|
+
|
|
36
|
+
## About flashtrace
|
|
37
|
+
|
|
38
|
+
Let's be honest: This project started when I needed it myself.
|
|
39
|
+
So on the good side, this thing works.
|
|
40
|
+
On the bad side, it might not yet fit your case perfectly.
|
|
41
|
+
But we are open to adapt and we are actively working on widening our coverage area.
|
|
42
|
+
Tell us about your use case - we are happy to have a look and will try to make flashtrace available to anyone!
|
|
43
|
+
|
|
44
|
+
## Community
|
|
45
|
+
|
|
46
|
+
We are available for any questions, ideas and problems.
|
|
47
|
+
Just search or start a thread in our [GitHub Discussions](https://github.com/flashtrace/flashtrace/discussions).
|
|
48
|
+
|
|
49
|
+
If you want to contribute to this repository, read our [Contributing Guidelines](CONTRIBUTING.md).
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
53
|
Licensed under the [Apache 2.0 License](LICENSE).
|
package/dist/flashtrace.mjs
CHANGED
|
@@ -1,24 +1,41 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/main.mjs
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import { realpathSync } from "node:fs";
|
|
5
|
+
import process4 from "node:process";
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
7
|
|
|
7
8
|
// src/cli.mjs
|
|
8
9
|
import { promises as fs2 } from "node:fs";
|
|
9
10
|
import path4 from "node:path";
|
|
10
|
-
import
|
|
11
|
+
import process3 from "node:process";
|
|
11
12
|
|
|
12
13
|
// src/errors.mjs
|
|
13
14
|
var UsageError = class extends Error {
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
// src/files.mjs
|
|
17
|
-
import { promises as fs } from "node:fs";
|
|
18
|
+
import { existsSync, promises as fs } from "node:fs";
|
|
18
19
|
import path from "node:path";
|
|
19
20
|
import { execFileSync } from "node:child_process";
|
|
20
21
|
var MD_EXT = /* @__PURE__ */ new Set([".md", ".markdown"]);
|
|
21
22
|
var CODE_EXT = /* @__PURE__ */ new Set([".ts", ".js", ".mjs", ".sql", ".vue"]);
|
|
23
|
+
var GIT_LOCATIONS = process.platform === "win32" ? [
|
|
24
|
+
String.raw`C:\Program Files\Git\cmd\git.exe`,
|
|
25
|
+
String.raw`C:\Program Files (x86)\Git\cmd\git.exe`
|
|
26
|
+
] : ["/usr/bin/git", "/bin/git"];
|
|
27
|
+
var gitBin;
|
|
28
|
+
function findGit() {
|
|
29
|
+
if (gitBin === void 0) {
|
|
30
|
+
gitBin = GIT_LOCATIONS.find((p) => existsSync(p)) ?? null;
|
|
31
|
+
}
|
|
32
|
+
return gitBin;
|
|
33
|
+
}
|
|
34
|
+
function compareStrings(a, b) {
|
|
35
|
+
if (a < b) return -1;
|
|
36
|
+
if (a > b) return 1;
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
22
39
|
async function walk(dir, out) {
|
|
23
40
|
let entries;
|
|
24
41
|
try {
|
|
@@ -45,9 +62,11 @@ async function collectFiles(dirs) {
|
|
|
45
62
|
continue;
|
|
46
63
|
}
|
|
47
64
|
let list = null;
|
|
65
|
+
const git = findGit();
|
|
48
66
|
try {
|
|
67
|
+
if (!git) throw new Error("git not found");
|
|
49
68
|
const out = execFileSync(
|
|
50
|
-
|
|
69
|
+
git,
|
|
51
70
|
["-C", abs, "ls-files", "-z", "--cached", "--others", "--exclude-standard"],
|
|
52
71
|
{ encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }
|
|
53
72
|
);
|
|
@@ -60,18 +79,18 @@ async function collectFiles(dirs) {
|
|
|
60
79
|
return [...files].filter((f) => {
|
|
61
80
|
const ext = path.extname(f).toLowerCase();
|
|
62
81
|
return MD_EXT.has(ext) || CODE_EXT.has(ext);
|
|
63
|
-
}).sort();
|
|
82
|
+
}).sort(compareStrings);
|
|
64
83
|
}
|
|
65
84
|
|
|
66
85
|
// src/ids.mjs
|
|
67
|
-
var SEG_SRC =
|
|
86
|
+
var SEG_SRC = "[A-Za-z][A-Za-z0-9_.-]*";
|
|
68
87
|
var ID_SRC = String.raw`([A-Za-z]+):(?:((?:${SEG_SRC}\/)*${SEG_SRC})\/)?(${SEG_SRC})#(\d+)`;
|
|
69
88
|
var ID_RE = new RegExp(`^${ID_SRC}$`);
|
|
70
89
|
var mkId = (type, group, name, rev) => `${type}:${group ? group + "/" : ""}${name}#${rev}`;
|
|
71
90
|
var keyOf = (id) => id.slice(0, id.lastIndexOf("#"));
|
|
72
91
|
var revOf = (id) => Number(id.slice(id.lastIndexOf("#") + 1));
|
|
73
92
|
function parseIdEntry(raw) {
|
|
74
|
-
const cleaned = raw.
|
|
93
|
+
const cleaned = raw.replaceAll("`", "").trim();
|
|
75
94
|
const m = cleaned.match(ID_RE);
|
|
76
95
|
return m ? mkId(m[1], m[2], m[3], m[4]) : null;
|
|
77
96
|
}
|
|
@@ -95,9 +114,10 @@ function newItem(id, origin, file, line) {
|
|
|
95
114
|
|
|
96
115
|
// src/parse-markdown.mjs
|
|
97
116
|
var DEF_RE = new RegExp(String.raw`^\s*\`${ID_SRC}\`\s*$`);
|
|
98
|
-
var HEADING_RE = /^(#{1,6})\s+(
|
|
99
|
-
var KEYWORD_RE = /^(Needs|Covers|Tags):\s*(.*)$/;
|
|
100
|
-
var BULLET_RE = /^\s*[-*+]\s+(
|
|
117
|
+
var HEADING_RE = /^(#{1,6})\s+(\S(?:.*\S)?)\s*$/;
|
|
118
|
+
var KEYWORD_RE = /^(Needs|Covers|Tags):\s*((?:\S.*)?)$/;
|
|
119
|
+
var BULLET_RE = /^\s*[-*+]\s+(\S(?:.*\S)?)\s*$/;
|
|
120
|
+
var isBoundary = (l) => DEF_RE.test(l) || HEADING_RE.test(l);
|
|
101
121
|
function titleAbove(lines, defIndex) {
|
|
102
122
|
for (let k = defIndex - 1; k >= 0; k--) {
|
|
103
123
|
const l = lines[k];
|
|
@@ -107,57 +127,70 @@ function titleAbove(lines, defIndex) {
|
|
|
107
127
|
}
|
|
108
128
|
return null;
|
|
109
129
|
}
|
|
130
|
+
function keywordEntries(lines, j, inline) {
|
|
131
|
+
if (inline.trim() !== "") {
|
|
132
|
+
return { entries: inline.split(",").map((s) => s.trim()).filter(Boolean), j };
|
|
133
|
+
}
|
|
134
|
+
const entries = [];
|
|
135
|
+
while (j + 1 < lines.length) {
|
|
136
|
+
const b = lines[j + 1].match(BULLET_RE);
|
|
137
|
+
if (!b) break;
|
|
138
|
+
entries.push(b[1].trim());
|
|
139
|
+
j++;
|
|
140
|
+
}
|
|
141
|
+
return { entries, j };
|
|
142
|
+
}
|
|
143
|
+
function applyKeyword(item, keyword, entries, file, kwLine, problems) {
|
|
144
|
+
if (keyword === "Tags") {
|
|
145
|
+
item.tags.push(...entries);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const target = keyword === "Needs" ? "needs" : "covers";
|
|
149
|
+
for (const e of entries) {
|
|
150
|
+
const id = parseIdEntry(e);
|
|
151
|
+
if (id) item[target].push(id);
|
|
152
|
+
else
|
|
153
|
+
problems.push({
|
|
154
|
+
file,
|
|
155
|
+
line: kwLine,
|
|
156
|
+
message: `invalid ID "${e}" in ${keyword}: list of ${item.id}`
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function parseItemBody(lines, start, item, file, problems) {
|
|
161
|
+
let j = start;
|
|
162
|
+
let descDone = false;
|
|
163
|
+
while (j < lines.length && !isBoundary(lines[j])) {
|
|
164
|
+
const line = lines[j];
|
|
165
|
+
const kw = line.match(KEYWORD_RE);
|
|
166
|
+
if (kw) {
|
|
167
|
+
descDone = true;
|
|
168
|
+
const collected = keywordEntries(lines, j, kw[2]);
|
|
169
|
+
applyKeyword(item, kw[1], collected.entries, file, j + 1, problems);
|
|
170
|
+
j = collected.j;
|
|
171
|
+
} else if (line.trim() === "") {
|
|
172
|
+
if (item.description.length > 0) descDone = true;
|
|
173
|
+
} else if (!descDone) {
|
|
174
|
+
item.description.push(line.trim());
|
|
175
|
+
}
|
|
176
|
+
j++;
|
|
177
|
+
}
|
|
178
|
+
return j;
|
|
179
|
+
}
|
|
110
180
|
function parseMarkdown(file, text, problems) {
|
|
111
181
|
const lines = text.split(/\r?\n/);
|
|
112
182
|
const items = [];
|
|
113
|
-
|
|
114
|
-
|
|
183
|
+
let i = 0;
|
|
184
|
+
while (i < lines.length) {
|
|
115
185
|
const def = lines[i].match(DEF_RE);
|
|
116
|
-
if (!def)
|
|
186
|
+
if (!def) {
|
|
187
|
+
i++;
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
117
190
|
const item = newItem(mkId(def[1], def[2], def[3], def[4]), "markdown", file, i + 1);
|
|
118
191
|
item.title = titleAbove(lines, i);
|
|
119
|
-
|
|
120
|
-
let descDone = false;
|
|
121
|
-
while (j < lines.length && !isBoundary(lines[j])) {
|
|
122
|
-
const line = lines[j];
|
|
123
|
-
const kw = line.match(KEYWORD_RE);
|
|
124
|
-
if (kw) {
|
|
125
|
-
descDone = true;
|
|
126
|
-
const kwLine = j + 1;
|
|
127
|
-
const entries = [];
|
|
128
|
-
if (kw[2].trim() !== "") {
|
|
129
|
-
entries.push(...kw[2].split(",").map((s) => s.trim()).filter(Boolean));
|
|
130
|
-
} else {
|
|
131
|
-
while (j + 1 < lines.length) {
|
|
132
|
-
const b = lines[j + 1].match(BULLET_RE);
|
|
133
|
-
if (!b) break;
|
|
134
|
-
entries.push(b[1].trim());
|
|
135
|
-
j++;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
if (kw[1] === "Tags") {
|
|
139
|
-
item.tags.push(...entries);
|
|
140
|
-
} else {
|
|
141
|
-
for (const e of entries) {
|
|
142
|
-
const id = parseIdEntry(e);
|
|
143
|
-
if (id) item[kw[1] === "Needs" ? "needs" : "covers"].push(id);
|
|
144
|
-
else
|
|
145
|
-
problems.push({
|
|
146
|
-
file,
|
|
147
|
-
line: kwLine,
|
|
148
|
-
message: `invalid ID "${e}" in ${kw[1]}: list of ${item.id}`
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
} else if (line.trim() === "") {
|
|
153
|
-
if (item.description.length > 0) descDone = true;
|
|
154
|
-
} else if (!descDone) {
|
|
155
|
-
item.description.push(line.trim());
|
|
156
|
-
}
|
|
157
|
-
j++;
|
|
158
|
-
}
|
|
192
|
+
i = parseItemBody(lines, i + 1, item, file, problems);
|
|
159
193
|
items.push(item);
|
|
160
|
-
i = j - 1;
|
|
161
194
|
}
|
|
162
195
|
return items;
|
|
163
196
|
}
|
|
@@ -165,86 +198,93 @@ function parseMarkdown(file, text, problems) {
|
|
|
165
198
|
// src/parse-code.mjs
|
|
166
199
|
import path2 from "node:path";
|
|
167
200
|
var TAG_RE = new RegExp(String.raw`\[(>>)?\s*${ID_SRC}\s*\]`, "g");
|
|
201
|
+
var BLOCK_CLOSERS = { c: "*/", html: "-->" };
|
|
202
|
+
function findCommentStart(s, pos, lineMarkers, htmlBlocks) {
|
|
203
|
+
const candidates = lineMarkers.map((m) => ({ idx: s.indexOf(m, pos), kind: "line", len: m.length }));
|
|
204
|
+
candidates.push({ idx: s.indexOf("/*", pos), kind: "c", len: 2 });
|
|
205
|
+
if (htmlBlocks) candidates.push({ idx: s.indexOf("<!--", pos), kind: "html", len: 4 });
|
|
206
|
+
let best = null;
|
|
207
|
+
for (const cand of candidates) {
|
|
208
|
+
if (cand.idx !== -1 && (best === null || cand.idx < best.idx)) best = cand;
|
|
209
|
+
}
|
|
210
|
+
return best;
|
|
211
|
+
}
|
|
212
|
+
function readBlockRest(s, pos, closer) {
|
|
213
|
+
const end = s.indexOf(closer, pos);
|
|
214
|
+
if (end === -1) return { text: s.slice(pos) + " ", pos: s.length, closed: false };
|
|
215
|
+
return { text: s.slice(pos, end) + " ", pos: end + closer.length, closed: true };
|
|
216
|
+
}
|
|
217
|
+
function commentText(s, state, lineMarkers, htmlBlocks) {
|
|
218
|
+
let comment = "";
|
|
219
|
+
let pos = 0;
|
|
220
|
+
while (pos < s.length) {
|
|
221
|
+
if (state.block) {
|
|
222
|
+
const rest = readBlockRest(s, pos, BLOCK_CLOSERS[state.block]);
|
|
223
|
+
comment += rest.text;
|
|
224
|
+
pos = rest.pos;
|
|
225
|
+
if (rest.closed) state.block = null;
|
|
226
|
+
} else {
|
|
227
|
+
const start = findCommentStart(s, pos, lineMarkers, htmlBlocks);
|
|
228
|
+
if (!start) break;
|
|
229
|
+
pos = start.idx + start.len;
|
|
230
|
+
if (start.kind === "line") {
|
|
231
|
+
comment += s.slice(pos) + " ";
|
|
232
|
+
pos = s.length;
|
|
233
|
+
} else {
|
|
234
|
+
state.block = start.kind;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return comment;
|
|
239
|
+
}
|
|
240
|
+
function collectTags(comment, file, line, state, items, problems) {
|
|
241
|
+
for (const m of comment.matchAll(TAG_RE)) {
|
|
242
|
+
const id = mkId(m[2], m[3], m[4], m[5]);
|
|
243
|
+
if (!m[1]) {
|
|
244
|
+
state.last = newItem(id, "code", file, line);
|
|
245
|
+
items.push(state.last);
|
|
246
|
+
} else if (state.last) {
|
|
247
|
+
state.last.needs.push(id);
|
|
248
|
+
} else {
|
|
249
|
+
problems.push({
|
|
250
|
+
file,
|
|
251
|
+
line,
|
|
252
|
+
message: `need tag [>>${id}] has no preceding item tag in this file`
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
168
257
|
function parseCode(file, text, problems) {
|
|
169
258
|
const ext = path2.extname(file).toLowerCase();
|
|
170
259
|
const lines = text.split(/\r?\n/);
|
|
171
260
|
const items = [];
|
|
172
|
-
let last = null;
|
|
173
|
-
let block = null;
|
|
174
261
|
const lineMarkers = ext === ".sql" ? ["--"] : ["//"];
|
|
175
262
|
const htmlBlocks = ext === ".vue";
|
|
263
|
+
const state = { last: null, block: null };
|
|
176
264
|
for (let i = 0; i < lines.length; i++) {
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
let pos = 0;
|
|
180
|
-
while (pos < s.length) {
|
|
181
|
-
if (block === "c" || block === "html") {
|
|
182
|
-
const closer = block === "c" ? "*/" : "-->";
|
|
183
|
-
const end = s.indexOf(closer, pos);
|
|
184
|
-
if (end === -1) {
|
|
185
|
-
comment += s.slice(pos) + " ";
|
|
186
|
-
pos = s.length;
|
|
187
|
-
} else {
|
|
188
|
-
comment += s.slice(pos, end) + " ";
|
|
189
|
-
pos = end + closer.length;
|
|
190
|
-
block = null;
|
|
191
|
-
}
|
|
192
|
-
} else {
|
|
193
|
-
let best = -1;
|
|
194
|
-
let kind = null;
|
|
195
|
-
let len = 0;
|
|
196
|
-
for (const m of lineMarkers) {
|
|
197
|
-
const idx = s.indexOf(m, pos);
|
|
198
|
-
if (idx !== -1 && (best === -1 || idx < best)) {
|
|
199
|
-
best = idx;
|
|
200
|
-
kind = "line";
|
|
201
|
-
len = m.length;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
const cb = s.indexOf("/*", pos);
|
|
205
|
-
if (cb !== -1 && (best === -1 || cb < best)) {
|
|
206
|
-
best = cb;
|
|
207
|
-
kind = "c";
|
|
208
|
-
len = 2;
|
|
209
|
-
}
|
|
210
|
-
if (htmlBlocks) {
|
|
211
|
-
const hb = s.indexOf("<!--", pos);
|
|
212
|
-
if (hb !== -1 && (best === -1 || hb < best)) {
|
|
213
|
-
best = hb;
|
|
214
|
-
kind = "html";
|
|
215
|
-
len = 4;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
if (best === -1) break;
|
|
219
|
-
pos = best + len;
|
|
220
|
-
if (kind === "line") {
|
|
221
|
-
comment += s.slice(pos) + " ";
|
|
222
|
-
pos = s.length;
|
|
223
|
-
} else {
|
|
224
|
-
block = kind;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
for (const m of comment.matchAll(TAG_RE)) {
|
|
229
|
-
const id = mkId(m[2], m[3], m[4], m[5]);
|
|
230
|
-
if (m[1]) {
|
|
231
|
-
if (!last)
|
|
232
|
-
problems.push({
|
|
233
|
-
file,
|
|
234
|
-
line: i + 1,
|
|
235
|
-
message: `need tag [>>${id}] has no preceding item tag in this file`
|
|
236
|
-
});
|
|
237
|
-
else last.needs.push(id);
|
|
238
|
-
} else {
|
|
239
|
-
last = newItem(id, "code", file, i + 1);
|
|
240
|
-
items.push(last);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
265
|
+
const comment = commentText(lines[i], state, lineMarkers, htmlBlocks);
|
|
266
|
+
collectTags(comment, file, i + 1, state, items, problems);
|
|
243
267
|
}
|
|
244
268
|
return items;
|
|
245
269
|
}
|
|
246
270
|
|
|
247
271
|
// src/analyze.mjs
|
|
272
|
+
function checkItemReferences(it, byId, neededIds, revHint) {
|
|
273
|
+
for (const n of it.needs) {
|
|
274
|
+
if (!byId.has(n)) it.defects.push(`uncovered: needs ${n}, which does not exist${revHint(n)}`);
|
|
275
|
+
}
|
|
276
|
+
for (const c of it.covers) {
|
|
277
|
+
const targets = byId.get(c);
|
|
278
|
+
if (!targets) {
|
|
279
|
+
it.defects.push(`orphaned: covers ${c}, which does not exist${revHint(c)}`);
|
|
280
|
+
} else if (!targets.some((t) => t.needs.includes(it.id))) {
|
|
281
|
+
it.defects.push(`unwanted: covers ${c}, but ${c} does not need ${it.id}`);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (it.origin === "code" && !neededIds.has(it.id)) {
|
|
285
|
+
it.defects.push(`unwanted: no item needs ${it.id}`);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
248
288
|
function analyze(items) {
|
|
249
289
|
const byId = /* @__PURE__ */ new Map();
|
|
250
290
|
const revsByKey = /* @__PURE__ */ new Map();
|
|
@@ -261,22 +301,7 @@ function analyze(items) {
|
|
|
261
301
|
const revs = revsByKey.get(keyOf(id));
|
|
262
302
|
return revs ? ` (revision mismatch: existing revision(s) of ${keyOf(id)}: ${[...revs].sort((a, b) => a - b).join(", ")})` : "";
|
|
263
303
|
};
|
|
264
|
-
for (const it of items)
|
|
265
|
-
for (const n of it.needs) {
|
|
266
|
-
if (!byId.has(n)) it.defects.push(`uncovered: needs ${n}, which does not exist${revHint(n)}`);
|
|
267
|
-
}
|
|
268
|
-
for (const c of it.covers) {
|
|
269
|
-
const targets = byId.get(c);
|
|
270
|
-
if (!targets) {
|
|
271
|
-
it.defects.push(`orphaned: covers ${c}, which does not exist${revHint(c)}`);
|
|
272
|
-
} else if (!targets.some((t) => t.needs.includes(it.id))) {
|
|
273
|
-
it.defects.push(`unwanted: covers ${c}, but ${c} does not need ${it.id}`);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
if (it.origin === "code" && !neededIds.has(it.id)) {
|
|
277
|
-
it.defects.push(`unwanted: no item needs ${it.id}`);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
304
|
+
for (const it of items) checkItemReferences(it, byId, neededIds, revHint);
|
|
280
305
|
const memo = /* @__PURE__ */ new Map();
|
|
281
306
|
const deep = (id) => {
|
|
282
307
|
if (memo.has(id)) return memo.get(id);
|
|
@@ -296,9 +321,9 @@ function analyze(items) {
|
|
|
296
321
|
|
|
297
322
|
// src/report.mjs
|
|
298
323
|
import path3 from "node:path";
|
|
299
|
-
import
|
|
324
|
+
import process2 from "node:process";
|
|
300
325
|
function makeStyler() {
|
|
301
|
-
const on =
|
|
326
|
+
const on = process2.stdout.isTTY && !process2.env.NO_COLOR;
|
|
302
327
|
const wrap = (code) => (s) => on ? `\x1B[${code}m${s}\x1B[0m` : s;
|
|
303
328
|
return {
|
|
304
329
|
red: wrap("31"),
|
|
@@ -312,28 +337,32 @@ function makeStyler() {
|
|
|
312
337
|
function report(items, problems, cwd) {
|
|
313
338
|
const c = makeStyler();
|
|
314
339
|
const rel = (f) => path3.relative(cwd, f) || f;
|
|
340
|
+
const dimLoc = (file, line) => c.dim(`${rel(file)}:${line}`);
|
|
315
341
|
const defective = items.filter((it) => it.defects.length > 0);
|
|
316
342
|
const out = [];
|
|
317
343
|
for (const it of defective) {
|
|
318
|
-
const title = it.title ?
|
|
344
|
+
const title = it.title ? " " + c.dim(`"${it.title}"`) : "";
|
|
319
345
|
out.push(
|
|
320
|
-
`${c.red("\u2718")} ${c.bold(it.id)}${title} ${
|
|
346
|
+
`${c.red("\u2718")} ${c.bold(it.id)}${title} ${dimLoc(it.file, it.line)}`
|
|
321
347
|
);
|
|
322
348
|
for (const d of it.defects) out.push(` ${c.red("\u2022")} ${d}`);
|
|
323
349
|
out.push("");
|
|
324
350
|
}
|
|
325
351
|
for (const p of problems) {
|
|
326
|
-
out.push(`${c.yellow("\u26A0")} ${p.message} ${
|
|
352
|
+
out.push(`${c.yellow("\u26A0")} ${p.message} ${dimLoc(p.file, p.line)}`);
|
|
327
353
|
}
|
|
328
354
|
if (problems.length) out.push("");
|
|
329
355
|
const okCount = items.length - defective.length;
|
|
330
356
|
const notDeep = items.filter((it) => it.defects.length === 0 && !it.deepCovered).length;
|
|
331
357
|
const md = items.filter((i) => i.origin === "markdown").length;
|
|
332
|
-
|
|
333
|
-
out.push(
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
358
|
+
const originBreakdown = c.dim(`(${md} from markdown, ${items.length - md} from code)`);
|
|
359
|
+
out.push(
|
|
360
|
+
c.bold("Summary"),
|
|
361
|
+
` items ${items.length} ${originBreakdown}`,
|
|
362
|
+
` ok ${c.green(String(okCount))}`,
|
|
363
|
+
` defective ${defective.length ? c.red(String(defective.length)) : "0"}`
|
|
364
|
+
);
|
|
365
|
+
if (notDeep) out.push(" " + c.dim(`of the ok items, ${notDeep} are only shallow-covered (a needed item is itself defective)`));
|
|
337
366
|
if (problems.length) out.push(` problems ${c.yellow(String(problems.length))}`);
|
|
338
367
|
out.push("");
|
|
339
368
|
const clean = defective.length === 0 && problems.length === 0;
|
|
@@ -361,7 +390,7 @@ function parseArgs(argv) {
|
|
|
361
390
|
const a = argv[i];
|
|
362
391
|
if (a === "-h" || a === "--help") {
|
|
363
392
|
console.log(HELP);
|
|
364
|
-
|
|
393
|
+
process3.exit(0);
|
|
365
394
|
} else if (a === "-t" || a === "--tags") {
|
|
366
395
|
const v = argv[++i];
|
|
367
396
|
if (!v) throw new UsageError(`missing value for ${a}`);
|
|
@@ -376,7 +405,7 @@ function parseArgs(argv) {
|
|
|
376
405
|
return opts;
|
|
377
406
|
}
|
|
378
407
|
async function main() {
|
|
379
|
-
const opts = parseArgs(
|
|
408
|
+
const opts = parseArgs(process3.argv.slice(2));
|
|
380
409
|
const files = await collectFiles(opts.dirs);
|
|
381
410
|
const problems = [];
|
|
382
411
|
let items = [];
|
|
@@ -394,8 +423,8 @@ async function main() {
|
|
|
394
423
|
);
|
|
395
424
|
}
|
|
396
425
|
analyze(items);
|
|
397
|
-
const clean = report(items, problems,
|
|
398
|
-
|
|
426
|
+
const clean = report(items, problems, process3.cwd());
|
|
427
|
+
process3.exit(clean ? 0 : 1);
|
|
399
428
|
}
|
|
400
429
|
function runCli() {
|
|
401
430
|
main().catch((err) => {
|
|
@@ -403,16 +432,24 @@ function runCli() {
|
|
|
403
432
|
console.error(`error: ${err.message}
|
|
404
433
|
|
|
405
434
|
${HELP}`);
|
|
406
|
-
|
|
435
|
+
process3.exit(2);
|
|
407
436
|
}
|
|
408
437
|
console.error(err);
|
|
409
|
-
|
|
438
|
+
process3.exit(2);
|
|
410
439
|
});
|
|
411
440
|
}
|
|
412
441
|
|
|
413
442
|
// src/main.mjs
|
|
414
|
-
|
|
415
|
-
|
|
443
|
+
function runAsCli() {
|
|
444
|
+
const argvPath = process4.argv[1];
|
|
445
|
+
if (!argvPath) return false;
|
|
446
|
+
try {
|
|
447
|
+
return realpathSync(argvPath) === realpathSync(fileURLToPath(import.meta.url));
|
|
448
|
+
} catch {
|
|
449
|
+
return import.meta.url === pathToFileURL(argvPath).href;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
if (runAsCli()) runCli();
|
|
416
453
|
export {
|
|
417
454
|
UsageError,
|
|
418
455
|
analyze,
|
package/package.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "flashtrace",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Lightning-fast, reference-based requirement tracing that works anywhere.",
|
|
5
|
-
"license": "Apache-2.0",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/flashtrace/flashtrace.git"
|
|
9
|
-
},
|
|
10
|
-
"homepage": "https://github.com/flashtrace/flashtrace#readme",
|
|
11
|
-
"bugs": "https://github.com/flashtrace/flashtrace/issues",
|
|
12
|
-
"keywords": [
|
|
13
|
-
"requirements",
|
|
14
|
-
"traceability",
|
|
15
|
-
"tracing",
|
|
16
|
-
"coverage",
|
|
17
|
-
"markdown",
|
|
18
|
-
"cli"
|
|
19
|
-
],
|
|
20
|
-
"type": "module",
|
|
21
|
-
"packageManager": "pnpm@11.10.0",
|
|
22
|
-
"bin": {
|
|
23
|
-
"flashtrace": "./dist/flashtrace.mjs"
|
|
24
|
-
},
|
|
25
|
-
"files": [
|
|
26
|
-
"dist/"
|
|
27
|
-
],
|
|
28
|
-
"engines": {
|
|
29
|
-
"node": ">=18"
|
|
30
|
-
},
|
|
31
|
-
"scripts": {
|
|
32
|
-
"build": "esbuild src/main.mjs --bundle --format=esm --platform=node --outfile=dist/flashtrace.mjs",
|
|
33
|
-
"prepack": "pnpm run build",
|
|
34
|
-
"pretest": "pnpm run build",
|
|
35
|
-
"test": "node --test"
|
|
36
|
-
},
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"esbuild": "^0.28.1"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "flashtrace",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Lightning-fast, reference-based requirement tracing that works anywhere.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/flashtrace/flashtrace.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/flashtrace/flashtrace#readme",
|
|
11
|
+
"bugs": "https://github.com/flashtrace/flashtrace/issues",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"requirements",
|
|
14
|
+
"traceability",
|
|
15
|
+
"tracing",
|
|
16
|
+
"coverage",
|
|
17
|
+
"markdown",
|
|
18
|
+
"cli"
|
|
19
|
+
],
|
|
20
|
+
"type": "module",
|
|
21
|
+
"packageManager": "pnpm@11.10.0",
|
|
22
|
+
"bin": {
|
|
23
|
+
"flashtrace": "./dist/flashtrace.mjs"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist/"
|
|
27
|
+
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=18"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "esbuild src/main.mjs --bundle --format=esm --platform=node --outfile=dist/flashtrace.mjs",
|
|
33
|
+
"prepack": "pnpm run build",
|
|
34
|
+
"pretest": "pnpm run build",
|
|
35
|
+
"test": "node --test"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"esbuild": "^0.28.1"
|
|
39
|
+
}
|
|
40
|
+
}
|