jscrewit 2.33.1 → 2.35.0

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.
@@ -73,7 +73,7 @@ Feature.name
73
73
 
74
74
  ### includes
75
75
 
76
- ▸ **includes**(...`features`): `boolean`
76
+ ▸ **includes**(`...features`): `boolean`
77
77
 
78
78
  Determines whether this feature object includes all of the specified features.
79
79
 
@@ -110,7 +110,7 @@ that require strict mode code, or inside web workers.
110
110
 
111
111
  | Name | Type | Description |
112
112
  | :------ | :------ | :------ |
113
- | `environment` | ``"forced-strict-mode"`` \| ``"web-worker"`` | The environment to which this feature should be restricted. Two environments are currently supported. <dl> <dt><code>"forced-strict-mode"</code></dt> <dd> Removes features that are not available in environments that require strict mode code. </dd> <dt><code>"web-worker"</code></dt> <dd>Removes features that are not available inside web workers.</dd> </dl> |
113
+ | `environment` | ``"forced-strict-mode"`` \| ``"web-worker"`` | The environment to which this feature should be restricted. Two environments are currently supported. <dl> <dt><code>"forced-strict-mode"</code></dt> <dd> Removes features that are not available in environments that require strict mode code. </dd> <dt><code>"web-worker"</code></dt> <dd>Removes features that are not available inside web workers.</dd> </dl> |
114
114
  | `engineFeatureObjs?` | readonly [`PredefinedFeature`](PredefinedFeature.md)[] | An array of predefined feature objects, each corresponding to a particular engine in which the restriction should be enacted. If this parameter is omitted, the restriction is enacted in all engines. |
115
115
 
116
116
  #### Returns
@@ -1,7 +1,5 @@
1
1
  # Interface: default
2
2
 
3
- JScrewIt object, available in Node.js.
4
-
5
3
  ## Table of contents
6
4
 
7
5
  ### Properties
@@ -8,7 +8,7 @@
8
8
 
9
9
  Encodes a given string into JSFuck.
10
10
 
11
- **`throws`**
11
+ **`Throws`**
12
12
 
13
13
  An `Error` is thrown under the following circumstances.
14
14
  - The specified string cannot be encoded with the specified options.
package/lib/encode.d.ts CHANGED
@@ -1,15 +1,16 @@
1
- import { FeatureElementOrCompatibleArray } from './feature';
1
+ import type { FeatureElementOrCompatibleArray } from './feature';
2
2
 
3
3
  export interface EncodeOptions
4
4
  {
5
5
  /**
6
6
  * Specifies the features available in the engines that evaluate the encoded output.
7
7
  *
8
- * If this parameter is unspecified, [[DEFAULT|`JScrewIt.Feature.DEFAULT`]] is assumed: this
9
- * ensures maximum compatibility but also generates the largest code.
8
+ * If this parameter is unspecified, {@link FeatureConstructor.DEFAULT |
9
+ * `JScrewIt.Feature.DEFAULT`} is assumed: this ensures maximum compatibility but also generates
10
+ * the largest code.
10
11
  * To generate shorter code, specify all features available in all target engines explicitly.
11
12
  */
12
- features?: FeatureElementOrCompatibleArray;
13
+ features?: FeatureElementOrCompatibleArray | undefined;
13
14
 
14
15
  /**
15
16
  * This option controls the type of code generated from the given input.
@@ -59,7 +60,7 @@ export interface EncodeOptions
59
60
  *
60
61
  * </dl>
61
62
  */
62
- runAs?: 'call' | 'eval' | 'express' | 'express-call' | 'express-eval' | 'none';
63
+ runAs?: RunAs | undefined;
63
64
 
64
65
  /**
65
66
  * If this parameter is truthy, lines in the beginning and in the end of the file containing
@@ -72,12 +73,18 @@ export interface EncodeOptions
72
73
  * Using this option may produce unexpected results if the input is not well-formed JavaScript
73
74
  * code.
74
75
  */
75
- trimCode?: boolean;
76
+ trimCode?: boolean | undefined;
76
77
 
77
78
  /** An alias for `runAs`. */
78
- wrapWith?: 'call' | 'eval' | 'express' | 'express-call' | 'express-eval' | 'none';
79
+ wrapWith?: RunAs | undefined;
79
80
  }
80
81
 
82
+ /**
83
+ * Values of this type control the type of code generated from a given input.
84
+ * See {@link EncodeOptions.runAs | `EncodeOptions.runAs`} for the meaning of each possible value.
85
+ */
86
+ type RunAs = 'call' | 'eval' | 'express' | 'express-call' | 'express-eval' | 'none';
87
+
81
88
  interface encode
