forked from NervJS/taro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
186 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
const a = 'b' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { app } from './app' | ||
export default app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import React from 'react' | ||
import { app } from './app' | ||
export default app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react' | ||
|
||
class A extends Component { | ||
render () { | ||
return React.createElement('div') | ||
} | ||
} | ||
|
||
export default connect({})(A) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react' | ||
|
||
class A extends Component { | ||
render () { | ||
return React.createElement('div') | ||
} | ||
} | ||
|
||
export default A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const a: string = '' | ||
|
||
class A extends Component { | ||
render () { | ||
return <div className={a} /> | ||
} | ||
} | ||
|
||
export default A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Vue from 'vue' | ||
import { app } from './app' | ||
export default app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { compile } from './compile' | ||
|
||
describe('general', () => { | ||
describe('not export default', () => { | ||
test('app', async () => { | ||
async function check () { | ||
await compile('not-export-default.txt', { type: 'app', framework: 'vue' }) | ||
} | ||
await expect(check()).rejects.toBeTruthy() | ||
}) | ||
|
||
test('page', async () => { | ||
async function check () { | ||
await compile('not-export-default.txt', { type: 'page', framework: 'vue' }) | ||
} | ||
await expect(check()).rejects.toBeTruthy() | ||
}) | ||
|
||
test('react', async () => { | ||
async function check () { | ||
await compile('not-export-default.txt', { type: 'app', framework: 'react' }) | ||
} | ||
await expect(check()).rejects.toBeTruthy() | ||
}) | ||
}) | ||
|
||
describe.skip('syntax', () => { | ||
test('tsx', async () => { | ||
const result = await compile('syntax-tsx.txt', { type: 'page', framework: 'react' }) | ||
expect(result).toBe('') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { getOptions } from 'loader-utils' | ||
import * as webpack from 'webpack' | ||
import appLoader from './app' | ||
import pageLoader from './page' | ||
|
||
export default function (this: webpack.loader.LoaderContext, source: string) { | ||
const options = getOptions(this) | ||
if (options.type === 'app') { | ||
appLoader.call(this, source) | ||
} else { | ||
pageLoader.call(this, source) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters