@srfnstack/spliffy 0.8.0 → 0.8.1

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/index.mjs +10 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@srfnstack/spliffy",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "author": "snowbldr",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/narcolepticsnowman/spliffy",
@@ -16,7 +16,7 @@
16
16
  "url": "git@github.com:narcolepticsnowman/spliffy.git"
17
17
  },
18
18
  "scripts": {
19
- "test": "npm run lint && jest",
19
+ "test": "npm run lint:fix && jest",
20
20
  "lint": "standard --env jest src ./*js && standard --env jest --env browser --global Prism docs example",
21
21
  "lint:fix": "standard --env jest --fix src ./*js && standard --env jest --env browser --global Prism --fix docs example"
22
22
  },
package/src/index.mjs CHANGED
@@ -1,3 +1,6 @@
1
+ import path from 'path'
2
+ import { fileURLToPath } from 'url'
3
+
1
4
  /**
2
5
  * A helper for creating a redirect handler
3
6
  * @param location The location to redirect to
@@ -19,3 +22,10 @@ export { parseQuery, setMultiValueKey } from './url.mjs'
19
22
  * @returns {Promise<Server>} Either the https server if https is configured or the http server
20
23
  */
21
24
  export { default } from './start.mjs'
25
+
26
+ /**
27
+ * Get the dirname for the given meta url
28
+ * @param metaUrl The import.meta.url value to get the dirname from
29
+ * @return {string} The full path to the directory the module is in
30
+ */
31
+ export const moduleDirname = metaUrl => path.dirname(fileURLToPath(metaUrl))