chrome-devtools-frontend 1.0.948916 → 1.0.949424

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 (23) hide show
  1. package/config/gni/all_devtools_files.gni +5 -0
  2. package/config/gni/devtools_grd_files.gni +5 -0
  3. package/front_end/core/i18n/locales/en-US.json +21 -0
  4. package/front_end/core/i18n/locales/en-XL.json +21 -0
  5. package/front_end/core/root/Runtime.ts +1 -0
  6. package/front_end/core/sdk/AccessibilityModel.ts +7 -7
  7. package/front_end/models/issues_manager/AttributionReportingIssue.ts +20 -5
  8. package/front_end/models/issues_manager/descriptions/arInvalidAttributionSourceExpiry.md +4 -0
  9. package/front_end/models/issues_manager/descriptions/arInvalidAttributionSourcePriority.md +4 -0
  10. package/front_end/models/issues_manager/descriptions/arInvalidEventSourceTriggerData.md +9 -0
  11. package/front_end/models/issues_manager/descriptions/arInvalidTriggerDedupKey.md +5 -0
  12. package/front_end/models/issues_manager/descriptions/arInvalidTriggerPriority.md +5 -0
  13. package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +45 -3
  14. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +2 -4
  15. package/front_end/panels/accessibility/axBreadcrumbs.css +4 -0
  16. package/front_end/panels/elements/AccessibilityTreeView.ts +4 -6
  17. package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +44 -0
  18. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +1 -0
  19. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  20. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +8 -6
  21. package/front_end/third_party/codemirror.next/package.json +3 -3
  22. package/package.json +1 -1
  23. package/scripts/build/rjsmin.py +0 -484
@@ -2276,6 +2276,7 @@ interface MeasureRequest<T> {
2276
2276
  */
2277
2277
  key?: any;
2278
2278
  }
2279
+ declare type AttrSource = Attrs | ((view: EditorView) => Attrs | null);
2279
2280
  /**
2280
2281
  View [plugins](https://codemirror.net/6/docs/ref/#view.ViewPlugin) are given instances of this
2281
2282
  class, which describe what happened, whenever the view is updated.
@@ -2539,6 +2540,7 @@ declare class EditorView {
2539
2540
  readonly contentDOM: HTMLElement;
2540
2541
  private announceDOM;
2541
2542
  private plugins;
2543
+ private pluginMap;
2542
2544
  private editorAttrs;
2543
2545
  private contentAttrs;
2544
2546
  private styleModules;
@@ -2960,12 +2962,12 @@ declare class EditorView {
2960
2962
  Facet that provides additional DOM attributes for the editor's
2961
2963
  editable DOM element.
2962
2964
  */
2963
- static contentAttributes: Facet<Attrs, Attrs>;
2965
+ static contentAttributes: Facet<AttrSource, readonly AttrSource[]>;
2964
2966
  /**
2965
2967
  Facet that provides DOM attributes for the editor's outer
2966
2968
  element.
2967
2969
  */
2968
- static editorAttributes: Facet<Attrs, Attrs>;
2970
+ static editorAttributes: Facet<AttrSource, readonly AttrSource[]>;
2969
2971
  /**
2970
2972
  An extension that enables line wrapping in the editor (by
2971
2973
  setting CSS `white-space` to `pre-wrap` in the content).
@@ -3157,10 +3159,10 @@ Configuration options.
3157
3159
  config?: SpecialCharConfig): Extension;
3158
3160
 
3159
3161
  /**
3160
- Returns a plugin that makes sure the content has a bottom margin
3161
- equivalent to the height of the editor, minus one line height, so
3162
- that every line in the document can be scrolled to the top of the
3163
- editor.
3162
+ Returns an extension that makes sure the content has a bottom
3163
+ margin equivalent to the height of the editor, minus one line
3164
+ height, so that every line in the document can be scrolled to the
3165
+ top of the editor.
3164
3166
 
3165
3167
  This is only meaningful when the editor is scrollable, and should
3166
3168
  not be enabled in editors that take the size of their content.
@@ -8,7 +8,7 @@
8
8
  "@codemirror/commands": "0.19.5",
9
9
  "@codemirror/comment": "0.19.0",
10
10
  "@codemirror/fold": "0.19.2",
11
- "@codemirror/gutter": "0.19.7",
11
+ "@codemirror/gutter": "0.19.8",
12
12
  "@codemirror/highlight": "0.19.6",
13
13
  "@codemirror/history": "0.19.0",
14
14
  "@codemirror/lang-cpp": "0.19.1",
@@ -22,7 +22,7 @@
22
22
  "@codemirror/lang-python": "0.19.2",
23
23
  "@codemirror/lang-wast": "0.19.0",
24
24
  "@codemirror/lang-xml": "0.19.2",
25
- "@codemirror/language": "0.19.6",
25
+ "@codemirror/language": "0.19.7",
26
26
  "@codemirror/legacy-modes": "0.19.0",
27
27
  "@codemirror/matchbrackets": "0.19.3",
28
28
  "@codemirror/panel": "0.19.0",
@@ -32,7 +32,7 @@
32
32
  "@codemirror/stream-parser": "0.19.2",
33
33
  "@codemirror/text": "0.19.5",
34
34
  "@codemirror/tooltip": "0.19.10",
35
- "@codemirror/view": "0.19.23",
35
+ "@codemirror/view": "0.19.25",
36
36
  "@lezer/common": "0.15.10",
37
37
  "@lezer/lr": "0.15.5",
38
38
  "@rollup/plugin-node-resolve": "^13.0.4",
package/package.json CHANGED
@@ -53,5 +53,5 @@
53
53
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
54
54
  "watch": "third_party/node/node.py --output scripts/watch_build.js"
55
55
  },
56
- "version": "1.0.948916"
56
+ "version": "1.0.949424"
57
57
  }
@@ -1,484 +0,0 @@
1
- #!/usr/bin/env vpython
2
- # -*- coding: ascii -*-
3
- r"""
4
- =====================
5
- Javascript Minifier
6
- =====================
7
-
8
- rJSmin is a javascript minifier written in python.
9
-
10
- The minifier is based on the semantics of `jsmin.c by Douglas Crockford`_\\.
11
-
12
- :Copyright:
13
-
14
- Copyright 2011 - 2015
15
- Andr\xe9 Malo or his licensors, as applicable
16
-
17
- :License:
18
-
19
- Licensed under the Apache License, Version 2.0 (the "License");
20
- you may not use this file except in compliance with the License.
21
- You may obtain a copy of the License at
22
-
23
- http://www.apache.org/licenses/LICENSE-2.0
24
-
25
- Unless required by applicable law or agreed to in writing, software
26
- distributed under the License is distributed on an "AS IS" BASIS,
27
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
- See the License for the specific language governing permissions and
29
- limitations under the License.
30
-
31
- The module is a re-implementation aiming for speed, so it can be used at
32
- runtime (rather than during a preprocessing step). Usually it produces the
33
- same results as the original ``jsmin.c``. It differs in the following ways:
34
-
35
- - there is no error detection: unterminated string, regex and comment
36
- literals are treated as regular javascript code and minified as such.
37
- - Control characters inside string and regex literals are left untouched; they
38
- are not converted to spaces (nor to \\n)
39
- - Newline characters are not allowed inside string and regex literals, except
40
- for line continuations in string literals (ECMA-5).
41
- - "return /regex/" is recognized correctly.
42
- - Line terminators after regex literals are handled more sensibly
43
- - "+ +" and "- -" sequences are not collapsed to '++' or '--'
44
- - Newlines before ! operators are removed more sensibly
45
- - Comments starting with an exclamation mark (``!``) can be kept optionally
46
- - rJSmin does not handle streams, but only complete strings. (However, the
47
- module provides a "streamy" interface).
48
-
49
- Since most parts of the logic are handled by the regex engine it's way faster
50
- than the original python port of ``jsmin.c`` by Baruch Even. The speed factor
51
- varies between about 6 and 55 depending on input and python version (it gets
52
- faster the more compressed the input already is). Compared to the
53
- speed-refactored python port by Dave St.Germain the performance gain is less
54
- dramatic but still between 3 and 50 (for huge inputs). See the docs/BENCHMARKS
55
- file for details.
56
-
57
- rjsmin.c is a reimplementation of rjsmin.py in C and speeds it up even more.
58
-
59
- Both python 2 and python 3 are supported.
60
-
61
- .. _jsmin.c by Douglas Crockford:
62
- http://www.crockford.com/javascript/jsmin.c
63
- """
64
- if __doc__:
65
- # pylint: disable = redefined-builtin
66
- __doc__ = __doc__.encode('ascii').decode('unicode_escape')
67
- __author__ = r"Andr\xe9 Malo".encode('ascii').decode('unicode_escape')
68
- __docformat__ = "restructuredtext en"
69
- __license__ = "Apache License, Version 2.0"
70
- __version__ = '1.0.12'
71
- __all__ = ['jsmin']
72
-
73
- import re as _re
74
-
75
-
76
- def _make_jsmin(python_only=False):
77
- """
78
- Generate JS minifier based on `jsmin.c by Douglas Crockford`_
79
-
80
- .. _jsmin.c by Douglas Crockford:
81
- http://www.crockford.com/javascript/jsmin.c
82
-
83
- :Parameters:
84
- `python_only` : ``bool``
85
- Use only the python variant. If true, the c extension is not even
86
- tried to be loaded.
87
-
88
- :Return: Minifier
89
- :Rtype: ``callable``
90
- """
91
- # pylint: disable = unused-variable
92
- # pylint: disable = too-many-locals
93
-
94
- if not python_only:
95
- try:
96
- import _rjsmin
97
- except ImportError:
98
- pass
99
- else:
100
- return _rjsmin.jsmin
101
- try:
102
- xrange
103
- except NameError:
104
- xrange = range # pylint: disable = redefined-builtin
105
-
106
- space_chars = r'[\000-\011\013\014\016-\040]'
107
-
108
- line_comment = r'(?://[^\r\n]*)'
109
- space_comment = r'(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)'
110
- space_comment_nobang = r'(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*\*+)*/)'
111
- bang_comment = r'(?:/\*![^*]*\*+(?:[^/*][^*]*\*+)*/)'
112
-
113
- string1 = \
114
- r'(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]|\r?\n|\r)[^\047\\\r\n]*)*\047)'
115
- string2 = r'(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]|\r?\n|\r)[^"\\\r\n]*)*")'
116
- string3 = r'(?:`(?:[^`\\]|\\.)*`)'
117
- strings = r'(?:%s|%s|%s)' % (string1, string2, string3)
118
-
119
- charclass = r'(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\])'
120
- nospecial = r'[^/\\\[\r\n]'
121
- regex = r'(?:/(?![\r\n/*])%s*(?:(?:\\[^\r\n]|%s)%s*)*/)' % (
122
- nospecial, charclass, nospecial)
123
- space = r'(?:%s|%s)' % (space_chars, space_comment)
124
- newline = r'(?:%s?[\r\n])' % line_comment
125
-
126
- def fix_charclass(result):
127
- """ Fixup string of chars to fit into a regex char class """
128
- pos = result.find('-')
129
- if pos >= 0:
130
- result = r'%s%s-' % (result[:pos], result[pos + 1:])
131
-
132
- def sequentize(string):
133
- """
134
- Notate consecutive characters as sequence
135
-
136
- (1-4 instead of 1234)
137
- """
138
- first, last, result = None, None, []
139
- for char in map(ord, string):
140
- if last is None:
141
- first = last = char
142
- elif last + 1 == char:
143
- last = char
144
- else:
145
- result.append((first, last))
146
- first = last = char
147
- if last is not None:
148
- result.append((first, last))
149
- return ''.join([
150
- '%s%s%s' % (chr(first), last > first + 1 and '-'
151
- or '', last != first and chr(last) or '')
152
- for first, last in result
153
- ]) # noqa
154
-
155
- return _re.sub(
156
- r'([\000-\040\047])', # \047 for better portability
157
- lambda m: '\\%03o' % ord(m.group(1)),
158
- (sequentize(result).replace('\\', '\\\\').replace(
159
- '[', '\\[').replace(']', '\\]')))
160
-
161
- def id_literal_(what):
162
- """ Make id_literal like char class """
163
- match = _re.compile(what).match
164
- result = ''.join([chr(c) for c in xrange(127) if not match(chr(c))])
165
- return '[^%s]' % fix_charclass(result)
166
-
167
- def not_id_literal_(keep):
168
- """ Make negated id_literal like char class """
169
- match = _re.compile(id_literal_(keep)).match
170
- result = ''.join([chr(c) for c in xrange(127) if not match(chr(c))])
171
- return r'[%s]' % fix_charclass(result)
172
-
173
- not_id_literal = not_id_literal_(r'[a-zA-Z0-9_$]')
174
- preregex1 = r'[(,=:\[!&|?{};\r\n]'
175
- preregex2 = r'%(not_id_literal)sreturn' % locals()
176
-
177
- id_literal = id_literal_(r'[a-zA-Z0-9_$]')
178
- id_literal_open = id_literal_(r'[a-zA-Z0-9_${\[(!+-]')
179
- id_literal_close = id_literal_(r'[a-zA-Z0-9_$}\])"\047+-]')
180
- post_regex_off = id_literal_(r'[^\000-\040}\])?:|,;.&=+-]')
181
-
182
- dull = r'[^\047"`/\000-\040]'
183
-
184
- space_sub_simple = _re.compile((
185
- # noqa pylint: disable = bad-continuation
186
- r'(%(dull)s+)' # 0
187
- r'|(%(strings)s%(dull)s*)' # 1
188
- r'|(?<=%(preregex1)s)'
189
- r'%(space)s*(?:%(newline)s%(space)s*)*'
190
- r'(%(regex)s)' # 2
191
- r'(%(space)s*(?:%(newline)s%(space)s*)+' # 3
192
- r'(?=%(post_regex_off)s))?'
193
- r'|(?<=%(preregex2)s)'
194
- r'%(space)s*(?:(%(newline)s)%(space)s*)*' # 4
195
- r'(%(regex)s)' # 5
196
- r'(%(space)s*(?:%(newline)s%(space)s*)+' # 6
197
- r'(?=%(post_regex_off)s))?'
198
- r'|(?<=%(id_literal_close)s)'
199
- r'%(space)s*(?:(%(newline)s)%(space)s*)+' # 7
200
- r'(?=%(id_literal_open)s)'
201
- r'|(?<=%(id_literal)s)(%(space)s)+(?=%(id_literal)s)' # 8
202
- r'|(?<=\+)(%(space)s)+(?=\+)' # 9
203
- r'|(?<=-)(%(space)s)+(?=-)' # 10
204
- r'|%(space)s+'
205
- r'|(?:%(newline)s%(space)s*)+') % locals()).sub
206
-
207
- # print space_sub_simple.__self__.pattern
208
-
209
- def space_subber_simple(match):
210
- """ Substitution callback """
211
- # pylint: disable = too-many-return-statements
212
-
213
- groups = match.groups()
214
- if groups[0]:
215
- return groups[0]
216
- elif groups[1]:
217
- return groups[1]
218
- elif groups[2]:
219
- if groups[3]:
220
- return groups[2] + '\n'
221
- return groups[2]
222
- elif groups[5]:
223
- return "%s%s%s" % (
224
- groups[4] and '\n' or '',
225
- groups[5],
226
- groups[6] and '\n' or '',
227
- )
228
- elif groups[7]:
229
- return '\n'
230
- elif groups[8] or groups[9] or groups[10]:
231
- return ' '
232
- else:
233
- return ''
234
-
235
- space_sub_banged = _re.compile((
236
- # noqa pylint: disable = bad-continuation
237
- r'(%(dull)s+)' # 0
238
- r'|(%(strings)s%(dull)s*)' # 1
239
- r'|(?<=%(preregex1)s)'
240
- r'(%(space)s*(?:%(newline)s%(space)s*)*)' # 2
241
- r'(%(regex)s)' # 3
242
- r'(%(space)s*(?:%(newline)s%(space)s*)+' # 4
243
- r'(?=%(post_regex_off)s))?'
244
- r'|(?<=%(preregex2)s)'
245
- r'(%(space)s*(?:(%(newline)s)%(space)s*)*)' # 5, 6
246
- r'(%(regex)s)' # 7
247
- r'(%(space)s*(?:%(newline)s%(space)s*)+' # 8
248
- r'(?=%(post_regex_off)s))?'
249
- r'|(?<=%(id_literal_close)s)'
250
- r'(%(space)s*(?:%(newline)s%(space)s*)+)' # 9
251
- r'(?=%(id_literal_open)s)'
252
- r'|(?<=%(id_literal)s)(%(space)s+)(?=%(id_literal)s)' # 10
253
- r'|(?<=\+)(%(space)s+)(?=\+)' # 11
254
- r'|(?<=-)(%(space)s+)(?=-)' # 12
255
- r'|(%(space)s+)' # 13
256
- r'|((?:%(newline)s%(space)s*)+)' # 14
257
- ) % locals()).sub
258
-
259
- # print space_sub_banged.__self__.pattern
260
-
261
- keep = _re.compile(
262
- (r'%(space_chars)s+|%(space_comment_nobang)s+|%(newline)s+'
263
- r'|(%(bang_comment)s+)') % locals()).sub
264
- keeper = lambda m: m.groups()[0] or ''
265
-
266
- # print keep.__self__.pattern
267
-
268
- def space_subber_banged(match):
269
- """ Substitution callback """
270
- # pylint: disable = too-many-return-statements
271
-
272
- groups = match.groups()
273
- if groups[0]:
274
- return groups[0]
275
- elif groups[1]:
276
- return groups[1]
277
- elif groups[3]:
278
- return "%s%s%s%s" % (
279
- keep(keeper, groups[2]),
280
- groups[3],
281
- keep(keeper, groups[4] or ''),
282
- groups[4] and '\n' or '',
283
- )
284
- elif groups[7]:
285
- return "%s%s%s%s%s" % (
286
- keep(keeper, groups[5]),
287
- groups[6] and '\n' or '',
288
- groups[7],
289
- keep(keeper, groups[8] or ''),
290
- groups[8] and '\n' or '',
291
- )
292
- elif groups[9]:
293
- return keep(keeper, groups[9]) + '\n'
294
- elif groups[10] or groups[11] or groups[12]:
295
- return keep(keeper, groups[10] or groups[11] or groups[12]) or ' '
296
- else:
297
- return keep(keeper, groups[13] or groups[14])
298
-
299
- def jsmin(script, keep_bang_comments=False):
300
- r"""
301
- Minify javascript based on `jsmin.c by Douglas Crockford`_\.
302
-
303
- Instead of parsing the stream char by char, it uses a regular
304
- expression approach which minifies the whole script with one big
305
- substitution regex.
306
-
307
- .. _jsmin.c by Douglas Crockford:
308
- http://www.crockford.com/javascript/jsmin.c
309
-
310
- :Parameters:
311
- `script` : ``str``
312
- Script to minify
313
-
314
- `keep_bang_comments` : ``bool``
315
- Keep comments starting with an exclamation mark? (``/*!...*/``)
316
-
317
- :Return: Minified script
318
- :Rtype: ``str``
319
- """
320
- # pylint: disable = redefined-outer-name
321
-
322
- if keep_bang_comments:
323
- return space_sub_banged(space_subber_banged,
324
- '\n%s\n' % script).strip()
325
- else:
326
- return space_sub_simple(space_subber_simple,
327
- '\n%s\n' % script).strip()
328
-
329
- return jsmin
330
-
331
-
332
- jsmin = _make_jsmin()
333
-
334
-
335
- def jsmin_for_posers(script, keep_bang_comments=False):
336
- r"""
337
- Minify javascript based on `jsmin.c by Douglas Crockford`_\.
338
-
339
- Instead of parsing the stream char by char, it uses a regular
340
- expression approach which minifies the whole script with one big
341
- substitution regex.
342
-
343
- .. _jsmin.c by Douglas Crockford:
344
- http://www.crockford.com/javascript/jsmin.c
345
-
346
- :Warning: This function is the digest of a _make_jsmin() call. It just
347
- utilizes the resulting regexes. It's here for fun and may
348
- vanish any time. Use the `jsmin` function instead.
349
-
350
- :Parameters:
351
- `script` : ``str``
352
- Script to minify
353
-
354
- `keep_bang_comments` : ``bool``
355
- Keep comments starting with an exclamation mark? (``/*!...*/``)
356
-
357
- :Return: Minified script
358
- :Rtype: ``str``
359
- """
360
- if not keep_bang_comments:
361
- rex = (
362
- r'([^\047"/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]'
363
- r'|\r?\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]'
364
- r'|\r?\n|\r)[^"\\\r\n]*)*"))[^\047"/\000-\040]*)|(?<=[(,=:\[!&|?'
365
- r'{};\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*'
366
- r'][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\0'
367
- r'14\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*((?:/(?![\r'
368
- r'\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r'
369
- r'\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/))((?:[\000-\011\013\014'
370
- r'\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r'
371
- r'\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:'
372
- r'[^/*][^*]*\*+)*/))*)+(?=[^\000-\040&)+,.:;=?\]|}-]))?|(?<=[\00'
373
- r'0-#%-,./:-@\[-^`{-~-]return)(?:[\000-\011\013\014\016-\040]|(?'
374
- r':/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:((?:(?://[^\r\n]*)?[\r\n]'
375
- r'))(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*'
376
- r'\*+)*/))*)*((?:/(?![\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\['
377
- r'[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/))(('
378
- r'?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)'
379
- r'*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\04'
380
- r'0]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040&)+,.:;'
381
- r'=?\]|}-]))?|(?<=[^\000-!#%&(*,./:-@\[\\^`{|~])(?:[\000-\011\01'
382
- r'3\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:((?:(?:'
383
- r'//[^\r\n]*)?[\r\n]))(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]'
384
- r'*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040"#%-\047)*,./:-@\\-^'
385
- r'`|-~])|(?<=[^\000-#%-,./:-@\[-^`{-~-])((?:[\000-\011\013\014\0'
386
- r'16-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=[^\000-#%-,./'
387
- r':-@\[-^`{-~-])|(?<=\+)((?:[\000-\011\013\014\016-\040]|(?:/\*['
388
- r'^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=\+)|(?<=-)((?:[\000-\011\013'
389
- r'\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=-)|(?:['
390
- r'\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)'
391
- r')+|(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]'
392
- r'|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+')
393
-
394
- def subber(match):
395
- """ Substitution callback """
396
- groups = match.groups()
397
- return (groups[0] or groups[1]
398
- or (groups[3] and (groups[2] + '\n')) or groups[2]
399
- or (groups[5] and "%s%s%s" % (
400
- groups[4] and '\n' or '',
401
- groups[5],
402
- groups[6] and '\n' or '',
403
- )) or (groups[7] and '\n') or (groups[8] and ' ')
404
- or (groups[9] and ' ') or (groups[10] and ' ') or '')
405
- else:
406
- rex = (
407
- r'([^\047"/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]'
408
- r'|\r?\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]'
409
- r'|\r?\n|\r)[^"\\\r\n]*)*"))[^\047"/\000-\040]*)|(?<=[(,=:\[!&|?'
410
- r'{};\r\n])((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/'
411
- r'*][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013'
412
- r'\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*)((?:/(?!'
413
- r'[\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^'
414
- r'\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/))((?:[\000-\011\013\01'
415
- r'4\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^'
416
- r'\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+('
417
- r'?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040&)+,.:;=?\]|}-]))?|(?<=['
418
- r'\000-#%-,./:-@\[-^`{-~-]return)((?:[\000-\011\013\014\016-\040'
419
- r']|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:((?:(?://[^\r\n]*)?['
420
- r'\r\n]))(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*]['
421
- r'^*]*\*+)*/))*)*)((?:/(?![\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|'
422
- r'(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*'
423
- r'/))((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]'
424
- r'*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\01'
425
- r'6-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040&)'
426
- r'+,.:;=?\]|}-]))?|(?<=[^\000-!#%&(*,./:-@\[\\^`{|~])((?:[\000-'
427
- r'\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:'
428
- r'(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/'
429
- r'\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+)(?=[^\000-\040"#%-\047)*,./'
430
- r':-@\\-^`|-~])|(?<=[^\000-#%-,./:-@\[-^`{-~-])((?:[\000-\011\01'
431
- r'3\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+)(?=[^\000'
432
- r'-#%-,./:-@\[-^`{-~-])|(?<=\+)((?:[\000-\011\013\014\016-\040]|'
433
- r'(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+)(?=\+)|(?<=-)((?:[\000-\0'
434
- r'11\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+)(?=-'
435
- r')|((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*'
436
- r'\*+)*/))+)|((?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014'
437
- r'\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+)')
438
-
439
- keep = _re.compile(
440
- (r'[\000-\011\013\014\016-\040]+|(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*'
441
- r'\*+)*/)+|(?:(?://[^\r\n]*)?[\r\n])+|((?:/\*![^*]*\*+(?:[^/*][^'
442
- r'*]*\*+)*/)+)') % locals()).sub
443
- keeper = lambda m: m.groups()[0] or ''
444
-
445
- def subber(match):
446
- """ Substitution callback """
447
- groups = match.groups()
448
- return (groups[0] or groups[1] or (groups[3] and "%s%s%s%s" % (
449
- keep(keeper, groups[2]),
450
- groups[3],
451
- keep(keeper, groups[4] or ''),
452
- groups[4] and '\n' or '',
453
- )) or (groups[7] and "%s%s%s%s%s" % (
454
- keep(keeper, groups[5]),
455
- groups[6] and '\n' or '',
456
- groups[7],
457
- keep(keeper, groups[8] or ''),
458
- groups[8] and '\n' or '',
459
- )) or (groups[9] and keep(keeper, groups[9] + '\n'))
460
- or (groups[10] and keep(keeper, groups[10]) or ' ')
461
- or (groups[11] and keep(keeper, groups[11]) or ' ')
462
- or (groups[12] and keep(keeper, groups[12]) or ' ')
463
- or keep(keeper, groups[13] or groups[14]))
464
-
465
- return _re.sub(rex, subber, '\n%s\n' % script).strip()
466
-
467
-
468
- if __name__ == '__main__':
469
-
470
- def main():
471
- """ Main """
472
- import sys as _sys
473
-
474
- argv = _sys.argv[1:]
475
- keep_bang_comments = '-b' in argv or '-bp' in argv or '-pb' in argv
476
- if '-p' in argv or '-bp' in argv or '-pb' in argv:
477
- xjsmin = _make_jsmin(python_only=True)
478
- else:
479
- xjsmin = jsmin
480
-
481
- _sys.stdout.write(
482
- xjsmin(_sys.stdin.read(), keep_bang_comments=keep_bang_comments))
483
-
484
- main()