refactor!: cleanup platform support (#306)

* refactor!: cleanup platform support

* chore: lint

* fix: web platform

* feat: provide UniversalCache

Provide UniversalCache as a wrapper around Platform.shim.Cache.

* fix: invalid import

* refactor: remove isolated-vm support

* fix: type info

* refactor: cleanup exports

* fix: mark jintr as external dependency

In the bundled CJS node build, mark jintr as external.

* chore: add additional exports

web exports provide a way to select web implementation manually without
relying on the bundler to select it correctly from the "exports" field

web points to src/platform/web.js
web.bundle points to bundle/browser.js
web.bundle.browser points to bundle/browser.min.js

agnostic exports provide users of the library to provide their own
platform implementation without first importing the default one.

agnostic points to src/platform/lib.ts

* fix: toDash on web

* revert: eval is synchronous

* fix: use serializeDOM in FormatUtils

* ci: automate releases with `release-please`

* chore: clean up workflow files

* ci: fix NPM publish action

---------

Co-authored-by: LuanRT <luan.lrt4@gmail.com>
This commit is contained in:
Daniel Wykerd
2023-02-12 09:21:44 +02:00
committed by GitHub
parent a69e43bf3a
commit 2ccbe2ce62
504 changed files with 11184 additions and 6279 deletions

View File

@@ -1,4 +1,4 @@
import { YTNode } from '../../helpers';
import { YTNode } from '../../helpers.js';
class AuthorCommentBadge extends YTNode {
static type = 'AuthorCommentBadge';

View File

@@ -1,21 +1,21 @@
import Parser from '../../index';
import Parser from '../../index.js';
import Text from '../misc/Text';
import Thumbnail from '../misc/Thumbnail';
import CommentReplyDialog from './CommentReplyDialog';
import AuthorCommentBadge from './AuthorCommentBadge';
import Author from '../misc/Author';
import Text from '../misc/Text.js';
import Thumbnail from '../misc/Thumbnail.js';
import CommentReplyDialog from './CommentReplyDialog.js';
import AuthorCommentBadge from './AuthorCommentBadge.js';
import Author from '../misc/Author.js';
import type Menu from '../menus/Menu';
import type CommentActionButtons from './CommentActionButtons';
import type SponsorCommentBadge from './SponsorCommentBadge';
import type PdgCommentChip from './PdgCommentChip';
import type { ApiResponse } from '../../../core/Actions';
import type Actions from '../../../core/Actions';
import type Menu from '../menus/Menu.js';
import type CommentActionButtons from './CommentActionButtons.js';
import type SponsorCommentBadge from './SponsorCommentBadge.js';
import type PdgCommentChip from './PdgCommentChip.js';
import type { ApiResponse } from '../../../core/Actions.js';
import type Actions from '../../../core/Actions.js';
import Proto from '../../../proto/index';
import { InnertubeError } from '../../../utils/Utils';
import { YTNode, SuperParsedResult } from '../../helpers';
import Proto from '../../../proto/index.js';
import { InnertubeError } from '../../../utils/Utils.js';
import { YTNode, SuperParsedResult } from '../../helpers.js';
class Comment extends YTNode {
static type = 'Comment';

View File

@@ -1,8 +1,8 @@
import Parser from '../../index';
import type Button from '../Button';
import type ToggleButton from '../ToggleButton';
import type CreatorHeart from './CreatorHeart';
import { YTNode } from '../../helpers';
import Parser from '../../index.js';
import type Button from '../Button.js';
import type ToggleButton from '../ToggleButton.js';
import type CreatorHeart from './CreatorHeart.js';
import { YTNode } from '../../helpers.js';
class CommentActionButtons extends YTNode {
static type = 'CommentActionButtons';

View File

@@ -1,9 +1,9 @@
import Parser from '../..';
import Text from '../misc/Text';
import Thumbnail from '../misc/Thumbnail';
import type Button from '../Button';
import type EmojiPicker from './EmojiPicker';
import { YTNode } from '../../helpers';
import Parser from '../../index.js';
import Text from '../misc/Text.js';
import Thumbnail from '../misc/Thumbnail.js';
import type Button from '../Button.js';
import type EmojiPicker from './EmojiPicker.js';
import { YTNode } from '../../helpers.js';
class CommentDialog extends YTNode {
static type = 'CommentDialog';

View File

@@ -1,7 +1,7 @@
import Parser from '../../index';
import Thumbnail from '../misc/Thumbnail';
import type Button from '../Button';
import { YTNode } from '../../helpers';
import Parser from '../../index.js';
import Thumbnail from '../misc/Thumbnail.js';
import type Button from '../Button.js';
import { YTNode } from '../../helpers.js';
class CommentReplies extends YTNode {
static type = 'CommentReplies';

View File

@@ -1,8 +1,8 @@
import Parser from '../../index';
import Thumbnail from '../misc/Thumbnail';
import Text from '../misc/Text';
import type Button from '../Button';
import { YTNode } from '../../helpers';
import Parser from '../../index.js';
import Thumbnail from '../misc/Thumbnail.js';
import Text from '../misc/Text.js';
import type Button from '../Button.js';
import { YTNode } from '../../helpers.js';
class CommentReplyDialog extends YTNode {
static type = 'CommentReplyDialog';

View File

@@ -1,8 +1,8 @@
import Parser from '../../index';
import Thumbnail from '../misc/Thumbnail';
import Text from '../misc/Text';
import type Button from '../Button';
import { YTNode } from '../../helpers';
import Parser from '../../index.js';
import Thumbnail from '../misc/Thumbnail.js';
import Text from '../misc/Text.js';
import type Button from '../Button.js';
import { YTNode } from '../../helpers.js';
class CommentSimplebox extends YTNode {
static type = 'CommentSimplebox';

View File

@@ -1,12 +1,12 @@
import Parser from '../../index';
import Comment from './Comment';
import ContinuationItem from '../ContinuationItem';
import CommentReplies from './CommentReplies';
import Button from '../Button';
import type Actions from '../../../core/Actions';
import type { ObservedArray } from '../../helpers';
import { InnertubeError } from '../../../utils/Utils';
import { observe, YTNode } from '../../helpers';
import Parser from '../../index.js';
import Comment from './Comment.js';
import ContinuationItem from '../ContinuationItem.js';
import CommentReplies from './CommentReplies.js';
import Button from '../Button.js';
import type Actions from '../../../core/Actions.js';
import type { ObservedArray } from '../../helpers.js';
import { InnertubeError } from '../../../utils/Utils.js';
import { observe, YTNode } from '../../helpers.js';
class CommentThread extends YTNode {
static type = 'CommentThread';

View File

@@ -1,6 +1,6 @@
import Text from '../misc/Text';
import Thumbnail from '../misc/Thumbnail';
import { YTNode } from '../../helpers';
import Text from '../misc/Text.js';
import Thumbnail from '../misc/Thumbnail.js';
import { YTNode } from '../../helpers.js';
class CommentsEntryPointHeader extends YTNode {
static type = 'CommentsEntryPointHeader';

View File

@@ -1,8 +1,8 @@
import Parser from '../../index';
import Text from '../misc/Text';
import Thumbnail from '../misc/Thumbnail';
import type SortFilterSubMenu from '../SortFilterSubMenu';
import { YTNode } from '../../helpers';
import Parser from '../../index.js';
import Text from '../misc/Text.js';
import Thumbnail from '../misc/Thumbnail.js';
import type SortFilterSubMenu from '../SortFilterSubMenu.js';
import { YTNode } from '../../helpers.js';
class CommentsHeader extends YTNode {
static type = 'CommentsHeader';

View File

@@ -1,5 +1,5 @@
import { YTNode } from '../../helpers';
import Thumbnail from '../misc/Thumbnail';
import { YTNode } from '../../helpers.js';
import Thumbnail from '../misc/Thumbnail.js';
class CreatorHeart extends YTNode {
static type = 'CreatorHeart';

View File

@@ -1,6 +1,6 @@
import Text from '../misc/Text';
import { YTNode } from '../../helpers';
import Parser from '../..';
import Text from '../misc/Text.js';
import { YTNode } from '../../helpers.js';
import Parser from '../../index.js';
class EmojiPicker extends YTNode {
static type = 'EmojiPicker';

View File

@@ -1,5 +1,5 @@
import Text from '../misc/Text';
import { YTNode } from '../../helpers';
import Text from '../misc/Text.js';
import { YTNode } from '../../helpers.js';
class PdgCommentChip extends YTNode {
static type = 'PdgCommentChip';

View File

@@ -1,5 +1,5 @@
import Thumbnail from '../misc/Thumbnail';
import { YTNode } from '../../helpers';
import Thumbnail from '../misc/Thumbnail.js';
import { YTNode } from '../../helpers.js';
class SponsorCommentBadge extends YTNode {
static type = 'SponsorCommentBadge';