swup 4.8.1 → 4.8.3

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.
@@ -1,5 +1,7 @@
1
- import type { Path, ParseOptions, TokensToRegexpOptions, RegexpToFunctionOptions, MatchFunction } from 'path-to-regexp';
1
+ import { match } from 'path-to-regexp';
2
+ import type { Path, MatchFunction } from 'path-to-regexp';
2
3
  export { type Path };
4
+ type Params = Parameters<typeof match>;
3
5
  /** Create a match function from a path pattern that checks if a URLs matches it. */
4
- export declare const matchPath: <P extends object = object>(path: Path, options?: ParseOptions & TokensToRegexpOptions & RegexpToFunctionOptions) => MatchFunction<P>;
6
+ export declare const matchPath: <P extends object = object>(path: Params[0], options?: Params[1]) => MatchFunction<P>;
5
7
  //# sourceMappingURL=matchPath.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"matchPath.d.ts","sourceRoot":"","sources":["../../../src/helpers/matchPath.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,IAAI,EACJ,YAAY,EACZ,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC;AAErB,oFAAoF;AACpF,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,iBACnC,IAAI,YACA,YAAY,GAAG,qBAAqB,GAAG,uBAAuB,KACtE,aAAa,CAAC,CAAC,CAMjB,CAAC"}
1
+ {"version":3,"file":"matchPath.d.ts","sourceRoot":"","sources":["../../../src/helpers/matchPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC;AAErB,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AAEvC,oFAAoF;AACpF,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,iBACnC,MAAM,CAAC,CAAC,CAAC,YACL,MAAM,CAAC,CAAC,CAAC,KACjB,aAAa,CAAC,CAAC,CAUjB,CAAC"}
@@ -4,7 +4,7 @@ export type Plugin = {
4
4
  isSwupPlugin: true;
5
5
  /** Name of this plugin */
6
6
  name: string;
7
- /** Version of this plugin. Currently not in use, defined here for backward compatiblity. */
7
+ /** Version of this plugin. Currently not in use, defined here for backward compatibility. */
8
8
  version?: string;
9
9
  /** The swup instance that mounted this plugin */
10
10
  swup?: Swup;
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/modules/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,MAAM,MAAM,MAAM,GAAG;IACpB,gCAAgC;IAChC,YAAY,EAAE,IAAI,CAAC;IACnB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,4FAA4F;IAC5F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC7C,mBAAmB;IACnB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,qBAAqB;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC;CACnC,CAAC;AAOF,wBAAwB;AACxB,eAAO,MAAM,GAAG,SAAmB,IAAI,UAAU,OAAO,yBAoBvD,CAAC;AAEF,0BAA0B;AAC1B,wBAAgB,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,wBAe9D;AAED,0CAA0C;AAC1C,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,sBAOnE"}
1
+ {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/modules/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,MAAM,MAAM,MAAM,GAAG;IACpB,gCAAgC;IAChC,YAAY,EAAE,IAAI,CAAC;IACnB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,6FAA6F;IAC7F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC7C,mBAAmB;IACnB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,qBAAqB;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC;CACnC,CAAC;AAOF,wBAAwB;AACxB,eAAO,MAAM,GAAG,SAAmB,IAAI,UAAU,OAAO,yBAoBvD,CAAC;AAEF,0BAA0B;AAC1B,wBAAgB,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,wBAe9D;AAED,0CAA0C;AAC1C,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,sBAOnE"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "swup",
3
3
  "amdName": "Swup",
4
- "version": "4.8.1",
4
+ "version": "4.8.3",
5
5
  "description": "Versatile and extensible page transition library for server-rendered websites",
6
6
  "type": "module",
7
7
  "source": "./src/Swup.ts",
@@ -33,7 +33,6 @@
33
33
  "lint:compat": "npx eslint --config .eslintrc.compat.cjs --no-eslintrc .",
34
34
  "lint:prettier": "prettier 'src/**/*.ts'",
35
35
  "prepublishOnly": "npm run build",
36
- "postinstall": "opencollective-postinstall || true",
37
36
  "test": "npm run test:unit && npm run test:e2e",
38
37
  "test:ci": "npm run test:unit && npm run test:e2e:ci",
39
38
  "test:unit": "vitest run --config ./tests/config/vitest.config.ts",
@@ -46,12 +45,29 @@
46
45
  "test:e2e:start": "npm run test:e2e:instrument && npm run test:e2e:serve",
47
46
  "prepare": "husky"
48
47
  },
49
- "author": "Georgy Marchuk",
48
+ "author": {
49
+ "name": "Georgy Marchuk",
50
+ "email": "gmarcuk@gmail.com",
51
+ "url": "https://gmrchk.com"
52
+ },
53
+ "contributors": [
54
+ {
55
+ "name": "Philipp Daun",
56
+ "email": "daun@daun.ltd",
57
+ "url": "https://philippdaun.net"
58
+ },
59
+ {
60
+ "name": "Rasso Hilber",
61
+ "email": "mail@rassohilber.com",
62
+ "url": "https://rassohilber.com"
63
+ }
64
+ ],
50
65
  "license": "MIT",
51
66
  "repository": {
52
67
  "type": "git",
53
68
  "url": "https://github.com/swup/swup.git"
54
69
  },
70
+ "homepage": "https://swup.js.org",
55
71
  "keywords": [
56
72
  "css",
57
73
  "page",
@@ -65,7 +81,7 @@
65
81
  },
66
82
  "devDependencies": {
67
83
  "@babel/preset-typescript": "^7.18.6",
68
- "@playwright/test": "^1.37.1",
84
+ "@playwright/test": "1.37.1",
69
85
  "@swup/browserslist-config": "^1.0.0",
70
86
  "@swup/prettier-config": "^1.0.0",
71
87
  "@types/dom-view-transitions": "^1.0.2",
@@ -86,7 +102,7 @@
86
102
  "serve": "^14.2.1",
87
103
  "typed-query-selector": "^2.11.0",
88
104
  "typescript": "^5.2.2",
89
- "vitest": "^2.1.1"
105
+ "vitest": "^3.0.9"
90
106
  },
91
107
  "collective": {
92
108
  "type": "opencollective",
@@ -2,7 +2,7 @@
2
2
  export const classify = (text: string, fallback?: string): string => {
3
3
  const output = String(text)
4
4
  .toLowerCase()
5
- // .normalize('NFD') // split an accented letter in the base letter and the acent
5
+ // .normalize('NFD') // split an accented letter in the base letter and the accent
6
6
  // .replace(/[\u0300-\u036f]/g, '') // remove all previously split accents
7
7
  .replace(/[\s/_.]+/g, '-') // replace spaces and _./ with '-'
8
8
  .replace(/[^\w-]+/g, '') // remove all non-word chars
@@ -1,20 +1,20 @@
1
1
  import { match } from 'path-to-regexp';
2
2
 
3
- import type {
4
- Path,
5
- ParseOptions,
6
- TokensToRegexpOptions,
7
- RegexpToFunctionOptions,
8
- MatchFunction
9
- } from 'path-to-regexp';
3
+ import type { Path, MatchFunction } from 'path-to-regexp';
10
4
 
11
5
  export { type Path };
12
6
 
7
+ type Params = Parameters<typeof match>;
8
+
13
9
  /** Create a match function from a path pattern that checks if a URLs matches it. */
14
10
  export const matchPath = <P extends object = object>(
15
- path: Path,
16
- options?: ParseOptions & TokensToRegexpOptions & RegexpToFunctionOptions
11
+ path: Params[0],
12
+ options?: Params[1]
17
13
  ): MatchFunction<P> => {
14
+ if (Array.isArray(path) && !path.length) {
15
+ path = '';
16
+ }
17
+
18
18
  try {
19
19
  return match<P>(path, options);
20
20
  } catch (error) {
@@ -118,7 +118,7 @@ export async function performNavigation(
118
118
  } else if (options.cache !== undefined) {
119
119
  visit.cache = { read: !!options.cache, write: !!options.cache };
120
120
  }
121
- // Delete this so that window.fetch doesn't mis-interpret it
121
+ // Delete this so that window.fetch doesn't misinterpret it
122
122
  delete options.cache;
123
123
 
124
124
  try {
@@ -5,7 +5,7 @@ export type Plugin = {
5
5
  isSwupPlugin: true;
6
6
  /** Name of this plugin */
7
7
  name: string;
8
- /** Version of this plugin. Currently not in use, defined here for backward compatiblity. */
8
+ /** Version of this plugin. Currently not in use, defined here for backward compatibility. */
9
9
  version?: string;
10
10
  /** The swup instance that mounted this plugin */
11
11
  swup?: Swup;
package/src/utils.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  // Re-export all utils to allow custom package export path
2
- // e.g. import { queryAll } from 'swup/utils'
2
+ // e.g. import { queryAll } from 'swup/utils';
3
3
 
4
4
  export * from './utils/index.js';