82
89
  {
83
90
  /**
@@ -52,7 +52,7 @@ export interface FeatureAll
52
52
  *
53
53
  * @remarks
54
54
  *
55
- * Available in Chrome, Edge, Firefox 90+, Opera, and Node.js 16.6+.
55
+ * Available in Chrome, Edge, Firefox, Safari 15.4+, Opera, and Node.js 16.6+.
56
56
  */
57
57
  AT: ElementaryFeature;
58
58
 
@@ -211,38 +211,12 @@ export interface FeatureAll
211
211
  */
212
212
  FF: PredefinedFeature;
213
213
 
214
- /**
215
- * Features available in Firefox 78 to 82.
216
- *
217
- * @remarks
218
- *
219
- * This feature may be replaced or removed in the near future when current browser versions become obsolete. Use `FF_ESR` instead of `FF_78` for long term support.
220
- *
221
- * @see
222
- *
223
- * [Engine Support Policy](https://github.com/fasttime/JScrewIt#engine-support-policy)
224
- */
225
- FF_78: PredefinedFeature;
226
-
227
- /**
228
- * Features available in Firefox 83 to 89.
229
- *
230
- * @remarks
231
- *
232
- * This feature may be replaced or removed in the near future when current browser versions become obsolete.
233
- *
234
- * @see
235
- *
236
- * [Engine Support Policy](https://github.com/fasttime/JScrewIt#engine-support-policy)
237
- */
238
- FF_83: PredefinedFeature;
239
-
240
214
  /**
241
215
  * Features available in Firefox 90 or later.
242
216
  *
243
217
  * @remarks
244
218
  *
245
- * This feature may be replaced or removed in the near future when current browser versions become obsolete. Use `FF` or `FF_PREV` instead of `FF_90` for long term support.
219
+ * This feature may be replaced or removed in the near future when current browser versions become obsolete. Use `FF`, `FF_ESR`, or `FF_PREV` instead of `FF_90` for long term support.
246
220
  *
247
221
  * @see
248
222
  *
@@ -253,7 +227,7 @@ export interface FeatureAll
253
227
  /**
254
228
  * Features available in the current version of Firefox ESR.
255
229
  *
256
- * An alias for `FF_78`.
230
+ * An alias for `FF_90`.
257
231
  */
258
232
  FF_ESR: PredefinedFeature;
259
233
 
@@ -587,7 +561,7 @@ export interface FeatureAll
587
561
  *
588
562
  * @remarks
589
563
  *
590
- * Available in Firefox before 83, Internet Explorer 11, Safari 10+ before 14.0.1, Android Browser 4.4, and Node.js 0.12+ before 15.
564
+ * Available in Internet Explorer 11, Safari 10+ before 14.0.1, Android Browser 4.4, and Node.js 0.12+ before 15.
591
565
  */
592
566
  PLAIN_INTL: ElementaryFeature;
593
567
 
@@ -603,7 +577,7 @@ export interface FeatureAll
603
577
  /**
604
578
  * Features available in the current stable version of Safari.
605
579
  *
606
- * An alias for `SAFARI_14_1`.
580
+ * An alias for `SAFARI_15_4`.
607
581
  */
608
582
  SAFARI: PredefinedFeature;
609
583
 
@@ -619,9 +593,12 @@ export interface FeatureAll
619
593
  /** Features available in Safari 14.0.1 to 14.0.3. */
620
594
  SAFARI_14_0_1: PredefinedFeature;
621
595
 
622
- /** Features available in Safari 14.1 or later. */
596
+ /** Features available in Safari 14.1 to 15.3. */
623
597
  SAFARI_14_1: PredefinedFeature;
624
598
 
599
+ /** Features available in Safari 15.4 or later. */
600
+ SAFARI_15_4: PredefinedFeature;
601
+
625
602
  /** Features available in Safari 7.0. */
626
603
  SAFARI_7_0: PredefinedFeature;
627
604
 
@@ -761,8 +738,6 @@ ElementaryFeatureName
761
738
  | 'CHROME_92'
762
739
  | 'COMPACT'
763
740
  | 'DEFAULT'
764
- | 'FF_78'
765
- | 'FF_83'
766
741
  | 'FF_90'
767
742
  | 'IE_10'
768
743
  | 'IE_11'
@@ -784,6 +759,7 @@ ElementaryFeatureName
784
759
  | 'SAFARI_13'
785
760
  | 'SAFARI_14_0_1'
786
761
  | 'SAFARI_14_1'
762
+ | 'SAFARI_15_4'
787
763
  | 'SAFARI_7_0'
788
764
  | 'SAFARI_7_1'
789
765
  | 'SAFARI_9'
package/lib/feature.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ElementaryFeatureName, FeatureAll, PredefinedFeatureName } from './feature-all';
1
+ import type { ElementaryFeatureName, FeatureAll, PredefinedFeatureName } from './feature-all';
2
2
 
3
3
  export interface CustomFeature extends Feature
