nitro-web 0.0.91 → 0.0.92

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/.editorconfig ADDED
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
package/client/globals.ts CHANGED
@@ -1,16 +1,12 @@
1
- import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState, Dispatch, SetStateAction } from 'react'
1
+ import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'
2
2
  import { Link, useLocation, useNavigate, useParams } from 'react-router-dom'
3
3
  import { onChange } from 'nitro-web'
4
- import { Store } from 'nitro-web/types'
5
4
 
6
5
  declare global {
7
- // useTracked global (normally defined in ./client/index.ts)
8
- const useTracked: () => [Store, Dispatch<SetStateAction<Store>>]
9
-
10
- // nitro-web global
6
+ // Common application globals
11
7
  const onChange: typeof import('nitro-web').onChange
12
-
13
- // common daependency globals
8
+
9
+ // Common aependency globals
14
10
  /** The public API for rendering a history-aware `<a>`. */
15
11
  const Link: typeof import('react-router-dom').Link
16
12
  const useCallback: typeof import('react').useCallback
@@ -25,9 +21,9 @@ declare global {
25
21
  }
26
22
 
27
23
  Object.assign(window, {
28
- // nitro-web global
24
+ // application globals
29
25
  onChange: onChange,
30
- // common dependency globals
26
+ // dependency globals
31
27
  Link: Link,
32
28
  useCallback: useCallback,
33
29
  useEffect: useEffect,
package/client/index.ts CHANGED
@@ -1,3 +1,6 @@
1
+ // Required Global Types
2
+ import '../types/required-globals.d.ts'
3
+
1
4
  // export const pi = parseFloat(3.142)
2
5
  // Utility functions
3
6
  export * from '../util.js'
package/package.json CHANGED
@@ -1,36 +1,26 @@
1
1
  {
2
2
  "name": "nitro-web",
3
- "version": "0.0.91",
3
+ "version": "0.0.92",
4
4
  "repository": "github:boycce/nitro-web",
5
5
  "homepage": "https://boycce.github.io/nitro-web/",
6
6
  "description": "Nitro is a battle-tested, modular base project to turbocharge your projects, styled using Tailwind 🚀",
7
- "type": "module",
8
7
  "main": "./client/index.ts",
9
- "types": "./types/globals.d.ts",
8
+ "type": "module",
10
9
  "exports": {
11
10
  ".": "./client/index.ts",
12
- "./.eslintrc.json": "./.eslintrc.json",
13
11
  "./client/imgs/*": "./client/imgs/*",
14
12
  "./client/globals": "./client/globals.ts",
15
13
  "./server": "./server/index.js",
16
14
  "./types": "./types.ts",
15
+ "./.eslintrc.json": "./.eslintrc.json",
16
+ "./tsconfig.json": "./tsconfig.json",
17
+ "./webpack.config.js": "./webpack.config.js",
17
18
  "./util": {
18
19
  "require": "./util.js",
19
20
  "import": "./util.js",
20
21
  "types": "./types/util.d.ts"
21
- },
22
- "./webpack.config.js": "./webpack.config.js"
22
+ }
23
23
  },
24
- "files": [
25
- ".eslintrc.json",
26
- "client",
27
- "components",
28
- "server",
29
- "types",
30
- "types.ts",
31
- "util.js",
32
- "webpack.config.js"
33
- ],
34
24
  "scripts": {
35
25
  "major": "npm run types && standard-version -a --release-as major && npm publish && cd ../webpack && npm publish",
36
26
  "minor": "npm run types && standard-version -a --release-as minor && npm publish && cd ../webpack && npm publish",
@@ -0,0 +1,13 @@
1
+ const versionRegex = /"(@nitro-web\/webpack|nitro-web)"\s*:\s*"([~^*><= -]*)([0-9.]+)"/
2
+
3
+ module.exports.readVersion = function (contents) {
4
+ // This is just for showing the version in the console
5
+ const version = contents.match(versionRegex)?.[3]
6
+ return version
7
+ }
8
+
9
+ module.exports.writeVersion = function (contents, newVersion) {
10
+ return contents.replaceAll(new RegExp(versionRegex, 'g'), (match, packageName, prefix) => {
11
+ return `"${packageName}": "${prefix}${newVersion}"`
12
+ })
13
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "checkJs": true,
5
+ "allowSyntheticDefaultImports": true,
6
+ "downlevelIteration": true,
7
+ "esModuleInterop": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "isolatedModules": true,
10
+ "jsx": "react-jsx",
11
+ "lib": ["es6", "dom", "dom.iterable", "esnext"],
12
+ "module": "esnext",
13
+ "moduleResolution": "bundler",
14
+ "noEmit": false,
15
+ "noFallthroughCasesInSwitch": true,
16
+ "noImplicitAny": true,
17
+ "noImplicitReturns": false,
18
+ "noImplicitThis": true,
19
+ "noStrictGenericChecks": false,
20
+ "outDir": "./dist",
21
+ "paths": {
22
+ "types": ["./types.ts"]
23
+ },
24
+ "resolveJsonModule": true,
25
+ "rootDir": "./",
26
+ "skipLibCheck": true,
27
+ "sourceMap": true,
28
+ "strict": true,
29
+ "target": "es2022"
30
+ },
31
+ "include": [
32
+ "client",
33
+ "components",
34
+ "server/constants.js",
35
+ "types",
36
+ "./types/core-only-globals.d.ts"
37
+ ]
38
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "declaration": true,
5
+ "declarationMap": true,
6
+ "emitDeclarationOnly": true,
7
+ "esModuleInterop": true,
8
+ "jsx": "react-jsx",
9
+ "outDir": "./types",
10
+ "skipLibCheck": true,
11
+ },
12
+ "include": [
13
+ "util.js"
14
+ ]
15
+ }
@@ -0,0 +1,9 @@
1
+ import { Store } from 'nitro-web/types'
2
+ import { Dispatch, SetStateAction } from 'react'
3
+
4
+ // Core-only global, this global will be defined globally in the project (e.g. in ./client/index.ts)
5
+ declare global {
6
+ const useTracked: () => [Store, Dispatch<SetStateAction<Store>>]
7
+ }
8
+
9
+ export {}
@@ -1,3 +1,4 @@
1
+ // Required global types
1
2
  import 'twin.macro'
2
3
  import { css as cssImport } from '@emotion/react'
3
4
  import styledImport from '@emotion/styled'
@@ -36,5 +37,3 @@ declare module 'react' {
36
37
  for?: string | undefined
37
38
  }
38
39
  }
39
-
40
- export {}