Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

urlpattern-polyfill

Package Overview
Dependencies
Maintainers
3
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

urlpattern-polyfill - npm Package Compare versions

Comparing version 4.0.2 to 4.0.3

86

dist/index.d.ts

@@ -1,49 +0,53 @@

export type URLPatternInput = URLPatternInit | string;
export {};
export class URLPattern {
constructor(init?: URLPatternInput, baseURL?: string);
declare global {
type URLPatternInput = URLPatternInit | string;
test(input?: URLPatternInput, baseURL?: string): boolean;
class URLPattern {
constructor(init?: URLPatternInput, baseURL?: string);
exec(input?: URLPatternInput, baseURL?: string): URLPatternResult | null;
test(input?: URLPatternInput, baseURL?: string): boolean;
readonly protocol: string;
readonly username: string;
readonly password: string;
readonly hostname: string;
readonly port: string;
readonly pathname: string;
readonly search: string;
readonly hash: string;
}
exec(input?: URLPatternInput, baseURL?: string): URLPatternResult | null;
export interface URLPatternInit {
baseURL?: string;
username?: string;
password?: string;
protocol?: string;
hostname?: string;
port?: string;
pathname?: string;
search?: string;
hash?: string;
}
readonly protocol: string;
readonly username: string;
readonly password: string;
readonly hostname: string;
readonly port: string;
readonly pathname: string;
readonly search: string;
readonly hash: string;
}
export interface URLPatternResult {
inputs: [URLPatternInput];
protocol: URLPatternComponentResult;
username: URLPatternComponentResult;
password: URLPatternComponentResult;
hostname: URLPatternComponentResult;
port: URLPatternComponentResult;
pathname: URLPatternComponentResult;
search: URLPatternComponentResult;
hash: URLPatternComponentResult;
}
interface URLPatternInit {
baseURL?: string;
username?: string;
password?: string;
protocol?: string;
hostname?: string;
port?: string;
pathname?: string;
search?: string;
hash?: string;
}
export interface URLPatternComponentResult {
input: string;
groups: {
[key: string]: string | undefined;
};
interface URLPatternResult {
inputs: [URLPatternInput];
protocol: URLPatternComponentResult;
username: URLPatternComponentResult;
password: URLPatternComponentResult;
hostname: URLPatternComponentResult;
port: URLPatternComponentResult;
pathname: URLPatternComponentResult;
search: URLPatternComponentResult;
hash: URLPatternComponentResult;
}
interface URLPatternComponentResult {
input: string;
groups: {
[key: string]: string | undefined;
};
}
}
{
"name": "urlpattern-polyfill",
"version": "4.0.2",
"version": "4.0.3",
"description": "Polyfill for the URLPattern API",

@@ -31,3 +31,4 @@ "repository": {

"devDependencies": {
"ava": "^3.14.0",
"@ava/typescript": "^3.0.1",
"ava": "^4.1.0",
"esbuild": "^0.14.31",

@@ -37,6 +38,18 @@ "rimraf": "^3.0.2",

},
"ava": {
"files": [
"test/**/*",
"!test/wpt"
],
"typescript": {
"rewritePaths": {
"src/": "dist/"
},
"compile": false
}
},
"scripts": {
"prebuild": "rimraf dist",
"build:esm": "esbuild --bundle --format=esm src/patch-global.mts --outfile=dist/index.js",
"build:cjs": "esbuild --bundle --format=cjs src/url-pattern.ts --outfile=dist/url-pattern.cjs && esbuild --format=cjs src/patch-global.cts --outfile=dist/index.cjs",
"build:cjs": "esbuild --bundle --format=cjs src/patch-global.cts --outfile=dist/index.cjs",
"copy:dts": "cp ./src/index.d.ts ./dist",

@@ -46,2 +59,3 @@ "build": "npm run build:esm && npm run build:cjs && npm run copy:dts",

"test": "ava --fail-fast -s",
"manual-test": "npx http-server -o /index.html -p 4203",
"publish-dev": "npm test && VERSION=${npm_package_version%-*}-dev.`git rev-parse --short HEAD` && npm version --no-git-tag-version $VERSION && npm publish --tag dev"

@@ -48,0 +62,0 @@ },

@@ -19,6 +19,5 @@ [![run-tests](https://github.com/kenchris/urlpattern-polyfill/actions/workflows/workflow.yml/badge.svg)](https://github.com/kenchris/urlpattern-polyfill/actions/workflows/workflow.yml)

## loading as ESM module
```javascript
// CJS module loading (Node.js)
require("urlpattern-polyfill");
// Conditional ESM module loading (Node.js and browser)

@@ -42,2 +41,26 @@ if (!globalThis.URLPattern) {

## loading as CommonJs module
```javascript
// Conditional CJS module loading (Node.js)
if (!globalThis.URLPattern) {
require("urlpattern-polyfill");
}
/**
* The above is the recommended way to load the CommonJs module, as it only
* loads it on demand, thus when not natively supported by the runtime or
* already polyfilled.
*/
require("urlpattern-polyfill");
/**
* In case you want to replace an existing implementation with the polyfill:
*/
const {URLPattern} = require("urlpattern-polyfill");;
globalThis.URLPattern = URLPattern
```
> ## Note:
> No matter how you load the polyfill, when there is no implementation in your environment, it will _always_ add it to the global object.
Basic example

@@ -44,0 +67,0 @@ ---

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