shaka-player 3.2.8 → 3.2.11

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 (146) hide show
  1. package/.github/workflows/build-and-test.yaml +67 -15
  2. package/.github/workflows/compute-incremental-coverage.py +251 -0
  3. package/.github/workflows/report-incremental-coverage.yaml +39 -0
  4. package/.github/workflows/selenium-lab-tests.yaml +44 -1
  5. package/AUTHORS +1 -1
  6. package/CHANGELOG.md +37 -0
  7. package/CONTRIBUTORS +4 -1
  8. package/README.md +20 -6
  9. package/demo/common/assets.js +1 -1
  10. package/demo/index.html +0 -2
  11. package/demo/main.js +3 -3
  12. package/dist/controls.css +1 -1
  13. package/dist/demo.compiled.debug.js +3 -3
  14. package/dist/demo.compiled.debug.map +2 -2
  15. package/dist/demo.compiled.js +3 -3
  16. package/dist/demo.compiled.map +2 -2
  17. package/dist/deps.js +2 -2
  18. package/dist/locales.js +29 -29
  19. package/dist/receiver.compiled.debug.js +1 -1
  20. package/dist/receiver.compiled.debug.map +1 -1
  21. package/dist/receiver.compiled.js +1 -1
  22. package/dist/receiver.compiled.map +1 -1
  23. package/dist/shaka-player.compiled.d.ts +12 -1
  24. package/dist/shaka-player.compiled.debug.d.ts +12 -1
  25. package/dist/shaka-player.compiled.debug.externs.js +49 -38
  26. package/dist/shaka-player.compiled.debug.js +238 -227
  27. package/dist/shaka-player.compiled.debug.map +4 -4
  28. package/dist/shaka-player.compiled.externs.js +49 -38
  29. package/dist/shaka-player.compiled.js +766 -760
  30. package/dist/shaka-player.compiled.map +4 -4
  31. package/dist/shaka-player.ui.d.ts +12 -1
  32. package/dist/shaka-player.ui.debug.d.ts +12 -1
  33. package/dist/shaka-player.ui.debug.externs.js +49 -38
  34. package/dist/shaka-player.ui.debug.js +227 -217
  35. package/dist/shaka-player.ui.debug.map +4 -4
  36. package/dist/shaka-player.ui.externs.js +49 -38
  37. package/dist/shaka-player.ui.js +870 -865
  38. package/dist/shaka-player.ui.map +4 -4
  39. package/docs/tutorials/welcome.md +6 -3
  40. package/karma.conf.js +3 -11
  41. package/lib/dash/dash_parser.js +5 -0
  42. package/lib/hls/hls_parser.js +14 -6
  43. package/lib/media/drm_engine.js +1 -1
  44. package/lib/media/presentation_timeline.js +24 -1
  45. package/lib/media/streaming_engine.js +1 -0
  46. package/lib/player.js +1 -6
  47. package/lib/polyfill/media_capabilities.js +3 -0
  48. package/lib/polyfill/videoplaybackquality.js +3 -1
  49. package/lib/text/cue.js +0 -5
  50. package/lib/text/simple_text_displayer.js +21 -9
  51. package/lib/text/ui_text_displayer.js +83 -19
  52. package/lib/util/buffer_utils.js +3 -0
  53. package/lib/util/object_utils.js +1 -0
  54. package/lib/util/platform.js +41 -1
  55. package/lib/util/stream_utils.js +24 -3
  56. package/lib/util/string_utils.js +102 -13
  57. package/maintained-branches.md +15 -0
  58. package/package.json +6 -5
  59. package/test/text/simple_text_displayer_unit.js +27 -0
  60. package/test/text/ui_text_displayer_unit.js +65 -0
  61. package/test/util/string_utils_unit.js +46 -8
  62. package/app-engine/README.md +0 -9
  63. package/app-engine/demo-version-index/README.md +0 -14
  64. package/app-engine/demo-version-index/app.yaml +0 -2
  65. package/app-engine/demo-version-index/main.py +0 -162
  66. package/app-engine/demo-version-index/requirements.txt +0 -6
  67. package/app-engine/demo-version-index/templates/index.html +0 -114
  68. package/app-engine/shaka-player-demo/README.md +0 -18
  69. package/app-engine/shaka-player-demo/app.yaml +0 -61
  70. package/app-engine/shaka-player-demo/main.py +0 -95
  71. package/app-engine/shaka-player-demo/posters/10yo.png +0 -0
  72. package/app-engine/shaka-player-demo/posters/10yo.xcf +0 -0
  73. package/app-engine/shaka-player-demo/posters/1yo.jpg +0 -0
  74. package/app-engine/shaka-player-demo/posters/2yo.png +0 -0
  75. package/app-engine/shaka-player-demo/posters/2yo.xcf +0 -0
  76. package/app-engine/shaka-player-demo/posters/3yo.png +0 -0
  77. package/app-engine/shaka-player-demo/posters/3yo.xcf +0 -0
  78. package/app-engine/shaka-player-demo/posters/4yo.png +0 -0
  79. package/app-engine/shaka-player-demo/posters/4yo.xcf +0 -0
  80. package/app-engine/shaka-player-demo/posters/5yo.png +0 -0
  81. package/app-engine/shaka-player-demo/posters/5yo.xcf +0 -0
  82. package/app-engine/shaka-player-demo/posters/6yo.png +0 -0
  83. package/app-engine/shaka-player-demo/posters/6yo.xcf +0 -0
  84. package/app-engine/shaka-player-demo/posters/7yo.png +0 -0
  85. package/app-engine/shaka-player-demo/posters/7yo.xcf +0 -0
  86. package/app-engine/shaka-player-demo/posters/8yo.png +0 -0
  87. package/app-engine/shaka-player-demo/posters/8yo.xcf +0 -0
  88. package/app-engine/shaka-player-demo/posters/9yo.png +0 -0
  89. package/app-engine/shaka-player-demo/posters/9yo.xcf +0 -0
  90. package/app-engine/shaka-player-demo/posters/audioOnly.gif +0 -0
  91. package/app-engine/shaka-player-demo/posters/audioRickRoll.gif +0 -0
  92. package/app-engine/shaka-player-demo/posters/colorbars.gif +0 -0
  93. package/app-engine/shaka-player-demo/posters/fireworks.jpg +0 -0
  94. package/app-engine/shaka-player-demo/posters/party-hat.png +0 -0
  95. package/app-engine/shaka-player-demo/posters/sources.txt +0 -46
  96. package/app-engine/shaka-player-demo/posters/standard.png +0 -0
  97. package/app-engine/shaka-player-demo/posters/trek.jpg +0 -0
  98. package/app-engine/shaka-player-demo/posters/valentines.png +0 -0
  99. package/app-engine/shaka-player-demo/posters/zombie.jpg +0 -0
  100. package/app-engine/shaka-player-demo/posters.py +0 -110
  101. package/app-engine/shaka-player-demo/requirements.txt +0 -5
  102. package/app-engine/shaka-player-demo/time.txt +0 -1
  103. package/build/README.md +0 -127
  104. package/build/__init__.py +0 -0
  105. package/build/all.py +0 -150
  106. package/build/apps.py +0 -186
  107. package/build/build.py +0 -392
  108. package/build/check.py +0 -354
  109. package/build/checkversion.py +0 -84
  110. package/build/compiler.py +0 -513
  111. package/build/conformance.textproto +0 -321
  112. package/build/docker/Dockerfile +0 -20
  113. package/build/docker/docker-compose.yml +0 -10
  114. package/build/docs.py +0 -54
  115. package/build/eslint-plugin-shaka-rules/arg-comment-spacing.js +0 -72
  116. package/build/eslint-plugin-shaka-rules/index.js +0 -24
  117. package/build/eslint-plugin-shaka-rules/package.json +0 -7
  118. package/build/eslint-plugin-shaka-rules/private.js +0 -109
  119. package/build/gendeps.py +0 -71
  120. package/build/generateExterns.js +0 -867
  121. package/build/generateLocalizations.py +0 -262
  122. package/build/generateTsDefs.py +0 -137
  123. package/build/install-linux-prereqs.sh +0 -136
  124. package/build/license-header +0 -5
  125. package/build/misspellings.txt +0 -38
  126. package/build/pixelsChanged.js +0 -35
  127. package/build/shaka-lab.yaml +0 -163
  128. package/build/shakaBuildHelpers.py +0 -356
  129. package/build/stats.py +0 -816
  130. package/build/subprocessWindowsPatch.py +0 -103
  131. package/build/test.py +0 -541
  132. package/build/types/ads +0 -8
  133. package/build/types/cast +0 -6
  134. package/build/types/cea +0 -13
  135. package/build/types/complete +0 -9
  136. package/build/types/core +0 -106
  137. package/build/types/dash +0 -8
  138. package/build/types/hls +0 -9
  139. package/build/types/manifests +0 -5
  140. package/build/types/networking +0 -6
  141. package/build/types/offline +0 -21
  142. package/build/types/polyfill +0 -19
  143. package/build/types/text +0 -11
  144. package/build/types/ui +0 -37
  145. package/build/updateScreenshots.py +0 -85
  146. package/build/wrapper.template.js +0 -52
