Socket
Socket
Sign inDemoInstall

@aurelia/platform

Package Overview
Dependencies
Maintainers
1
Versions
546
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aurelia/platform - npm Package Compare versions

Comparing version 2.1.0-dev.202401061915 to 2.1.0-dev.202401281151

7

CHANGELOG.md

@@ -6,2 +6,9 @@ # Change Log

<a name="2.0.0-beta.10"></a>
# 2.0.0-beta.10 (2024-01-26)
### Refactorings:
* **enums:** string literal types in favour of const enums (#1870) ([e21e0c9](https://github.com/aurelia/aurelia/commit/e21e0c9))
<a name="2.0.0-beta.9"></a>

@@ -8,0 +15,0 @@ # 2.0.0-beta.9 (2023-12-12)

16

dist/types/index.d.ts

@@ -0,1 +1,6 @@

declare const tsPending: "pending";
declare const tsRunning: "running";
declare const tsCompleted: "completed";
declare const tsCanceled: "canceled";
export type TaskStatus = typeof tsPending | typeof tsRunning | typeof tsCompleted | typeof tsCanceled;
export declare class Platform<TGlobal extends typeof globalThis = typeof globalThis> {

@@ -60,8 +65,2 @@ readonly globalThis: TGlobal;

}
export declare const enum TaskStatus {
pending = 0,
running = 1,
completed = 2,
canceled = 3
}
type UnwrapPromise<T> = T extends Promise<infer R> ? R : T;

@@ -93,7 +92,2 @@ export interface ITask<T = any> {

}
export declare const enum TaskQueuePriority {
render = 0,
macroTask = 1,
postRender = 2
}
export type QueueTaskOptions = {

@@ -100,0 +94,0 @@ /**

{
"name": "@aurelia/platform",
"version": "2.1.0-dev.202401061915",
"version": "2.1.0-dev.202401281151",
"main": "dist/cjs/index.cjs",

@@ -5,0 +5,0 @@ "module": "dist/esm/index.mjs",

@@ -0,1 +1,7 @@

const tsPending = 'pending' as const;
const tsRunning = 'running' as const;
const tsCompleted = 'completed' as const;
const tsCanceled = 'canceled' as const;
export type TaskStatus = typeof tsPending | typeof tsRunning | typeof tsCompleted | typeof tsCanceled;
/* eslint-disable @typescript-eslint/no-explicit-any */

@@ -197,3 +203,3 @@ const lookup = new Map<object, Platform>();

// If it's still running, it can only be an async task
if (cur.status === TaskStatus.running) {
if (cur.status === tsRunning) {
if (cur.suspend === true) {

@@ -455,9 +461,2 @@ this._suspenderTask = cur;

export const enum TaskStatus {
pending = 0,
running = 1,
completed = 2,
canceled = 3,
}
type UnwrapPromise<T> = T extends Promise<infer R> ? R : T;

@@ -484,3 +483,3 @@

switch (this._status) {
case TaskStatus.pending: {
case tsPending: {
const promise = this._result = createExposedPromise();

@@ -491,7 +490,8 @@ this._resolve = promise.resolve;

}
case TaskStatus.running:
/* istanbul ignore next */
case tsRunning:
throw createError('Trying to await task from within task will cause a deadlock.');
case TaskStatus.completed:
case tsCompleted:
return this._result = Promise.resolve() as unknown as Promise<UnwrapPromise<T>>;
case TaskStatus.canceled:
case tsCanceled:
return this._result = Promise.reject(new TaskAbortError(this));

@@ -504,3 +504,3 @@ }

/** @internal */
private _status: TaskStatus = TaskStatus.pending;
private _status: TaskStatus = tsPending;
public get status(): TaskStatus {

@@ -530,3 +530,3 @@ return this._status;

if (this._status !== TaskStatus.pending) {
if (this._status !== tsPending) {
if (__DEV__ && this._tracer.enabled) { this._tracer.leave(this, 'run error'); }

@@ -551,3 +551,3 @@

this._status = TaskStatus.running;
this._status = tsRunning;

@@ -563,5 +563,5 @@ try {

// Persistent tasks never reach completed status. They're either pending, running, or canceled.
this._status = TaskStatus.canceled;
this._status = tsCanceled;
} else {
this._status = TaskStatus.completed;
this._status = tsCompleted;
}

@@ -605,5 +605,5 @@

// Persistent tasks never reach completed status. They're either pending, running, or canceled.
this._status = TaskStatus.canceled;
this._status = tsCanceled;
} else {
this._status = TaskStatus.completed;
this._status = tsCompleted;
}

@@ -642,3 +642,3 @@

if (this._status === TaskStatus.pending) {
if (this._status === tsPending) {
const taskQueue = this.taskQueue;

@@ -654,3 +654,3 @@ const reusable = this.reusable;

this._status = TaskStatus.canceled;
this._status = tsCanceled;

@@ -670,3 +670,3 @@ this.dispose();

return true;
} else if (this._status === TaskStatus.running && this.persistent) {
} else if (this._status === tsRunning && this.persistent) {
this.persistent = false;

@@ -690,3 +690,3 @@

this.queueTime = time + delay;
this._status = TaskStatus.pending;
this._status = tsPending;

@@ -716,3 +716,3 @@ this._resolve = void 0;

this.callback = callback;
this._status = TaskStatus.pending;
this._status = tsPending;

@@ -732,8 +732,2 @@ if (__DEV__ && this._tracer.enabled) { this._tracer.leave(this, 'reuse'); }

export const enum TaskQueuePriority {
render = 0,
macroTask = 1,
postRender = 2,
}
export type QueueTaskOptions = {

@@ -809,3 +803,3 @@ /**

const suspend = obj['suspend'];
const status = taskStatus(obj['_status']);
const status = obj['_status'];

@@ -818,11 +812,2 @@ const info = `id=${id} created=${created} queue=${queue} preempt=${preempt} persistent=${persistent} reusable=${reusable} status=${status} suspend=${suspend}`;

const taskStatus = (status: TaskStatus): 'pending' | 'running' | 'canceled' | 'completed' => {
switch (status) {
case TaskStatus.pending: return 'pending';
case TaskStatus.running: return 'running';
case TaskStatus.canceled: return 'canceled';
case TaskStatus.completed: return 'completed';
}
};
const defaultQueueTaskOptions: Required<QueueTaskOptions> = {

@@ -829,0 +814,0 @@ delay: 0,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc