oembed-spec 1.3.32 → 1.3.33

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.
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  ## Features
15
15
 
16
- - Always on sync with [oEmbed providers](https://oembed.com/providers.json) (as npm postinstall hook).
16
+ - Always on sync with [oEmbed providers](https://oembed.com/providers.json) (updated weekly via GitHub Actions).
17
17
  - Handle http/https & www/non-www URLs variations.
18
18
  - Ability to pass extra oEmbed parameters.
19
19
  - Built for speed (see [benchmarks](benchmarks/README.md)).
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "oembed-spec",
3
3
  "description": "A parser for oEmbed specification",
4
4
  "homepage": "https://github.com/microlinkhq/oembed-spec",
5
- "version": "1.3.32",
5
+ "version": "1.3.33",
6
6
  "main": "src/index.js",
7
7
  "author": {
8
8
  "email": "hello@microlink.io",
@@ -57,7 +57,6 @@
57
57
  "oembed-parser": "latest",
58
58
  "simple-git-hooks": "latest",
59
59
  "standard": "latest",
60
- "standard-markdown": "latest",
61
60
  "standard-version": "latest"
62
61
  },
63
62
  "engines": {
@@ -67,6 +66,18 @@
67
66
  "scripts",
68
67
  "src"
69
68
  ],
69
+ "scripts": {
70
+ "benchmark": "node ./benchmarks/benchmark.js",
71
+ "clean": "rm -rf node_modules",
72
+ "contributors": "(npx git-authors-cli && npx finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true",
73
+ "lint": "standard",
74
+ "postrelease": "pnpm release:tags && pnpm release:github && (ci-publish || npm publish --access=public)",
75
+ "pretest": "pnpm lint",
76
+ "release": "standard-version -a",
77
+ "release:github": "github-generate-release",
78
+ "release:tags": "git push --follow-tags origin HEAD:master",
79
+ "test": "c8 ava"
80
+ },
70
81
  "license": "MIT",
71
82
  "ava": {
72
83
  "files": [
@@ -89,9 +100,6 @@
89
100
  "prettier-standard",
90
101
  "standard --fix"
91
102
  ],
92
- "*.md": [
93
- "standard-markdown"
94
- ],
95
103
  "package.json": [
96
104
  "finepack"
97
105
  ]
@@ -99,18 +107,5 @@
99
107
  "simple-git-hooks": {
100
108
  "commit-msg": "npx commitlint --edit",
101
109
  "pre-commit": "npx nano-staged"
102
- },
103
- "scripts": {
104
- "benchmark": "node ./benchmarks/benchmark.js",
105
- "clean": "rm -rf node_modules",
106
- "contributors": "(npx git-authors-cli && npx finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true",
107
- "lint": "standard-markdown README.md && standard",
108
- "postinstall": "node scripts/postinstall.js",
109
- "postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
110
- "pretest": "npm run lint",
111
- "release": "standard-version -a",
112
- "release:github": "github-generate-release",
113
- "release:tags": "git push --follow-tags origin HEAD:master",
114
- "test": "c8 ava"
115
110
  }
116
- }
111
+ }
@@ -117,11 +117,19 @@ function buildIndex (providers) {
117
117
  }
118
118
  }
119
119
 
120
- fetch(PROVIDERS_URL)
121
- .then(json =>
122
- writeFile(
123
- path.resolve(__dirname, '../src/providers.json'),
124
- JSON.stringify(buildIndex(normalizeProviders(json)), null, 2)
125
- )
120
+ async function main () {
121
+ const json = await fetch(PROVIDERS_URL)
122
+ const providers = normalizeProviders(json)
123
+ const data = buildIndex(providers)
124
+ await writeFile(
125
+ path.resolve(__dirname, '../src/providers.json'),
126
+ JSON.stringify(data, null, 2)
126
127
  )
127
- .catch(error => console.error(error) || process.exit(1))
128
+ }
129
+
130
+ main()
131
+ .then(() => process.exit(0))
132
+ .catch(error => {
133
+ console.error(error)
134
+ process.exit(1)
135
+ })
@@ -50,19 +50,15 @@ const matchSchemes = (url, schemes) => {
50
50
  }
51
51
 
52
52
  const matchProvider = (url, provider) => {
53
- const {
54
- schemes,
55
- domainWithoutSuffixOfOembedUrl,
56
- domainWithoutSuffixOfUrl
57
- } = provider
53
+ const { schemes, domainWithoutSuffixOfOembedUrl, domainWithoutSuffixOfUrl } =
54
+ provider
58
55
 
59
56
  if (schemes.length !== 0) {
60
57
  return matchSchemes(url, schemes) === true ? provider : undefined
61
58
  }
62
59
 
63
60
  // Since the URL doesn't have an scheme to match, try to match over oEmbed/url
64
- // domain. These are pre-computed during postinstall so that no redundant work
65
- // is needed.
61
+ // domain. These are pre-computed so that no redundant work is needed.
66
62
  const domain = getDomainWithoutSuffix(url)
67
63
  if (
68
64
  domain !== null &&
@@ -96,7 +92,7 @@ module.exports = url => {
96
92
  // work is needed. In case of a match, we usually have a list of one or two
97
93
  // candidates, which is very quick to match against.
98
94
  //
99
- // For more details about `index`, see documentation in `scripts/postinstall.js`.
95
+ // For more details about `index`, see documentation in `scripts/fetch-providers.js`.
100
96
  const indicesOfCandidates = new Set()
101
97
  for (const token of tokenize(baseUrl)) {
102
98
  const providersForToken = index[token]