@@ -1,321 +0,0 @@
1
- # Copyright 2016 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- # Conformance requirements:
17
- # See: https://github.com/google/closure-compiler/wiki/JS-Conformance-Framework
18
-
19
-
20
- # Disallow throwing non-Error types.
21
- requirement: {
22
- type: CUSTOM
23
- java_class:
24
- 'com.google.javascript.jscomp.ConformanceRules$BanThrowOfNonErrorTypes'
25
- error_message: 'Throwing non-Error types or Error itself is not allowed; '
26
- 'throw shaka.util.Error instead.'
27
- whitelist_regexp: 'test/'
28
- whitelist_regexp: 'node_modules/'
29
- }
30
- requirement: {
31
- type: BANNED_CODE_PATTERN
32
- value: 'function template() { throw new Error(); }'
33
- error_message: 'Throwing non-Error types or Error itself is not allowed; '
34
- 'throw shaka.util.Error instead.'
35
- whitelist_regexp: 'test/'
36
- whitelist_regexp: 'node_modules/'
37
- }
38
-
39
-
40
- # Ban accessing members of unknown types.
41
- requirement: {
42
- type: CUSTOM
43
- java_class: 'com.google.javascript.jscomp.ConformanceRules$'
44
- 'BanUnknownTypedClassPropsReferences'
45
- error_message: 'Using properties of unknown types is not allowed; add an '
46
- 'explicit type to the variable.'
47
- whitelist_regexp: 'demo/'
48
- }
49
- requirement {
50
- type: CUSTOM
51
- java_class: 'com.google.javascript.jscomp.ConformanceRules$BanUnknownThis'
52
- error_message: 'Failed to infer type of "this"; '
53
- 'please be explicit or use bind!'
54
- # Until we can get this rule updated for ES6 static methods
55
- # (https://github.com/google/closure-compiler/issues/2880):
56
- whitelist_regexp: 'test/test/util/canned_idb.js'
57
- whitelist_regexp: 'test/assets/assets_integration.js'
58
- }
59
-
60
-
61
- # Reject unresolved types.
62
- requirement {
63
- type: CUSTOM
64
- java_class: 'com.google.javascript.jscomp.ConformanceRules$BanUnresolvedType'
65
- error_message: 'Failed to resolve type!'
66
- }
67
-
68
-
69
- # Reject global variables.
70
- requirement {
71
- type: CUSTOM
72
- java_class: 'com.google.javascript.jscomp.ConformanceRules$BanGlobalVars'
73
- error_message: 'Global variables are not allowed!'
74
- whitelist_regexp: 'demo/'
75
- whitelist_regexp: 'test/'
76
- whitelist_regexp: 'node_modules/'
77
- }
78
-
79
-
80
- # Disallow using "!" on nullable numbers in boolean assignment.
81
- # Note: we can't use the pattern "var b = !n" because it causes too many
82
- # false positives.
83
- requirement: {
84
- type: BANNED_CODE_PATTERN
85
- value: '/** @param {boolean} b @param {?number} n */ '
86
- 'function template(b, n) { b = !n; }'
87
- error_message: 'Using "!" on nullable numbers in boolean assignment '
88
- 'is not allowed; use an explicit comparison instead.'
89
- whitelist_regexp: 'node_modules/'
90
- }
91
-
92
- requirement: {
93
- type: BANNED_CODE_PATTERN
94
- value: '/** @param {*} a'
95
- ' @param {(number|string|boolean|null|undefined)} x */'
96
- 'function template(a, x) { expect(a).toEqual(x); }'
97
- value: '/** @param {*} a'
98
- ' @param {(number|string|boolean|null|undefined)} x */'
99
- 'function template(a, x) { expect(a).not.toEqual(x); }'
100
- error_message: 'Use expect.toBe for primitives'
101
- }
102
-
103
- requirement: {
104
- type: BANNED_CODE_PATTERN
105
- value: '/** @param {BufferSource} a */'
106
- 'function template(a) { new Uint8Array(a) }'
107
- value: '/** @param {BufferSource} a */'
108
- 'function template(a) { new Int8Array(a) }'
109
- value: '/** @param {BufferSource} a */'
110
- 'function template(a) { new Uint8ClampedArray(a) }'
111
- value: '/** @param {BufferSource} a */'
112
- 'function template(a) { new Unt16Array(a) }'
113
- value: '/** @param {BufferSource} a */'
114
- 'function template(a) { new Int16Array(a) }'
115
- value: '/** @param {BufferSource} a */'
116
- 'function template(a) { new Uint32Array(a) }'
117
- value: '/** @param {BufferSource} a */'
118
- 'function template(a) { new Int32Array(a) }'
119
- value: '/** @param {BufferSource} a */'
120
- 'function template(a) { new Float32Array(a) }'
121
- value: '/** @param {BufferSource} a */'
122
- 'function template(a) { new Float64Array(a) }'
123
- error_message: 'Use shaka.util.BufferUtils.view* instead.'
124
- whitelist_regexp: 'lib/util/buffer_utils.js'
125
- }
126
-
127
- requirement: {
128
- type: BANNED_CODE_PATTERN
129
- value: 'function template () { new Date().getTime() }'
130
- error_message: 'Use Date.now() instead.'
131
- }
132
-
133
- # Disallow console logging.
134
- requirement: {
135
- type: BANNED_PROPERTY_CALL
136
- value: 'Console.prototype.debug'
137
- value: 'Console.prototype.log'
138
- value: 'Console.prototype.info'
139
- value: 'Console.prototype.warn'
140
- value: 'Console.prototype.error'
141
- error_message: 'Using "console" is not allowed; '
142
- 'use shaka.log instead'
143
- whitelist_regexp: 'demo/'
144
- whitelist_regexp: 'lib/debug/log.js'
145
- whitelist_regexp: 'test/test/boot.js'
146
- whitelist_regexp: 'node_modules/'
147
- whitelist_regexp: '[synthetic:es6/promise/promise]'
148
- }
149
-
150
- # Disallow querySelector and querySelectorAll since they aren't supported on
151
- # Shaka Player Embedded.
152
- requirement: {
153
- type: BANNED_PROPERTY_CALL
154
- value: 'Element.prototype.querySelector'
155
- value: 'Document.prototype.querySelector'
156
- value: 'Element.prototype.querySelectorAll'
157
- value: 'Document.prototype.querySelectorAll'
158
- error_message: 'Use getElementsByTagName'
159
- whitelist_regexp: 'demo/'
160
- whitelist_regexp: 'ui/'
161
- whitelist_regexp: 'test/'
162
- whitelist_regexp: 'node_modules/'
163
- }
164
-
165
-
166
- # Disallow Element.children.
167
- requirement: {
168
- type: BANNED_PROPERTY
169
- value: 'Element.prototype.children'
170
- error_message: 'Using "Element.children" is not allowed; '
171
- 'use Node.childNodes instead'
172
- }
173
-
174
- requirement: {
175
- type: BANNED_PROPERTY
176
- value: 'DataView.prototype.buffer'
177
- value: 'TypedArray.prototype.buffer'
178
- error_message: 'Using "TypedArray.buffer" is not safe since it doesn\'t '
179
- 'handle sub-arrays'
180
- whitelist_regexp: 'lib/util/buffer_utils.js'
181
- whitelist_regexp: 'lib/util/object_utils.js'
182
- whitelist_regexp: 'test/util/buffer_utils_unit.js'
183
- }
184
-
185
-
186
- # Disallow Element.innerHTML and outerHTML.
187
- requirement: {
188
- type: BANNED_PROPERTY
189
- value: 'Element.prototype.innerHTML'
190
- value: 'Element.prototype.outerHTML'
191
- error_message: 'Using "Element.innerHTML" or "Element.outerHTML" is not '
192
- 'allowed due to security concerns; use textContent, '
193
- 'appendChild, or removeChild instead'
194
- whitelist_regexp: 'test/test/util/util.js'
195
- }
196
-
197
-
198
- # Disallow DOMRect.x and y.
199
- requirement: {
200
- type: BANNED_PROPERTY
201
- value: 'DOMRect.prototype.x'
202
- value: 'DOMRect.prototype.y'
203
- error_message: 'DOMRect "x" and "y" are not supported on legacy Edge; '
204
- 'use "left" and "top" instead.'
205
- # The built-in set and map polyfills trigger this ban somehow.
206
- whitelist_regexp: 'synthetic:es6/'
207
- }
208
-
209
-
210
- # Disallow fdescribe.
211
- requirement: {
212
- type: BANNED_NAME
213
- value: 'fdescribe'
214
- error_message: 'Using "fdescribe" is not allowed'
215
- }
216
-
217
-
218
- # Disallow fit.
219
- requirement: {
220
- type: BANNED_NAME
221
- value: 'fit'
222
- error_message: 'Using "fit" is not allowed'
223
- whitelist_regexp: 'test/player_external.js'
224
- }
225
-
226
-
227
- # Disallow setInterval.
228
- requirement: {
229
- type: BANNED_NAME
230
- value: 'window.setInterval'
231
- error_message: 'setInterval has several drawbacks, most of '
232
- 'all difficulty canceling and surprising behavior '
233
- 'when the device goes to sleep. Please use '
234
- 'shaka.util.Timer instead.'
235
- whitelist_regexp: 'demo/'
236
- whitelist_regexp: 'test/'
237
- }
238
- requirement: {
239
- type: BANNED_NAME
240
- value: 'setInterval'
241
- error_message: 'setInterval has several drawbacks, most of '
242
- 'all difficulty canceling and surprising behavior '
243
- 'when the device goes to sleep. Please use '
244
- 'shaka.util.Timer instead.'
245
- whitelist_regexp: 'demo/'
246
- whitelist_regexp: 'test/'
247
- }
248
-
249
- # Disallow setTimeout.
250
- requirement: {
251
- type: BANNED_NAME
252
- value: 'window.setTimeout'
253
- error_message: 'setTimeout has several drawbacks, most of '
254
- 'all difficulty canceling it. Please use '
255
- 'shaka.util.Timer instead.'
256
- whitelist_regexp: 'demo/'
257
- whitelist_regexp: 'test/'
258
- whitelist_regexp: 'lib/util/delayed_tick.js'
259
- }
260
- requirement: {
261
- type: BANNED_NAME
262
- value: 'setTimeout'
263
- error_message: 'setTimeout has several drawbacks, most of '
264
- 'all difficulty canceling it. Please use '
265
- 'shaka.util.Timer instead.'
266
- whitelist_regexp: 'demo/'
267
- whitelist_regexp: 'test/'
268
- }
269
-
270
-
271
- # Disallow eval, except when testing for modern JS syntax in demo
272
- requirement: {
273
- type: BANNED_NAME
274
- value: 'window.eval'
275
- error_message: 'Using "eval" is not allowed'
276
- whitelist_regexp: 'demo/demo_utils.js'
277
- whitelist_regexp: 'node_modules/google-closure-library/closure/goog/base.js'
278
- whitelist_regexp: 'test/util/functional_unit.js'
279
- }
280
- requirement: {
281
- type: BANNED_NAME
282
- value: 'eval'
283
- error_message: 'Using "eval" is not allowed'
284
- whitelist_regexp: 'demo/demo_utils.js'
285
- whitelist_regexp: 'node_modules/google-closure-library/closure/goog/base.js'
286
- whitelist_regexp: 'test/util/functional_unit.js'
287
- }
288
-
289
-
290
- # Disallow ES6 methods.
291
- requirement: {
292
- type: BANNED_PROPERTY
293
- value: 'ArrayBuffer.prototype.slice'
294
- error_message: 'ArrayBuffer.slice is not allowed because it '
295
- 'is not supported on Tizen 2016'
296
- }
297
-
298
- # Disallow the general use of fetch, which is not available on all supported
299
- # platforms.
300
- requirement: {
301
- type: BANNED_NAME_CALL
302
- value: 'fetch'
303
- value: 'window.fetch'
304
- error_message: 'Using "fetch" directly is not allowed; '
305
- 'use shaka.test.Util.fetch or NetworkingEngine.request '
306
- 'instead.'
307
- whitelist_regexp: 'lib/net/http_fetch_plugin.js'
308
- }
309
-
310
- # Disallow the use of generators, which are a major performance issue. See
311
- # https://github.com/shaka-project/shaka-player/issues/4062#issuecomment-1079428268
312
- requirement: {
313
- type: BANNED_CODE_PATTERN
314
- value:
315
- "/** @param {*} x */ "
316
- "function *template(x) { yield x; }"
317
- error_message:
318
- "ES6 generators are a major performance issue! Find another solution. "
319
- "See also https://bit.ly/3wAsoj5"
320
- whitelist_regexp: "node_modules/"
321
- }
@@ -1,20 +0,0 @@
1
- # Alpine was chosen by providing a node container less than 100mb
2
- FROM node:17.7.1-alpine3.15
3
-
4
- WORKDIR /usr/src/app
5
-
6
- # Install dependencies
7
- RUN apk add --update --no-cache openssh git python3 openjdk11-jre-headless
8
- RUN ln -sf python3 /usr/bin/python
9
-
10
- # Change to non-root user
11
- USER node
12
-
13
- # Prevent proxy timeout error (very slow connections)
14
- RUN npm config set fetch-retry-mintimeout 20000
15
- RUN npm config set fetch-retry-maxtimeout 120000
16
- RUN npm config rm proxy
17
- RUN npm config rm https-proxy
18
-
19
- # Run compilation
20
- CMD [ "python", "build/all.py" ]
@@ -1,10 +0,0 @@
1
- version: '3'
2
-
3
- services:
4
- shaka-compiler:
5
- build: ./
6
- container_name: shaka-compiler
7
- volumes:
8
- - ../../:/usr/src/app
9
-
10
- # Others services can be added here
package/build/docs.py DELETED
@@ -1,54 +0,0 @@
1
- #!/usr/bin/env python
2
- #
3
- # Copyright 2016 Google LLC
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
- """Builds the documentation from the source code.
18
-
19
- This deletes the old documentation first.
20
- """
21
-
22
- import argparse
23
- import logging
24
- import os
25
-
26
- import compiler
27
- import shakaBuildHelpers
28
-
29
-
30
- def main(args):
31
- """Builds the source code documentation."""
32
- logging.info('Building the docs...')
33
-
34
- parser = argparse.ArgumentParser(
35
- description=__doc__,
36
- formatter_class=argparse.RawDescriptionHelpFormatter)
37
- parser.add_argument(
38
- '--force',
39
- '-f',
40
- help='Force the docs to be built, even if no files have changed.',
41
- action='store_true')
42
-
43
- parsed_args = parser.parse_args(args)
44
-
45
- base = shakaBuildHelpers.get_source_base()
46
- config_path = os.path.join(base, 'docs', 'jsdoc.conf.json')
47
- jsdoc = compiler.Jsdoc(config_path)
48
- if not jsdoc.build(parsed_args.force):
49
- return 1
50
- return 0
51
-
52
-
53
- if __name__ == '__main__':
54
- shakaBuildHelpers.run_main(main)
@@ -1,72 +0,0 @@
1
- /*! @license
2
- * Shaka Player
3
- * Copyright 2016 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- const assert = require('assert');
8
-
9
- module.exports = {
10
- meta: {
11
- type: 'suggestion',
12
- docs: {
13
- description: 'Required spacing around argument comments',
14
- category: 'Best Practices',
15
- recommended: false,
16
- },
17
- fixable: 'code',
18
- schema: [],
19
- },
20
- create: (ctx) => {
21
- const source = ctx.getSourceCode();
22
- return {
23
- ':matches(CallExpression, NewExpression)': (node) => {
24
- for (const arg of node.arguments) {
25
- const filter = (c) => c.type == 'Block' && !c.value.includes('@');
26
- const beforeComments = source.getCommentsBefore(arg).filter(filter);
27
- if (beforeComments.length > 1) {
28
- ctx.report({
29
- node: beforeComments[0],
30
- message: 'Multiple comments around arguments',
31
- });
32
- continue;
33
- }
34
-
35
- const afterComments = source.getCommentsAfter(arg).filter(filter);
36
- if (afterComments.length > 0) {
37
- ctx.report({
38
- node: afterComments[0],
39
- message: 'Argument comment should appear before argument',
40
- fix: (fixer) => {
41
- return [
42
- fixer.remove(afterComments[0]),
43
- fixer.insertTextBefore(
44
- arg, '/*' + afterComments[0].value + '*/ '),
45
- ];
46
- },
47
- });
48
- continue;
49
- }
50
-
51
- const comment = beforeComments.pop();
52
- if (!comment) {
53
- continue;
54
- }
55
-
56
- if (!/ \w+= /.exec(comment.value)) {
57
- ctx.report({
58
- node: comment,
59
- message: 'Bad spacing for argument comment',
60
- fix: (fixer) => {
61
- const newComment =
62
- comment.value.replace(/\W*(\w+).*/, ' $1= ');
63
- return fixer.replaceText(comment, '/*' + newComment + '*/');
64
- },
65
- });
66
- }
67
- }
68
- },
69
- };
70
- },
71
- };
72
-
@@ -1,24 +0,0 @@
1
- /*! @license
2
- * Shaka Player
3
- * Copyright 2016 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- module.exports = {
8
- rules: {},
9
- configs: {
10
- config: {
11
- plugins: ['shaka-rules'],
12
- rules: {},
13
- },
14
- },
15
- };
16
-
17
- const RULES = [
18
- 'arg-comment-spacing',
19
- 'private',
20
- ];
21
- for (const rule of RULES) {
22
- module.exports.rules[rule] = require('./' + rule);
23
- module.exports.configs.config.rules['shaka-rules/' + rule] = 'error';
24
- }
@@ -1,7 +0,0 @@
1
- {
2
- "name": "eslint-plugin-shaka-rules",
3
- "description": "Extra eslint rules for Shaka Player",
4
- "version": "0.0.1",
5
- "main": "index.js",
6
- "private": true
7
- }
@@ -1,109 +0,0 @@
1
- /*! @license
2
- * Shaka Player
3
- * Copyright 2016 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- const assert = require('assert');
8
-
9
- module.exports = {
10
- meta: {
11
- type: 'suggestion',
12
- docs: {
13
- description: 'Require correct naming of @private members',
14
- category: 'Best Practices',
15
- recommended: false,
16
- },
17
- fixable: 'code',
18
- schema: [],
19
- },
20
- create: (ctx) => {
21
- const fixComment = (comment, addPrivate) => {
22
- // The "value" field contains the *body* of the comment; so it will look
23
- // like '* foo\n * bar\n '. This return value needs to be the
24
- // code to inject, so we need to add the /* and */ back.
25
- assert.equal(comment.type, 'Block');
26
- assert(comment.value.startsWith('*'));
27
- let lines = comment.value.split('\n');
28
- const firstIndent = ' '.repeat(comment.loc.start.column);
29
- const prefix = firstIndent + ' * ';
30
-
31
- if (lines.length == 1) {
32
- if (addPrivate) {
33
- // /** Foobar */
34
- // =>
35
- // /**
36
- // * Foobar
37
- // * @private
38
- // */
39
- const body = lines[0].substr(1).trim();
40
- return '/**\n' + prefix + body + '\n' + prefix + '@private\n' +
41
- firstIndent + ' */';
42
- } else {
43
- // /** @override @private */
44
- // =>
45
- // /** @override */
46
- return '/** ' + lines[0].substr(1).replace('@private', '').trim() +
47
- ' */';
48
- }
49
- }
50
-
51
- if (addPrivate) {
52
- lines.splice(lines.length - 1, 0, prefix + '@private');
53
- } else {
54
- lines = lines.filter((line) => {
55
- if (line.includes('@private')) {
56
- // Assert the @private is on its own line.
57
- assert(line.startsWith(prefix));
58
- assert.equal(
59
- line.substr(prefix.length).replace('@private', '').trim(), '');
60
- return false;
61
- }
62
- return true;
63
- });
64
- }
65
- return '/*' + lines.join('\n') + '*/';
66
- };
67
-
68
- const source = ctx.getSourceCode();
69
- return {
70
- 'ClassBody > MethodDefinition': (node) => {
71
- const comment = source.getCommentsBefore(node).pop();
72
- const nameIsPrivate = node.key.name && node.key.name.endsWith('_');
73
- if (!comment) {
74
- if (nameIsPrivate) {
75
- ctx.report({
76
- node: node,
77
- message: 'Missing @private annotation on private member@',
78
- fix: (fixer) => {
79
- const indent = ' '.repeat(node.loc.start.column);
80
- return fixer.insertTextBefore(
81
- node, '/** @private */\n' + indent);
82
- },
83
- });
84
- }
85
- return;
86
- }
87
-
88
- const docHasPrivate = comment.value.includes('@private');
89
- if (nameIsPrivate && !docHasPrivate) {
90
- ctx.report({
91
- node: node,
92
- message: 'Missing @private annotation on private member',
93
- fix: (fixer) => {
94
- return fixer.replaceText(comment, fixComment(comment, true));
95
- },
96
- });
97
- } else if (!nameIsPrivate && docHasPrivate) {
98
- ctx.report({
99
- node: node,
100
- message: 'Invalid name for private member',
101
- fix: (fixer) => {
102
- return fixer.replaceText(comment, fixComment(comment, false));
103
- },
104
- });
105
- }
106
- },
107
- };
108
- },
109
- };
package/build/gendeps.py DELETED
@@ -1,71 +0,0 @@
1
- #!/usr/bin/env python
2
- #
3
- # Copyright 2016 Google LLC
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
- """Creates the Closure dependencies file required to run in uncompiled mode."""
18
-
19
- import logging
20
- import os
21
- import subprocess
22
- import sys
23
-
24
- import shakaBuildHelpers
25
-
26
-
27
- def main(_):
28
- """Generates the uncompiled dependencies files."""
29
- # Update node modules if needed.
30
- if not shakaBuildHelpers.update_node_modules():
31
- return 1
32
-
33
- logging.info('Generating Closure dependencies...')
34
-
35
- # Make the dist/ folder, ignore errors.
36
- base = shakaBuildHelpers.get_source_base()
37
- try:
38
- os.mkdir(os.path.join(base, 'dist'))
39
- except OSError:
40
- pass
41
- os.chdir(base)
42
-
43
- make_deps = shakaBuildHelpers.get_node_binary(
44
- 'google-closure-deps', 'closure-make-deps')
45
-
46
- try:
47
- cmd_line = make_deps + [
48
- # Folders to search for sources using goog.require/goog.provide
49
- '-r', 'demo', 'lib', 'ui', 'third_party',
50
- # Individual files to add to those
51
- '-f', 'dist/locales.js',
52
- # The path to the folder containing the Closure library's base.js
53
- '--closure-path', 'node_modules/google-closure-library/closure/goog',
54
- ]
55
- deps = shakaBuildHelpers.execute_get_output(cmd_line)
56
-
57
- # This command doesn't use exit codes for some stupid reason.
58
- # TODO: Remove when https://github.com/google/closure-library/issues/1162
59
- # is resolved and we have upgraded.
60
- if len(deps) == 0:
61
- return 1
62
-
63
- with open(os.path.join(base, 'dist', 'deps.js'), 'wb') as f:
64
- f.write(deps)
65
- return 0
66
- except subprocess.CalledProcessError as e:
67
- return e.returncode
68
-
69
-
70
- if __name__ == '__main__':
71
- shakaBuildHelpers.run_main(main)