From e85dde681abce131b4cccf2a136ffa41bebc354c Mon Sep 17 00:00:00 2001 From: Francesco Trotta Date: Tue, 16 Aug 2022 21:59:32 +0200 Subject: [PATCH] Update build and dependencies --- .github/workflows/JScrewIt.yml | 2 +- .github/workflows/~feature-hub.yml | 2 +- .github/workflows/~result-format.yml | 2 +- .github/workflows/~solution.yml | 2 +- api-doc/README.md | 88 +++++++++-- api-doc/interfaces/EncodeOptions.md | 4 +- api-doc/interfaces/Feature.md | 11 +- api-doc/interfaces/FeatureAll.md | 114 +++++++------- api-doc/interfaces/FeatureConstructor.md | 149 +++++++++--------- api-doc/interfaces/default.md | 2 - api-doc/interfaces/encode.md | 2 +- dev/internal/package-utils.mjs | 1 - gulpfile.js | 23 ++- lib/encode.d.ts | 7 +- lib/feature.d.ts | 32 ++-- packages/~feature-hub/src/feature.ts | 3 +- .../~feature-hub/test/spec/feature.spec.ts | 17 +- src/lib/encoder/encoder-base.js | 2 +- src/lib/solution.js | 2 +- src/package.yml.hbs | 2 +- test/extreme-test.js | 1 - tsconfig.json | 1 + 22 files changed, 269 insertions(+), 200 deletions(-) diff --git a/.github/workflows/JScrewIt.yml b/.github/workflows/JScrewIt.yml index 8f5fdf36..7df4bfb1 100644 --- a/.github/workflows/JScrewIt.yml +++ b/.github/workflows/JScrewIt.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '18' + node-version: 18 >=18.1 - run: | npm install --workspaces npm install diff --git a/.github/workflows/~feature-hub.yml b/.github/workflows/~feature-hub.yml index f3d679b8..eacae1f2 100644 --- a/.github/workflows/~feature-hub.yml +++ b/.github/workflows/~feature-hub.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '18' + node-version: 18 >=18.1 - run: | npm install --prefix ../.. npm run lint diff --git a/.github/workflows/~result-format.yml b/.github/workflows/~result-format.yml index be529797..3dcb9359 100644 --- a/.github/workflows/~result-format.yml +++ b/.github/workflows/~result-format.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '18' + node-version: 18 >=18.1 - run: | npm install --prefix ../.. npm run lint diff --git a/.github/workflows/~solution.yml b/.github/workflows/~solution.yml index 79fb327d..3bb46a5f 100644 --- a/.github/workflows/~solution.yml +++ b/.github/workflows/~solution.yml @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '18' + node-version: 18 >=18.1 - run: | npm install --prefix ../.. npm run lint diff --git a/api-doc/README.md b/api-doc/README.md index 3588463a..fafbbcb3 100644 --- a/api-doc/README.md +++ b/api-doc/README.md @@ -14,7 +14,7 @@ - [default](interfaces/default.md) - [encode](interfaces/encode.md) -### Type aliases +### Type Aliases - [ElementaryFeatureName](README.md#elementaryfeaturename) - [FeatureElement](README.md#featureelement) @@ -24,11 +24,14 @@ ### Variables -- [Feature](README.md#feature) - [default](README.md#default) + +### Functions + +- [Feature](README.md#feature) - [encode](README.md#encode) -## Type aliases +## Type Aliases ### ElementaryFeatureName @@ -44,7 +47,7 @@ ___ A feature object or a name or alias of a predefined feature. -**`remarks`** +**`Remarks`** Methods that accept parameters of this type throw an error if the specified value is neither a feature object nor a name or alias of a predefined feature. @@ -58,7 +61,7 @@ ___ A feature object, a name or alias of a predefined feature, or an array of such values that defines a union of mutually compatible features. -**`remarks`** +**`Remarks`** Methods that accept parameters of this type throw an error if the specified value is neither a feature object nor a name or alias of a predefined feature, or if it is an array of values that @@ -79,24 +82,85 @@ ___ Ƭ **RunAs**: ``"call"`` \| ``"eval"`` \| ``"express"`` \| ``"express-call"`` \| ``"express-eval"`` \| ``"none"`` Values of this type control the type of code generated from a given input. -See [EncodeOptions.runAs](interfaces/EncodeOptions.md#runas) for the meaning of each possible value. +See [`EncodeOptions.runAs`](interfaces/EncodeOptions.md#runas) for the meaning of each possible value. ## Variables +### default + +• **default**: [`default`](README.md#default) + +## Functions + ### Feature -• **Feature**: [`FeatureConstructor`](interfaces/FeatureConstructor.md) +▸ **Feature**(...`features`): [`CustomFeature`](interfaces/CustomFeature.md) -___ +Creates a new feature object from the union of the specified features. -### default +The constructor can be used with or without the `new` operator, e.g. +`new JScrewIt.Feature(feature1, feature2)` or `JScrewIt.Feature(feature1, feature2)`. +If no arguments are specified, the new feature object will be equivalent to +[`DEFAULT`](interfaces/FeatureConstructor.md#default). -• **default**: [`default`](README.md#default) +**`Example`** + +The following statements are equivalent, and will all construct a new feature object +including both [`ANY_DOCUMENT`](interfaces/FeatureConstructor.md#any_document) and [`ANY_WINDOW`](interfaces/FeatureConstructor.md#any_window). + +```js +new JScrewIt.Feature("ANY_DOCUMENT", "ANY_WINDOW"); +``` + +```js +new JScrewIt.Feature(JScrewIt.Feature.ANY_DOCUMENT, JScrewIt.Feature.ANY_WINDOW); +``` -JScrewIt object, available in Node.js. +```js +new JScrewIt.Feature([JScrewIt.Feature.ANY_DOCUMENT, JScrewIt.Feature.ANY_WINDOW]); +``` + +**`Throws`** + +An error is thrown if any of the specified features are not mutually compatible. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `...features` | [`FeatureElementOrCompatibleArray`](README.md#featureelementorcompatiblearray)[] | + +#### Returns + +[`CustomFeature`](interfaces/CustomFeature.md) ___ ### encode -• **encode**: [`encode`](README.md#encode) +▸ **encode**(`input`, `options?`): `string` + +Encodes a given string into JSFuck. + +**`Throws`** + +An `Error` is thrown under the following circumstances. + - The specified string cannot be encoded with the specified options. + - Some unknown features were specified. + - A combination of mutually incompatible features was specified. + - The option `runAs` (or `wrapWith`) was specified with an invalid value. + +Also, an out of memory condition may occur when processing very large data. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `input` | `string` | The string to encode. | +| `options?` | [`EncodeOptions`](interfaces/EncodeOptions.md) | An optional object specifying encoding options. | + +#### Returns + +`string` + +The encoded string. diff --git a/api-doc/interfaces/EncodeOptions.md b/api-doc/interfaces/EncodeOptions.md index 60098651..e7d2211a 100644 --- a/api-doc/interfaces/EncodeOptions.md +++ b/api-doc/interfaces/EncodeOptions.md @@ -17,8 +17,8 @@ Specifies the features available in the engines that evaluate the encoded output. -If this parameter is unspecified, [`JScrewIt.Feature.DEFAULT`](FeatureConstructor.md#default) is assumed: this -ensures maximum compatibility but also generates the largest code. +If this parameter is unspecified, [`JScrewIt.Feature.DEFAULT`](FeatureConstructor.md#default) is assumed: this ensures maximum compatibility but also generates +the largest code. To generate shorter code, specify all features available in all target engines explicitly. ___ diff --git a/api-doc/interfaces/Feature.md b/api-doc/interfaces/Feature.md index 47a4592f..6276bbe1 100644 --- a/api-doc/interfaces/Feature.md +++ b/api-doc/interfaces/Feature.md @@ -4,8 +4,8 @@ Objects of this type indicate which of the capabilities that JScrewIt can use to length of its output are available in a particular JavaScript engine. JScrewIt comes with a set of predefined feature objects exposed as property values of -`JScrewIt.Feature` or [`JScrewIt.Feature.ALL`](FeatureConstructor.md#all), where the property name is the feature's -name or alias. +`JScrewIt.Feature` or [`JScrewIt.Feature.ALL`](FeatureConstructor.md#all), where the property +name is the feature's name or alias. Besides these predefined features, it is possible to construct custom features from the union or intersection of other features. @@ -16,10 +16,9 @@ they are different from such a union in that they exclude some other feature not their elementary components. All other features, called *composite* features, can be constructed as a union of zero or more elementary features. -Two of the predefined composite features are particularly important: [DEFAULT](FeatureConstructor.md#default) is -the empty feature, indicating that no elementary feature is available at all; -[AUTO](FeatureConstructor.md#auto) is the union of all elementary features available in the current -environment. +Two of the predefined composite features are particularly important: [`DEFAULT`](FeatureConstructor.md#default) is the empty feature, indicating that no elementary +feature is available at all; [`AUTO`](FeatureConstructor.md#auto) is the union of all +elementary features available in the current environment. Not all features can be available at the same time: some features are necessarily incompatible, meaning that they mutually exclude each other, and thus their union cannot be constructed. diff --git a/api-doc/interfaces/FeatureAll.md b/api-doc/interfaces/FeatureAll.md index 86707168..17ed7065 100644 --- a/api-doc/interfaces/FeatureAll.md +++ b/api-doc/interfaces/FeatureAll.md @@ -136,7 +136,7 @@ ___ Existence of the global object document whose string representation starts with "\[object " and ends with "Document\]". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers. @@ -148,7 +148,7 @@ ___ Existence of the global object self whose string representation starts with "\[object " and ends with "Window\]". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers. @@ -160,7 +160,7 @@ ___ The property that the string representation of Array.prototype.entries\(\) starts with "\[object Array" and ends with "\]" at index 21 or 22. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari 7.1+, Opera, and Node.js 0.12+. @@ -172,7 +172,7 @@ ___ Support for arrow functions. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari 10+, Opera, and Node.js 4+. @@ -184,7 +184,7 @@ ___ Existence of the native function Array.prototype.at. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari 15.4+, Opera, and Node.js 16.6+. @@ -196,7 +196,7 @@ ___ Existence of the global functions atob and btoa. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer 10+, Safari, Opera, Android Browser, and Node.js 16.0+. This feature is not available inside web workers in Safari before 10. @@ -216,7 +216,7 @@ ___ Existence of the global object statusbar having the string representation "\[object BarProp\]". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari, Opera, and Android Browser 4.4. This feature is not available inside web workers. @@ -238,7 +238,7 @@ ___ The property that the various string methods returning HTML code such as String.prototype.big or String.prototype.link have both the tag name and attributes written in capital letters. -**`remarks`** +**`Remarks`** Available in Internet Explorer. @@ -260,11 +260,11 @@ ___ Features available in Chrome 92, Edge 92 and Opera 78 or later. -**`remarks`** +**`Remarks`** This feature may be replaced or removed in the near future when current browser versions become obsolete. Use `CHROME` or `CHROME_PREV` instead of `CHROME_92` for long term support. -**`see`** +**`See`** [Engine Support Policy](https://github.com/fasttime/JScrewIt#engine-support-policy) @@ -298,7 +298,7 @@ Existence of the global object console having the string representation "\[objec This feature may become unavailable when certain browser extensions are active. -**`remarks`** +**`Remarks`** Available in Internet Explorer 10+, Safari before 14.1, and Android Browser. This feature is not available inside web workers in Safari before 7.1 and Android Browser 4.4. @@ -318,7 +318,7 @@ ___ Existence of the global object document having the string representation "\[object Document\]". -**`remarks`** +**`Remarks`** Available in Internet Explorer before 11. This feature is not available inside web workers. @@ -330,7 +330,7 @@ ___ Existence of the global object self having the string representation "\[object DOMWindow\]". -**`remarks`** +**`Remarks`** Available in Android Browser before 4.4. This feature is not available inside web workers. @@ -342,7 +342,7 @@ ___ The property that double quotation mark, less than and greater than characters in the argument of String.prototype.fontcolor are escaped into their respective HTML entities. -**`remarks`** +**`Remarks`** Available in Android Browser and Node.js before 0.12. @@ -354,7 +354,7 @@ ___ The property that double quotation marks in the argument of String.prototype.fontcolor are escaped as "\"". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari, Opera, Android Browser, and Node.js. @@ -366,7 +366,7 @@ ___ The property that only double quotation marks and no other characters in the argument of String.prototype.fontcolor are escaped into HTML entities. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js 0.12+. @@ -378,7 +378,7 @@ ___ Having regular expressions created with the RegExp constructor use escape sequences starting with a backslash to format line feed characters \("\\n"\) in their string representation. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Node.js 12+. @@ -390,7 +390,7 @@ ___ Having regular expressions created with the RegExp constructor use escape sequences starting with a backslash to format slashes \("/"\) in their string representation. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Node.js 4+. @@ -412,11 +412,11 @@ ___ Features available in Firefox 90 or later. -**`remarks`** +**`Remarks`** 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. -**`see`** +**`See`** [Engine Support Policy](https://github.com/fasttime/JScrewIt#engine-support-policy) @@ -450,7 +450,7 @@ A string representation of native functions typical for Firefox and Safari. Remarkable traits are the lack of line feed characters at the beginning and at the end of the string and the presence of a line feed followed by four whitespaces \("\\n "\) before the "\[native code\]" sequence. -**`remarks`** +**`Remarks`** Available in Firefox and Safari. @@ -462,7 +462,7 @@ ___ Existence of the native function Array.prototype.fill. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari 7.1+, Opera, and Node.js 4+. @@ -474,7 +474,7 @@ ___ Existence of the native function Array.prototype.flat. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari 12+, Opera, and Node.js 11+. @@ -486,7 +486,7 @@ ___ Existence of the function String.fromCodePoint. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari 9+, Opera, and Node.js 4+. @@ -498,7 +498,7 @@ ___ A string representation of dynamically generated functions where the character at index 19 is a line feed \("\\n"\). -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Opera, and Node.js 10+. @@ -510,7 +510,7 @@ ___ A string representation of dynamically generated functions where the character at index 22 is a line feed \("\\n"\). -**`remarks`** +**`Remarks`** Available in Internet Explorer, Safari 9+, Android Browser, and Node.js before 10. @@ -522,7 +522,7 @@ ___ Ability to call Array.prototype.toString with a non-array binding. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, Android Browser 4.1+, and Node.js. @@ -534,7 +534,7 @@ ___ Having the global function toString return the string "\[object Undefined\]" when invoked without a binding. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js. @@ -548,7 +548,7 @@ Presence of the text "GMT" after the first 25 characters in the string returned The string representation of dates is implementation dependent, but most engines use a similar format, making this feature available in all supported engines except Internet Explorer 9 and 10. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer 11, Safari, Opera, Android Browser, and Node.js. @@ -560,7 +560,7 @@ ___ Existence of the global object history having the string representation "\[object History\]". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers. @@ -572,7 +572,7 @@ ___ Existence of the global object Audio whose string representation starts with "function HTMLAudioElement". -**`remarks`** +**`Remarks`** Available in Android Browser 4.4. This feature is not available inside web workers. @@ -584,7 +584,7 @@ ___ Existence of the global object document having the string representation "\[object HTMLDocument\]". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer 11, Safari, Opera, and Android Browser. This feature is not available inside web workers. @@ -630,7 +630,7 @@ A string representation of native functions typical for Internet Explorer. Remarkable traits are the presence of a line feed character \("\\n"\) at the beginning and at the end of the string and a line feed followed by four whitespaces \("\\n "\) before the "\[native code\]" sequence. -**`remarks`** +**`Remarks`** Available in Internet Explorer. @@ -642,7 +642,7 @@ ___ The ability to use unary increment operators with string characters, like in \( ++"some string"\[0\] \): this will result in a TypeError in strict mode in ECMAScript compliant engines. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, Android Browser, and Node.js. This feature is not available when strict mode is enforced in Chrome, Edge, Firefox, Internet Explorer 10+, Safari, Opera, and Node.js 5+. @@ -654,7 +654,7 @@ ___ Existence of the global object Intl. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer 11, Safari 10+, Opera, Android Browser 4.4, and Node.js 0.12+. @@ -666,7 +666,7 @@ ___ Language sensitive string representation of Infinity as "∞". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 10, Safari 10+, Opera, Android Browser 4.4, and Node.js 0.12+. @@ -678,7 +678,7 @@ ___ Features shared by all engines capable of localized number formatting, including output of Arabic digits, the Arabic decimal separator "٫", the letters in the first word of the Arabic string representation of NaN \("ليس"\), Persian digits and the Persian digit group separator "٬". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer 11, Safari 10+, Opera, Android Browser 4.4, and Node.js 13+. @@ -692,7 +692,7 @@ Extended localized number formatting. This includes all features of LOCALE_NUMERALS plus the output of the first three letters in the second word of the Arabic string representation of NaN \("رقم"\), Bengali digits, the letters in the Russian string representation of NaN \("не число"\) and the letters in the Persian string representation of NaN \("ناعدد"\). -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 10, Safari 10+, Opera, Android Browser 4.4, and Node.js 13+. @@ -704,7 +704,7 @@ ___ Existence of the global object location with the property that Object.prototype.toString.call\(location\) evaluates to a string that starts with "\[object " and ends with "Location\]". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari, Opera, and Android Browser. @@ -716,7 +716,7 @@ ___ Existence of the name property for functions. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari, Opera, Android Browser, and Node.js. @@ -728,7 +728,7 @@ ___ Existence of the global object Node having the string representation "\[object NodeConstructor\]". -**`remarks`** +**`Remarks`** Available in Safari before 10. This feature is not available inside web workers. @@ -828,7 +828,7 @@ ___ A string representation of native functions typical for V8 or for Internet Explorer but not for Firefox and Safari. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Internet Explorer, Opera, Android Browser, and Node.js. @@ -842,7 +842,7 @@ A string representation of native functions typical for most engines with the no A remarkable trait of this feature is the lack of line feed characters at the beginning and at the end of the string. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari, Opera, Android Browser, and Node.js. @@ -854,7 +854,7 @@ ___ The property that the string representation of Array.prototype.entries\(\) evaluates to "\[object Array Iterator\]" and that Array.prototype.entries\(\).constructor is the global function Object. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari 9+, Opera, and Node.js 0.12+. @@ -868,7 +868,7 @@ A string representation of native functions typical for Firefox, Internet Explor A most remarkable trait of this feature is the presence of a line feed followed by four whitespaces \("\\n "\) before the "\[native code\]" sequence. -**`remarks`** +**`Remarks`** Available in Firefox, Internet Explorer, and Safari. @@ -880,7 +880,7 @@ ___ Existence of the global function location.constructor whose string representation starts with "\[object L" -**`remarks`** +**`Remarks`** Available in Internet Explorer and Safari before 10. This feature is not available inside web workers. @@ -892,7 +892,7 @@ ___ Having the function Object.prototype.toString return the string "\[object Undefined\]" when invoked without a binding. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer 10+, Safari, Opera, Android Browser 4.1+, and Node.js. @@ -904,7 +904,7 @@ ___ The property that the string representation of the global object constructor starts with "\[object W" -**`remarks`** +**`Remarks`** Available in Internet Explorer and Safari before 10. This feature is not available inside web workers in Safari before 10. @@ -916,7 +916,7 @@ ___ Existence of the global object location.constructor whose string representation starts with "\[object " and ends with "LocationConstructor\]" -**`remarks`** +**`Remarks`** Available in Safari before 10. @@ -928,7 +928,7 @@ ___ Existence of the global object Intl having the string representation "\[object Object\]" -**`remarks`** +**`Remarks`** Available in Internet Explorer 11, Safari 10+ before 14.0.1, Android Browser 4.4, and Node.js 0.12+ before 15. @@ -940,7 +940,7 @@ ___ The property that the string representation of String.prototype.matchAll\(\) evaluates to "\[object RegExp String Iterator\]". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari 13+, Opera, and Node.js 12+. @@ -1042,7 +1042,7 @@ ___ Existence of the global object self whose string representation starts with "\[object ". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers in Safari 7.1+ before 10. @@ -1054,7 +1054,7 @@ ___ Support for the two-letter locale name "ar" to format decimal numbers as Arabic numerals. -**`remarks`** +**`Remarks`** Available in Firefox, Internet Explorer 11, Safari 10+, Android Browser 4.4, and Node.js 13+. @@ -1066,7 +1066,7 @@ ___ Existence of the global string status. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers. @@ -1080,7 +1080,7 @@ The property that Object.prototype.toString.call\(\) evaluates to "\[object Unde This behavior is specified by ECMAScript, and is enforced by all engines except Android Browser versions prior to 4.1.2, where this feature is not available. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, Android Browser 4.1+, and Node.js. @@ -1094,7 +1094,7 @@ A string representation of native functions typical for the V8 engine. Remarkable traits are the lack of line feed characters at the beginning and at the end of the string and the presence of a single whitespace before the "\[native code\]" sequence. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Opera, Android Browser, and Node.js. @@ -1106,6 +1106,6 @@ ___ Existence of the global object self having the string representation "\[object Window\]". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser 4.4. This feature is not available inside web workers. diff --git a/api-doc/interfaces/FeatureConstructor.md b/api-doc/interfaces/FeatureConstructor.md index 89d7ffea..63fd0914 100644 --- a/api-doc/interfaces/FeatureConstructor.md +++ b/api-doc/interfaces/FeatureConstructor.md @@ -17,12 +17,12 @@ Creates a new feature object from the union of the specified features. The constructor can be used with or without the `new` operator, e.g. `new JScrewIt.Feature(feature1, feature2)` or `JScrewIt.Feature(feature1, feature2)`. If no arguments are specified, the new feature object will be equivalent to -[DEFAULT](FeatureConstructor.md#default). +[`DEFAULT`](FeatureConstructor.md#default). -**`example`** +**`Example`** The following statements are equivalent, and will all construct a new feature object -including both [ANY_DOCUMENT](FeatureConstructor.md#any_document) and [ANY_WINDOW](FeatureConstructor.md#any_window). +including both [`ANY_DOCUMENT`](FeatureConstructor.md#any_document) and [`ANY_WINDOW`](FeatureConstructor.md#any_window). ```js new JScrewIt.Feature("ANY_DOCUMENT", "ANY_WINDOW"); @@ -36,7 +36,7 @@ new JScrewIt.Feature(JScrewIt.Feature.ANY_DOCUMENT, JScrewIt.Feature.ANY_WINDOW) new JScrewIt.Feature([JScrewIt.Feature.ANY_DOCUMENT, JScrewIt.Feature.ANY_WINDOW]); ``` -**`throws`** +**`Throws`** An error is thrown if any of the specified features are not mutually compatible. @@ -172,12 +172,12 @@ Creates a new feature object from the union of the specified features. The constructor can be used with or without the `new` operator, e.g. `new JScrewIt.Feature(feature1, feature2)` or `JScrewIt.Feature(feature1, feature2)`. If no arguments are specified, the new feature object will be equivalent to -[DEFAULT](FeatureConstructor.md#default). +[`DEFAULT`](FeatureConstructor.md#default). -**`example`** +**`Example`** The following statements are equivalent, and will all construct a new feature object -including both [ANY_DOCUMENT](FeatureConstructor.md#any_document) and [ANY_WINDOW](FeatureConstructor.md#any_window). +including both [`ANY_DOCUMENT`](FeatureConstructor.md#any_document) and [`ANY_WINDOW`](FeatureConstructor.md#any_window). ```js JScrewIt.Feature("ANY_DOCUMENT", "ANY_WINDOW"); @@ -191,7 +191,7 @@ JScrewIt.Feature(JScrewIt.Feature.ANY_DOCUMENT, JScrewIt.Feature.ANY_WINDOW); JScrewIt.Feature([JScrewIt.Feature.ANY_DOCUMENT, JScrewIt.Feature.ANY_WINDOW]); ``` -**`throws`** +**`Throws`** An error is thrown if any of the specified features are not mutually compatible. @@ -213,7 +213,7 @@ FeatureAll.constructor An immutable mapping of all predefined feature objects accessed by name or alias. -**`example`** +**`Example`** This will produce an array with the names and aliases of all predefined features. @@ -271,7 +271,7 @@ ___ Existence of the global object document whose string representation starts with "\[object " and ends with "Document\]". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers. @@ -287,7 +287,7 @@ ___ Existence of the global object self whose string representation starts with "\[object " and ends with "Window\]". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers. @@ -303,7 +303,7 @@ ___ The property that the string representation of Array.prototype.entries\(\) starts with "\[object Array" and ends with "\]" at index 21 or 22. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari 7.1+, Opera, and Node.js 0.12+. @@ -319,7 +319,7 @@ ___ Support for arrow functions. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari 10+, Opera, and Node.js 4+. @@ -335,7 +335,7 @@ ___ Existence of the native function Array.prototype.at. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari 15.4+, Opera, and Node.js 16.6+. @@ -351,7 +351,7 @@ ___ Existence of the global functions atob and btoa. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer 10+, Safari, Opera, Android Browser, and Node.js 16.0+. This feature is not available inside web workers in Safari before 10. @@ -379,7 +379,7 @@ ___ Existence of the global object statusbar having the string representation "\[object BarProp\]". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari, Opera, and Android Browser 4.4. This feature is not available inside web workers. @@ -409,7 +409,7 @@ ___ The property that the various string methods returning HTML code such as String.prototype.big or String.prototype.link have both the tag name and attributes written in capital letters. -**`remarks`** +**`Remarks`** Available in Internet Explorer. @@ -439,11 +439,11 @@ ___ Features available in Chrome 92, Edge 92 and Opera 78 or later. -**`remarks`** +**`Remarks`** This feature may be replaced or removed in the near future when current browser versions become obsolete. Use `CHROME` or `CHROME_PREV` instead of `CHROME_92` for long term support. -**`see`** +**`See`** [Engine Support Policy](https://github.com/fasttime/JScrewIt#engine-support-policy) @@ -489,7 +489,7 @@ Existence of the global object console having the string representation "\[objec This feature may become unavailable when certain browser extensions are active. -**`remarks`** +**`Remarks`** Available in Internet Explorer 10+, Safari before 14.1, and Android Browser. This feature is not available inside web workers in Safari before 7.1 and Android Browser 4.4. @@ -517,7 +517,7 @@ ___ Existence of the global object document having the string representation "\[object Document\]". -**`remarks`** +**`Remarks`** Available in Internet Explorer before 11. This feature is not available inside web workers. @@ -533,7 +533,7 @@ ___ Existence of the global object self having the string representation "\[object DOMWindow\]". -**`remarks`** +**`Remarks`** Available in Android Browser before 4.4. This feature is not available inside web workers. @@ -557,7 +557,7 @@ ___ The property that double quotation mark, less than and greater than characters in the argument of String.prototype.fontcolor are escaped into their respective HTML entities. -**`remarks`** +**`Remarks`** Available in Android Browser and Node.js before 0.12. @@ -573,7 +573,7 @@ ___ The property that double quotation marks in the argument of String.prototype.fontcolor are escaped as "\"". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari, Opera, Android Browser, and Node.js. @@ -589,7 +589,7 @@ ___ The property that only double quotation marks and no other characters in the argument of String.prototype.fontcolor are escaped into HTML entities. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js 0.12+. @@ -605,7 +605,7 @@ ___ Having regular expressions created with the RegExp constructor use escape sequences starting with a backslash to format line feed characters \("\\n"\) in their string representation. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Node.js 12+. @@ -621,7 +621,7 @@ ___ Having regular expressions created with the RegExp constructor use escape sequences starting with a backslash to format slashes \("/"\) in their string representation. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Node.js 4+. @@ -651,11 +651,11 @@ ___ Features available in Firefox 90 or later. -**`remarks`** +**`Remarks`** 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. -**`see`** +**`See`** [Engine Support Policy](https://github.com/fasttime/JScrewIt#engine-support-policy) @@ -701,7 +701,7 @@ A string representation of native functions typical for Firefox and Safari. Remarkable traits are the lack of line feed characters at the beginning and at the end of the string and the presence of a line feed followed by four whitespaces \("\\n "\) before the "\[native code\]" sequence. -**`remarks`** +**`Remarks`** Available in Firefox and Safari. @@ -717,7 +717,7 @@ ___ Existence of the native function Array.prototype.fill. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari 7.1+, Opera, and Node.js 4+. @@ -733,7 +733,7 @@ ___ Existence of the native function Array.prototype.flat. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari 12+, Opera, and Node.js 11+. @@ -749,7 +749,7 @@ ___ Existence of the function String.fromCodePoint. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari 9+, Opera, and Node.js 4+. @@ -765,7 +765,7 @@ ___ A string representation of dynamically generated functions where the character at index 19 is a line feed \("\\n"\). -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Opera, and Node.js 10+. @@ -781,7 +781,7 @@ ___ A string representation of dynamically generated functions where the character at index 22 is a line feed \("\\n"\). -**`remarks`** +**`Remarks`** Available in Internet Explorer, Safari 9+, Android Browser, and Node.js before 10. @@ -797,7 +797,7 @@ ___ Ability to call Array.prototype.toString with a non-array binding. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, Android Browser 4.1+, and Node.js. @@ -813,7 +813,7 @@ ___ Having the global function toString return the string "\[object Undefined\]" when invoked without a binding. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari, Opera, and Node.js. @@ -831,7 +831,7 @@ Presence of the text "GMT" after the first 25 characters in the string returned The string representation of dates is implementation dependent, but most engines use a similar format, making this feature available in all supported engines except Internet Explorer 9 and 10. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer 11, Safari, Opera, Android Browser, and Node.js. @@ -847,7 +847,7 @@ ___ Existence of the global object history having the string representation "\[object History\]". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers. @@ -863,7 +863,7 @@ ___ Existence of the global object Audio whose string representation starts with "function HTMLAudioElement". -**`remarks`** +**`Remarks`** Available in Android Browser 4.4. This feature is not available inside web workers. @@ -879,7 +879,7 @@ ___ Existence of the global object document having the string representation "\[object HTMLDocument\]". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer 11, Safari, Opera, and Android Browser. This feature is not available inside web workers. @@ -945,7 +945,7 @@ A string representation of native functions typical for Internet Explorer. Remarkable traits are the presence of a line feed character \("\\n"\) at the beginning and at the end of the string and a line feed followed by four whitespaces \("\\n "\) before the "\[native code\]" sequence. -**`remarks`** +**`Remarks`** Available in Internet Explorer. @@ -961,7 +961,7 @@ ___ The ability to use unary increment operators with string characters, like in \( ++"some string"\[0\] \): this will result in a TypeError in strict mode in ECMAScript compliant engines. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, Android Browser, and Node.js. This feature is not available when strict mode is enforced in Chrome, Edge, Firefox, Internet Explorer 10+, Safari, Opera, and Node.js 5+. @@ -977,7 +977,7 @@ ___ Existence of the global object Intl. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer 11, Safari 10+, Opera, Android Browser 4.4, and Node.js 0.12+. @@ -993,7 +993,7 @@ ___ Language sensitive string representation of Infinity as "∞". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 10, Safari 10+, Opera, Android Browser 4.4, and Node.js 0.12+. @@ -1009,7 +1009,7 @@ ___ Features shared by all engines capable of localized number formatting, including output of Arabic digits, the Arabic decimal separator "٫", the letters in the first word of the Arabic string representation of NaN \("ليس"\), Persian digits and the Persian digit group separator "٬". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer 11, Safari 10+, Opera, Android Browser 4.4, and Node.js 13+. @@ -1027,7 +1027,7 @@ Extended localized number formatting. This includes all features of LOCALE_NUMERALS plus the output of the first three letters in the second word of the Arabic string representation of NaN \("رقم"\), Bengali digits, the letters in the Russian string representation of NaN \("не число"\) and the letters in the Persian string representation of NaN \("ناعدد"\). -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 10, Safari 10+, Opera, Android Browser 4.4, and Node.js 13+. @@ -1043,7 +1043,7 @@ ___ Existence of the global object location with the property that Object.prototype.toString.call\(location\) evaluates to a string that starts with "\[object " and ends with "Location\]". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari, Opera, and Android Browser. @@ -1059,7 +1059,7 @@ ___ Existence of the name property for functions. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari, Opera, Android Browser, and Node.js. @@ -1075,7 +1075,7 @@ ___ Existence of the global object Node having the string representation "\[object NodeConstructor\]". -**`remarks`** +**`Remarks`** Available in Safari before 10. This feature is not available inside web workers. @@ -1223,7 +1223,7 @@ ___ A string representation of native functions typical for V8 or for Internet Explorer but not for Firefox and Safari. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Internet Explorer, Opera, Android Browser, and Node.js. @@ -1241,7 +1241,7 @@ A string representation of native functions typical for most engines with the no A remarkable trait of this feature is the lack of line feed characters at the beginning and at the end of the string. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari, Opera, Android Browser, and Node.js. @@ -1257,7 +1257,7 @@ ___ The property that the string representation of Array.prototype.entries\(\) evaluates to "\[object Array Iterator\]" and that Array.prototype.entries\(\).constructor is the global function Object. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari 9+, Opera, and Node.js 0.12+. @@ -1275,7 +1275,7 @@ A string representation of native functions typical for Firefox, Internet Explor A most remarkable trait of this feature is the presence of a line feed followed by four whitespaces \("\\n "\) before the "\[native code\]" sequence. -**`remarks`** +**`Remarks`** Available in Firefox, Internet Explorer, and Safari. @@ -1291,7 +1291,7 @@ ___ Existence of the global function location.constructor whose string representation starts with "\[object L" -**`remarks`** +**`Remarks`** Available in Internet Explorer and Safari before 10. This feature is not available inside web workers. @@ -1307,7 +1307,7 @@ ___ Having the function Object.prototype.toString return the string "\[object Undefined\]" when invoked without a binding. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer 10+, Safari, Opera, Android Browser 4.1+, and Node.js. @@ -1323,7 +1323,7 @@ ___ The property that the string representation of the global object constructor starts with "\[object W" -**`remarks`** +**`Remarks`** Available in Internet Explorer and Safari before 10. This feature is not available inside web workers in Safari before 10. @@ -1339,7 +1339,7 @@ ___ Existence of the global object location.constructor whose string representation starts with "\[object " and ends with "LocationConstructor\]" -**`remarks`** +**`Remarks`** Available in Safari before 10. @@ -1355,7 +1355,7 @@ ___ Existence of the global object Intl having the string representation "\[object Object\]" -**`remarks`** +**`Remarks`** Available in Internet Explorer 11, Safari 10+ before 14.0.1, Android Browser 4.4, and Node.js 0.12+ before 15. @@ -1371,7 +1371,7 @@ ___ The property that the string representation of String.prototype.matchAll\(\) evaluates to "\[object RegExp String Iterator\]". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Safari 13+, Opera, and Node.js 12+. @@ -1521,7 +1521,7 @@ ___ Existence of the global object self whose string representation starts with "\[object ". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers in Safari 7.1+ before 10. @@ -1537,7 +1537,7 @@ ___ Support for the two-letter locale name "ar" to format decimal numbers as Arabic numerals. -**`remarks`** +**`Remarks`** Available in Firefox, Internet Explorer 11, Safari 10+, Android Browser 4.4, and Node.js 13+. @@ -1553,7 +1553,7 @@ ___ Existence of the global string status. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser. This feature is not available inside web workers. @@ -1571,7 +1571,7 @@ The property that Object.prototype.toString.call\(\) evaluates to "\[object Unde This behavior is specified by ECMAScript, and is enforced by all engines except Android Browser versions prior to 4.1.2, where this feature is not available. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, Android Browser 4.1+, and Node.js. @@ -1589,7 +1589,7 @@ A string representation of native functions typical for the V8 engine. Remarkable traits are the lack of line feed characters at the beginning and at the end of the string and the presence of a single whitespace before the "\[native code\]" sequence. -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Opera, Android Browser, and Node.js. @@ -1605,7 +1605,7 @@ ___ Existence of the global object self having the string representation "\[object Window\]". -**`remarks`** +**`Remarks`** Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Android Browser 4.4. This feature is not available inside web workers. @@ -1621,7 +1621,7 @@ Available in Chrome, Edge, Firefox, Internet Explorer, Safari, Opera, and Androi Determines whether the specified features are mutually compatible. -**`example`** +**`Example`** ```js // false: only one of "V8_SRC" or "IE_SRC" may be available. @@ -1657,7 +1657,7 @@ Determines whether all of the specified features are equivalent. Different features are considered equivalent if they include the same set of elementary features, regardless of any other difference. -**`example`** +**`Example`** ```js // false @@ -1690,17 +1690,16 @@ ___ Creates a new feature object equivalent to the intersection of the specified features. -**`example`** +**`Example`** -This will create a new feature object equivalent to [NAME](FeatureConstructor.md#name). +This will create a new feature object equivalent to [`NAME`](FeatureConstructor.md#name). ```js const newFeature = JScrewIt.Feature.commonOf(["ATOB", "NAME"], ["NAME", "SELF"]); ``` -This will create a new feature object equivalent to [ANY_DOCUMENT](FeatureConstructor.md#any_document). -This is because both [HTMLDOCUMENT](FeatureConstructor.md#htmldocument) and [DOCUMENT](FeatureConstructor.md#document) imply -[ANY_DOCUMENT](FeatureConstructor.md#any_document). +This will create a new feature object equivalent to [`ANY_DOCUMENT`](FeatureConstructor.md#any_document). +This is because both [`HTMLDOCUMENT`](FeatureConstructor.md#htmldocument) and [`DOCUMENT`](FeatureConstructor.md#document) imply [`ANY_DOCUMENT`](FeatureConstructor.md#any_document). ```js const newFeature = JScrewIt.Feature.commonOf("HTMLDOCUMENT", "DOCUMENT"); @@ -1726,11 +1725,11 @@ ___ Returns a short description of a predefined feature in plain English. -**`remarks`** +**`Remarks`** Different names or aliases of the same feature may have different descriptions. -**`throws`** +**`Throws`** An error is thrown if the specified argument is not a name or alias of a predefined feature. diff --git a/api-doc/interfaces/default.md b/api-doc/interfaces/default.md index 16eba31d..b359b288 100644 --- a/api-doc/interfaces/default.md +++ b/api-doc/interfaces/default.md @@ -1,7 +1,5 @@ # Interface: default -JScrewIt object, available in Node.js. - ## Table of contents ### Properties diff --git a/api-doc/interfaces/encode.md b/api-doc/interfaces/encode.md index f7f794fa..0a07adae 100644 --- a/api-doc/interfaces/encode.md +++ b/api-doc/interfaces/encode.md @@ -8,7 +8,7 @@ Encodes a given string into JSFuck. -**`throws`** +**`Throws`** An `Error` is thrown under the following circumstances. - The specified string cannot be encoded with the specified options. diff --git a/dev/internal/package-utils.mjs b/dev/internal/package-utils.mjs index daaee231..e1878220 100644 --- a/dev/internal/package-utils.mjs +++ b/dev/internal/package-utils.mjs @@ -164,4 +164,3 @@ export async function lintPackage(...configs) await lint(...configs); } - diff --git a/gulpfile.js b/gulpfile.js index f3b9fcc9..2add8a7e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -87,7 +87,7 @@ task 'clean', async () => { - const del = require('del'); + const { deleteAsync } = await import('del'); const patterns = [ @@ -101,7 +101,7 @@ task 'test/spec-runner.html', 'ui/**/*.js', ]; - await del(patterns); + await deleteAsync(patterns); }, ); @@ -117,7 +117,7 @@ task ( { src: ['src/**/*.js', '!src/ui/worker.js'], - parserOptions: { sourceType: 'module' }, + parserOptions: { ecmaVersion: 2015, sourceType: 'module' }, rules: { 'lines-around-comment': @@ -133,13 +133,14 @@ task }, { src: ['dev/**/*.js', 'gulpfile.js', 'test/patch-cov-source.js', '!dev/legacy/**'], + jsVersion: 2022, envs: 'node', - parserOptions: { ecmaVersion: 2022 }, }, { src: ['dev/**/*.mjs'], + jsVersion: 2022, envs: 'node', - parserOptions: { ecmaVersion: 2022, sourceType: 'module' }, + parserOptions: { sourceType: 'module' }, }, { src: @@ -152,12 +153,18 @@ task '!test/patch-cov-source.js', ], plugins: ['ebdd'], - // process.exitCode is not supported in Node.js 0.10. - rules: { 'no-process-exit': 'off' }, + rules: + { + // process.exitCode is not supported in Node.js 0.10. + 'no-process-exit': 'off', + // Throws when "./" is required. + 'n/no-unpublished-require': 'off', + }, }, { src: ['lib/**/*.ts', '!lib/feature-all.d.ts'], - parserOptions: { project: 'tsconfig.json', sourceType: 'module' }, + tsVersion: 'latest', + parserOptions: { project: 'tsconfig.json' }, }, { src: 'test/acceptance/**/*.feature' }, ); diff --git a/lib/encode.d.ts b/lib/encode.d.ts index 931130dc..54429d30 100644 --- a/lib/encode.d.ts +++ b/lib/encode.d.ts @@ -5,8 +5,9 @@ export interface EncodeOptions /** * Specifies the features available in the engines that evaluate the encoded output. * - * If this parameter is unspecified, [[DEFAULT|`JScrewIt.Feature.DEFAULT`]] is assumed: this - * ensures maximum compatibility but also generates the largest code. + * If this parameter is unspecified, {@link FeatureConstructor.DEFAULT | + * `JScrewIt.Feature.DEFAULT`} is assumed: this ensures maximum compatibility but also generates + * the largest code. * To generate shorter code, specify all features available in all target engines explicitly. */ features?: FeatureElementOrCompatibleArray | undefined; @@ -80,7 +81,7 @@ export interface EncodeOptions /** * Values of this type control the type of code generated from a given input. - * See [[EncodeOptions.runAs]] for the meaning of each possible value. + * See {@link EncodeOptions.runAs | `EncodeOptions.runAs`} for the meaning of each possible value. */ type RunAs = 'call' | 'eval' | 'express' | 'express-call' | 'express-eval' | 'none'; diff --git a/lib/feature.d.ts b/lib/feature.d.ts index 44639a12..85ba71f0 100644 --- a/lib/feature.d.ts +++ b/lib/feature.d.ts @@ -16,8 +16,8 @@ export interface ElementaryFeature extends PredefinedFeature * length of its output are available in a particular JavaScript engine. * * JScrewIt comes with a set of predefined feature objects exposed as property values of - * `JScrewIt.Feature` or [[ALL|`JScrewIt.Feature.ALL`]], where the property name is the feature's - * name or alias. + * `JScrewIt.Feature` or {@link FeatureConstructor.ALL | `JScrewIt.Feature.ALL`}, where the property + * name is the feature's name or alias. * * Besides these predefined features, it is possible to construct custom features from the union or * intersection of other features. @@ -28,10 +28,10 @@ export interface ElementaryFeature extends PredefinedFeature * their elementary components. * All other features, called *composite* features, can be constructed as a union of zero or more * elementary features. - * Two of the predefined composite features are particularly important: [[DEFAULT]] is - * the empty feature, indicating that no elementary feature is available at all; - * [[AUTO]] is the union of all elementary features available in the current - * environment. + * Two of the predefined composite features are particularly important: {@link + * FeatureConstructor.DEFAULT | `DEFAULT`} is the empty feature, indicating that no elementary + * feature is available at all; {@link FeatureConstructor.AUTO | `AUTO`} is the union of all + * elementary features available in the current environment. * * Not all features can be available at the same time: some features are necessarily incompatible, * meaning that they mutually exclude each other, and thus their union cannot be constructed. @@ -119,12 +119,13 @@ export interface FeatureConstructor extends FeatureAll * The constructor can be used with or without the `new` operator, e.g. * `new JScrewIt.Feature(feature1, feature2)` or `JScrewIt.Feature(feature1, feature2)`. * If no arguments are specified, the new feature object will be equivalent to - * [[DEFAULT]]. + * {@link FeatureConstructor.DEFAULT | `DEFAULT`}. * * @example * * The following statements are equivalent, and will all construct a new feature object - * including both [[ANY_DOCUMENT]] and [[ANY_WINDOW]]. + * including both {@link FeatureConstructor.ANY_DOCUMENT | `ANY_DOCUMENT`} and {@link + * FeatureConstructor.ANY_WINDOW | `ANY_WINDOW`}. * * ```js * new JScrewIt.Feature("ANY_DOCUMENT", "ANY_WINDOW"); @@ -172,12 +173,13 @@ export interface FeatureConstructor extends FeatureAll * The constructor can be used with or without the `new` operator, e.g. * `new JScrewIt.Feature(feature1, feature2)` or `JScrewIt.Feature(feature1, feature2)`. * If no arguments are specified, the new feature object will be equivalent to - * [[DEFAULT]]. + * {@link FeatureConstructor.DEFAULT | `DEFAULT`}. * * @example * * The following statements are equivalent, and will all construct a new feature object - * including both [[ANY_DOCUMENT]] and [[ANY_WINDOW]]. + * including both {@link FeatureConstructor.ANY_DOCUMENT | `ANY_DOCUMENT`} and {@link + * FeatureConstructor.ANY_WINDOW | `ANY_WINDOW`}. * * ```js * JScrewIt.Feature("ANY_DOCUMENT", "ANY_WINDOW"); @@ -253,15 +255,17 @@ export interface FeatureConstructor extends FeatureAll * * @example * - * This will create a new feature object equivalent to [[NAME]]. + * This will create a new feature object equivalent to {@link FeatureConstructor.NAME | `NAME`}. * * ```js * const newFeature = JScrewIt.Feature.commonOf(["ATOB", "NAME"], ["NAME", "SELF"]); * ``` * - * This will create a new feature object equivalent to [[ANY_DOCUMENT]]. - * This is because both [[HTMLDOCUMENT]] and [[DOCUMENT]] imply - * [[ANY_DOCUMENT]]. + * This will create a new feature object equivalent to {@link FeatureConstructor.ANY_DOCUMENT | + * `ANY_DOCUMENT`}. + * This is because both {@link FeatureConstructor.HTMLDOCUMENT | `HTMLDOCUMENT`} and {@link + * FeatureConstructor.DOCUMENT | `DOCUMENT`} imply {@link FeatureConstructor.ANY_DOCUMENT | + * `ANY_DOCUMENT`}. * * ```js * const newFeature = JScrewIt.Feature.commonOf("HTMLDOCUMENT", "DOCUMENT"); diff --git a/packages/~feature-hub/src/feature.ts b/packages/~feature-hub/src/feature.ts index aed1b2c5..46599ae1 100644 --- a/packages/~feature-hub/src/feature.ts +++ b/packages/~feature-hub/src/feature.ts @@ -365,8 +365,7 @@ FeatureConstructor let utilInspect: typeof util.inspect | undefined; try { - // eslint-disable-next-line @typescript-eslint/no-var-requires - utilInspect = (require('util') as typeof util).inspect; + utilInspect = (require('util') as typeof util).inspect; // eslint-disable-line } catch { } diff --git a/packages/~feature-hub/test/spec/feature.spec.ts b/packages/~feature-hub/test/spec/feature.spec.ts index aec1efce..2fe84c78 100644 --- a/packages/~feature-hub/test/spec/feature.spec.ts +++ b/packages/~feature-hub/test/spec/feature.spec.ts @@ -11,8 +11,7 @@ import type { Mask } from '../../src/mask'; import assert from 'assert'; import type util from 'util'; -// eslint-disable-next-line @typescript-eslint/no-var-requires -const getNodeUtil = (): typeof util => require('util') as typeof util; +const getNodeUtil = (): typeof util => require('util') as typeof util; // eslint-disable-line const noop = (): void => @@ -175,7 +174,7 @@ describe assert.deepEqual(Object.getOwnPropertyNames(obj), []); }, ); - } + }, ); describe @@ -205,7 +204,7 @@ describe assert.strictEqual(Feature.ELEMENTARY[2], Feature.ALL.C); }, ); - } + }, ); describe @@ -242,7 +241,7 @@ describe assert.strictEqual(Feature.ENGINE[2], Feature.ALL.C); }, ); - } + }, ); describe @@ -336,7 +335,7 @@ describe const featureObj = Feature._fromMask(mask); assert(featureObj); assert(maskAreEqual(featureObj.mask, mask)); - } + }, ); it @@ -362,7 +361,7 @@ describe const actual = Feature._fromMask(mask); assert.strictEqual(actual, null); } - } + }, ); }, ); @@ -393,7 +392,7 @@ it assert ( maskAreEqual(actual, featuresToMask(compatibleFeatureArray)), - `Actual value is:\n${actual as unknown}` + `Actual value is:\n${actual as unknown}`, ); } }, @@ -414,7 +413,7 @@ describe.per (Feature: FeatureConstructor, ...features: FeatureElement[]): boolean => Feature.areCompatible(features), }, - ] + ], ) ( 'Feature.areCompatible (#.description)', diff --git a/src/lib/encoder/encoder-base.js b/src/lib/encoder/encoder-base.js index 4673f340..d91195b2 100644 --- a/src/lib/encoder/encoder-base.js +++ b/src/lib/encoder/encoder-base.js @@ -25,7 +25,7 @@ import } from '../obj-utils'; import -{ SCREW_AS_STRING, SCREW_AS_BONDED_STRING, SCREW_NORMAL, ScrewBuffer } +{ SCREW_AS_BONDED_STRING, SCREW_AS_STRING, SCREW_NORMAL, ScrewBuffer } from '../screw-buffer'; import { SimpleSolution } from '../solution'; import { initStaticEncoder, replaceStaticString, shortestOf } from './encoder-utils'; diff --git a/src/lib/solution.js b/src/lib/solution.js index 9a9078b3..aadfe20f 100644 --- a/src/lib/solution.js +++ b/src/lib/solution.js @@ -1,4 +1,4 @@ -import { assignNoEnum, _Object_defineProperty } from './obj-utils'; +import { _Object_defineProperty, assignNoEnum } from './obj-utils'; import { AbstractSolution } from '~solution'; assignNoEnum diff --git a/src/package.yml.hbs b/src/package.yml.hbs index 40f8ce2f..2fdbbb1c 100644 --- a/src/package.yml.hbs +++ b/src/package.yml.hbs @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '18' + node-version: 18 >=18.1 - run: | npm install --prefix ../.. npm run lint diff --git a/test/extreme-test.js b/test/extreme-test.js index 6ee122a5..5f1a6a31 100644 --- a/test/extreme-test.js +++ b/test/extreme-test.js @@ -156,4 +156,3 @@ addEventListener('load', handleLoad); } )(); - diff --git a/tsconfig.json b/tsconfig.json index a344d461..8ea886ce 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "exactOptionalPropertyTypes": true, + "forceConsistentCasingInFileNames": true, "strict": true, "types": [] },