@webspatial/react-sdk 0.0.1 → 0.0.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.
package/npm/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
- if (process.env.XR_ENV === 'web') {
4
- module.exports = require('../dist/cjs/web/index.js')
5
- } else {
3
+ if (process.env.XR_ENV === 'avp') {
6
4
  module.exports = require('../dist/cjs/default/index.js')
5
+ } else {
6
+ module.exports = require('../dist/cjs/web/index.js')
7
7
  }
@@ -1,9 +1,9 @@
1
- const infix = 'avp'
1
+ const AVP = 'avp'
2
2
  function getEnv() {
3
3
  const env = process.env.XR_ENV || ''
4
4
  return env
5
5
  }
6
6
  module.exports = {
7
7
  getEnv,
8
- infix,
8
+ AVP,
9
9
  }
@@ -0,0 +1,5 @@
1
+ import { Plugin } from 'vite'
2
+
3
+ declare function injectProcessEnv(): Plugin
4
+
5
+ export = injectProcessEnv
@@ -1,6 +1,6 @@
1
1
  const path = require('path')
2
2
  const fs = require('fs')
3
- const { getEnv, infix } = require('./shared')
3
+ const { getEnv, AVP } = require('./shared')
4
4
 
5
5
  function injectProcessEnv() {
6
6
  return {
@@ -8,10 +8,10 @@ function injectProcessEnv() {
8
8
  config: () => {
9
9
  const xrEnv = getEnv()
10
10
  const output =
11
- xrEnv !== 'web'
11
+ xrEnv === AVP
12
12
  ? {
13
- entryFileNames: `assets/[name]-[hash].${infix}.js`, // no share js entry
14
- chunkFileNames: `assets/[name]-[hash].${infix}.js`, // no share js chunk
13
+ entryFileNames: `assets/[name]-[hash].${AVP}.js`, // no share js entry
14
+ chunkFileNames: `assets/[name]-[hash].${AVP}.js`, // no share js chunk
15
15
  assetFileNames: 'assets/[name]-[hash][extname]', // shared css image
16
16
  }
17
17
  : {}
@@ -22,7 +22,7 @@ function injectProcessEnv() {
22
22
  'import.meta.env.XR_ENV': JSON.stringify(xrEnv), // visible in development
23
23
  },
24
24
  build: {
25
- emptyOutDir: xrEnv === 'web', // keep dist folder
25
+ emptyOutDir: xrEnv !== AVP, // keep dist folder
26
26
  rollupOptions: { output },
27
27
  commonjsOptions: {
28
28
  include: [/@webspatial\/react-sdk\/.*/, /node_modules/],
@@ -44,7 +44,7 @@ function injectProcessEnv() {
44
44
  renderStart(outputOptions) {
45
45
  // rename index.html to index.avp.html
46
46
  const xrEnv = getEnv()
47
- if (xrEnv === 'web') {
47
+ if (xrEnv !== AVP) {
48
48
  return
49
49
  }
50
50
 
@@ -61,7 +61,7 @@ function injectProcessEnv() {
61
61
  },
62
62
  writeBundle(outputOptions) {
63
63
  const xrEnv = getEnv()
64
- if (xrEnv === 'web') {
64
+ if (xrEnv !== AVP) {
65
65
  return
66
66
  }
67
67
  const outDir = outputOptions.dir || 'dist'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webspatial/react-sdk",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "React components for WebSpatial",
5
5
  "main": "npm/index.js",
6
6
  "types": "npm/index.d.ts",
@@ -35,12 +35,12 @@
35
35
  "lodash.isequal": "^4.5.0",
36
36
  "loglevel": "^1.9.1",
37
37
  "three": "^0.170.0",
38
- "@webspatial/react-sdk": "0.0.1",
38
+ "@webspatial/react-sdk": "0.0.3",
39
39
  "@webspatial/core-sdk": "0.0.1-alpha"
40
40
  },
41
41
  "peerDependencies": {
42
- "react": "^18.3.1",
43
- "react-dom": "^18.3.1"
42
+ "react": ">=18.0.0",
43
+ "react-dom": ">=18.0.0"
44
44
  },
45
45
  "peerDependenciesMeta": {
46
46
  "react": {
@@ -68,7 +68,7 @@
68
68
  "webpack": "^5.98.0"
69
69
  },
70
70
  "scripts": {
71
- "test": "echo \"Error: no test specified\" && exit 1",
71
+ "test": "tsc -p ./tsconfig.json",
72
72
  "dev": "node esbuild.mjs --watch",
73
73
  "build": "node esbuild.mjs",
74
74
  "start": "npm run dev",