4
4
  {
@@ -16,8 +16,8 @@ export interface ElementaryFeature extends PredefinedFeature
16
16
  * length of its output are available in a particular JavaScript engine.
17
17
  *
18
18
  * JScrewIt comes with a set of predefined feature objects exposed as property values of
19
- * `JScrewIt.Feature` or [[ALL|`JScrewIt.Feature.ALL`]], where the property name is the feature's
20
- * name or alias.
19
+ * `JScrewIt.Feature` or {@link FeatureConstructor.ALL | `JScrewIt.Feature.ALL`}, where the property
20
+ * name is the feature's name or alias.
21
21
  *
22
22
  * Besides these predefined features, it is possible to construct custom features from the union or
23
23
  * intersection of other features.
@@ -28,10 +28,10 @@ export interface ElementaryFeature extends PredefinedFeature
28
28
  * their elementary components.
29
29
  * All other features, called *composite* features, can be constructed as a union of zero or more
30
30
  * elementary features.
31
- * Two of the predefined composite features are particularly important: <code>[[DEFAULT]]</code> is
32
- * the empty feature, indicating that no elementary feature is available at all;
33
- * <code>[[AUTO]]</code> is the union of all elementary features available in the current
34
- * environment.
31
+ * Two of the predefined composite features are particularly important: {@link
32
+ * FeatureConstructor.DEFAULT | `DEFAULT`} is the empty feature, indicating that no elementary
33
+ * feature is available at all; {@link FeatureConstructor.AUTO | `AUTO`} is the union of all
34
+ * elementary features available in the current environment.
35
35
  *
36
36
  * Not all features can be available at the same time: some features are necessarily incompatible,
37
37
  * meaning that they mutually exclude each other, and thus their union cannot be constructed.
@@ -119,12 +119,13 @@ export interface FeatureConstructor extends FeatureAll
119
119
  * The constructor can be used with or without the `new` operator, e.g.
120
120
  * `new JScrewIt.Feature(feature1, feature2)` or `JScrewIt.Feature(feature1, feature2)`.
121
121
  * If no arguments are specified, the new feature object will be equivalent to
122
- * <code>[[DEFAULT]]</code>.
122
+ * {@link FeatureConstructor.DEFAULT | `DEFAULT`}.
123
123
  *
124
124
  * @example
125
125
  *
126
126
  * The following statements are equivalent, and will all construct a new feature object
127
- * including both <code>[[ANY_DOCUMENT]]</code> and <code>[[ANY_WINDOW]]</code>.
127
+ * including both {@link FeatureConstructor.ANY_DOCUMENT | `ANY_DOCUMENT`} and {@link
128
+ * FeatureConstructor.ANY_WINDOW | `ANY_WINDOW`}.
128
129
  *
129
130
  * ```js
130
131
  * new JScrewIt.Feature("ANY_DOCUMENT", "ANY_WINDOW");
@@ -172,12 +173,13 @@ export interface FeatureConstructor extends FeatureAll
172
173
  * The constructor can be used with or without the `new` operator, e.g.
173
174
  * `new JScrewIt.Feature(feature1, feature2)` or `JScrewIt.Feature(feature1, feature2)`.
174
175
  * If no arguments are specified, the new feature object will be equivalent to
175
- * <code>[[DEFAULT]]</code>.
176
+ * {@link FeatureConstructor.DEFAULT | `DEFAULT`}.
176
177
  *
177
178
  * @example
178
179
  *
179
180
  * The following statements are equivalent, and will all construct a new feature object
180
- * including both <code>[[ANY_DOCUMENT]]</code> and <code>[[ANY_WINDOW]]</code>.
181
+ * including both {@link FeatureConstructor.ANY_DOCUMENT | `ANY_DOCUMENT`} and {@link
182
+ * FeatureConstructor.ANY_WINDOW | `ANY_WINDOW`}.
181
183
  *
182
184
  * ```js
183
185
  * JScrewIt.Feature("ANY_DOCUMENT", "ANY_WINDOW");
@@ -253,15 +255,17 @@ export interface FeatureConstructor extends FeatureAll
253
255
  *
254
256
  * @example
255
257
  *
256
- * This will create a new feature object equivalent to <code>[[NAME]]</code>.
258
+ * This will create a new feature object equivalent to {@link FeatureConstructor.NAME | `NAME`}.
257
259
  *
258
260
  * ```js
259
261
  * const newFeature = JScrewIt.Feature.commonOf(["ATOB", "NAME"], ["NAME", "SELF"]);
260
262
  * ```
261
263
  *
262
- * This will create a new feature object equivalent to <code>[[ANY_DOCUMENT]]</code>.
263
- * This is because both <code>[[HTMLDOCUMENT]]</code> and <code>[[DOCUMENT]]</code> imply
264
- * <code>[[ANY_DOCUMENT]]</code>.
264
+ * This will create a new feature object equivalent to {@link FeatureConstructor.ANY_DOCUMENT |
265
+ * `ANY_DOCUMENT`}.
266
+ * This is because both {@link FeatureConstructor.HTMLDOCUMENT | `HTMLDOCUMENT`} and {@link
267
+ * FeatureConstructor.DOCUMENT | `DOCUMENT`} imply {@link FeatureConstructor.ANY_DOCUMENT |
268
+ * `ANY_DOCUMENT`}.
265
269
  *
266
270
  * ```js
267
271
  * const newFeature = JScrewIt.Feature.commonOf("HTMLDOCUMENT", "DOCUMENT");
package/lib/jscrewit.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // Type definitions for JScrewIt
2
2
 
3
- import { encode } from './encode';
4
- import { Feature } from './feature';
3
+ import type { encode } from './encode';
4
+ import type { Feature } from './feature';
5
5
 
6
6
  export * from './encode';
7
7
  export * from './feature';