Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
natew committed Jan 11, 2025
1 parent 5136325 commit 4da4a3f
Show file tree
Hide file tree
Showing 78 changed files with 2,070 additions and 1,704 deletions.
2 changes: 1 addition & 1 deletion apps/onestack.dev/data/docs/common-issues.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ import { one } from 'one/vite'
export default {
plugins: [
one({
app: {
native: {
// make sure this matches the key you use to build your native app
key: 'my-app'
}
Expand Down
4 changes: 2 additions & 2 deletions apps/onestack.dev/data/docs/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export default {
barrel: ['my-icon-package']
},

// all native-specific config nests in app:
app: {
// native-specific config:
native: {
// One will set up your React Native app to run via AppRegistry.registerComponent(app.key)
// This setting determines app.key and must match the React Native app container you've built
key: 'AppName',
Expand Down
2 changes: 1 addition & 1 deletion examples/one-recommended/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default {
defaultRenderMode: 'ssg',
},

app: {
native: {
key: 'one-example',
},
}),
Expand Down
6 changes: 0 additions & 6 deletions examples/one-tailwind/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
Welcome to One! This is a branch from one-basic to implement with tailwind

To run your app:

```
npm run one
```
16 changes: 7 additions & 9 deletions examples/one-tailwind/app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
import { Slot } from "one";
import "./base.css";
// debug
import { Slot } from 'one'
import './base.css'

export default function Layout() {
return (
<>
{typeof document !== "undefined" && (
{typeof document !== 'undefined' && (
<>
<meta charSet="utf-8" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=5"
/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5" />
<link rel="icon" href="/favicon.svg" />
</>
)}

<div className="bg-red-500 p-4 border uppercase">this is bg should be red by tailwind</div>
{/* <div className="bg-red-500 p-4 border uppercase">this is bg should be red by tailwind</div> */}

<Slot />
</>
);
)
}
18 changes: 10 additions & 8 deletions examples/one-tailwind/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import { Text, View } from "react-native";
import "./base.css";
// debug
import { Text, View } from 'react-native'
import './base.css'

export default function Index() {
return (
<View
style={{
flex: 1,
alignSelf: "center",
justifyContent: "center",
alignItems: "center",
minHeight: "100%",
}}>
alignSelf: 'center',
justifyContent: 'center',
alignItems: 'center',
minHeight: '100%',
}}
>
<Text>Hello world, from One</Text>
<div className="bg-red-500 p-4 border uppercase">this is bg should be red by tailwind</div>
</View>
);
)
}
5 changes: 3 additions & 2 deletions examples/one-tailwind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
},
"dependencies": {
"expo": "~52.0.17",
"nativewind": "^4.1.23",
"one": "workspace:*",
"react": "^19.0.0",
"react-native": "^0.76.5",
"react": "^18.3.1",
"react-native": "0.76.5",
"react-native-reanimated": "~3.16.5",
"react-native-safe-area-context": "4.10.5",
"react-native-screens": "4.4.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/one-tamagui/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function HomePage() {
return (
<YStack bg="$color1" mih="100%" gap="$4" px="$4" ai="center" jc="center" f={1}>
<Text fontSize="$8" textAlign="center">
Hello, One.
Hello, One
</Text>

<Image src={oneBall} width={128} height={128} />
Expand Down
2 changes: 1 addition & 1 deletion examples/one-tamagui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
defaultRenderMode: 'ssg',
},

app: {
native: {
// set to the key of your native app
// will call AppRegistry.registerComponent(app.key)
key: 'one-example',
Expand Down
2 changes: 1 addition & 1 deletion examples/testflight/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default {
defaultRenderMode: 'ssg',
},

app: {
native: {
key: 'one-example',
},
}),
Expand Down
9 changes: 9 additions & 0 deletions next.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
- vercel using build output api

- build
- lets make a simple option to use vite-plugin-commonjs
- commonjs: (id) => boolean
- way to configure the api + server config during production builds

- cleanup
Expand Down Expand Up @@ -60,6 +62,13 @@

# backlog

- allow configuring swc from one

- // TODO see about moving to hotUpdate
// https://deploy-preview-16089--vite-docs-main.netlify.app/guide/api-vite-environment.html#the-hotupdate-hook

- we can avoid the reanimated babel plugin entirely if we don't detect reanimated in deps during scanDeps

- fix `sub middleware intercepts` test
- fix TODO intercept not working

Expand Down
45 changes: 45 additions & 0 deletions packages/compiler/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
MIT License

Copyright (c) 2021 Callstack

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

---

MIT License

Copyright (c) Arnaud Barré (https://github.com/ArnaudBarre)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@vxrn/vite-native-swc",
"name": "@vxrn/compiler",
"version": "1.1.396",
"type": "module",
"exports": {
Expand Down Expand Up @@ -33,6 +33,7 @@
"@babel/plugin-transform-react-jsx": "^7.25.9",
"@babel/plugin-transform-regenerator": "^7.25.9",
"@swc/core": "^1.10.4",
"@vxrn/utils": "workspace:*",
"@vxrn/vite-native-client": "workspace:*",
"metro-react-native-babel-preset": "^0.77.0"
},
Expand Down
15 changes: 15 additions & 0 deletions packages/compiler/src/configure.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
type Conf = {
enableReanimated?: boolean
enableCompiler?: boolean
enableNativeCSS?: boolean
}

export const configuration = {
enableReanimated: false,
enableCompiler: false,
enableNativeCSS: false,
} satisfies Conf

export function configureVXRNCompilerPlugin(_: Conf) {
Object.assign(configuration, _)
}
21 changes: 21 additions & 0 deletions packages/compiler/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { ParserConfig } from '@swc/core'

import { createDebugger } from '@vxrn/debug'

export const { debug } = createDebugger('vxrn:compiler-plugin')

export const runtimePublicPath = '/@react-refresh'

export const asyncGeneratorRegex = /(async \*|async function\*|for await)/

export const parsers: Record<string, ParserConfig> = {
'.tsx': { syntax: 'typescript', tsx: true, decorators: true },
'.ts': { syntax: 'typescript', tsx: false, decorators: true },
'.jsx': { syntax: 'ecmascript', jsx: true },
'.js': { syntax: 'ecmascript' },
'.mjs': { syntax: 'ecmascript' },
'.cjs': { syntax: 'ecmascript' },
'.mdx': { syntax: 'ecmascript', jsx: true },
}

export const validParsers = new Set([...Object.keys(parsers), '.css'])
Loading

0 comments on commit 4da4a3f

Please sign in to comment.