-
Notifications
You must be signed in to change notification settings - Fork 692
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #337 from didi/1.0.4-alpha
1.0.4 alpha
- Loading branch information
Showing
81 changed files
with
4,828 additions
and
4,993 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
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
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import _cml_ from 'chameleon-runtime'; | ||
|
||
exports.default = _cml_.createApp(exports.default).getOptions() | ||
module.exports = function(){ | ||
_cml_.createApp(exports.default).getOptions(); | ||
} |
4 changes: 3 additions & 1 deletion
4
packages/chameleon-loader/src/cml-compile/runtime/component.js
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import _cml_ from 'chameleon-runtime'; | ||
|
||
exports.default = _cml_.createComponent(exports.default).getOptions() | ||
module.exports = function(){ | ||
_cml_.createComponent(exports.default).getOptions(); | ||
} |
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 |
---|---|---|
@@ -1,7 +1,11 @@ | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
module.exports = function getRunTimeSnippet(platform, type) { | ||
const _ = module.exports = {} ; | ||
_.getMiniAppRunTimeSnippet = function (platform, type) { | ||
return fs.readFileSync(path.join(__dirname, `./${type}.js`)) | ||
} | ||
_.getVueRunTimeSnippet = function (platform, type) { | ||
return fs.readFileSync(path.join(__dirname, `./web/${type}.js`)) | ||
} | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import _cml_ from 'chameleon-runtime'; | ||
|
||
exports.default = _cml_.createPage(exports.default).getOptions() | ||
module.exports = function(){ | ||
_cml_.createPage(exports.default).getOptions(); | ||
} |
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,2 @@ | ||
import _cml_ from 'chameleon-runtime'; | ||
exports.default = _cml_.createApp(exports.default).getOptions() |
3 changes: 3 additions & 0 deletions
3
packages/chameleon-loader/src/cml-compile/runtime/web/component.js
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 _cml_ from 'chameleon-runtime'; | ||
|
||
exports.default = _cml_.createComponent(exports.default).getOptions() |
3 changes: 3 additions & 0 deletions
3
packages/chameleon-loader/src/cml-compile/runtime/web/page.js
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 _cml_ from 'chameleon-runtime'; | ||
|
||
exports.default = _cml_.createPage(exports.default).getOptions() |
22 changes: 19 additions & 3 deletions
22
packages/chameleon-loader/src/cml-compile/wxml-selector.js
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 |
---|---|---|
@@ -1,27 +1,43 @@ | ||
|
||
/*这个文件用来处理原生小程序组件*/ | ||
|
||
const loaderUtils = require('loader-utils'); | ||
const fs = require('fs'); | ||
const cmlUtils = require('chameleon-tool-utils'); | ||
const path = require('path'); | ||
|
||
module.exports = function(content) { | ||
const self = this; | ||
const resource = this.resourcePath; | ||
const extName = path.extname(resource); | ||
const cssExt = { | ||
'.wxml': '.wxss', | ||
'.axml': '.acss', | ||
'.swan': '.css', | ||
'.qml': '.qss' | ||
} | ||
const styles = cssExt[extName]; | ||
const query = loaderUtils.getOptions(this) || {} | ||
const type = query.type; | ||
let targetFilePath = ''; | ||
let output = ''; | ||
let extMap = { | ||
script: '.js', | ||
styles: '.wxss' | ||
styles | ||
} | ||
targetFilePath = resource.replace(/\.wxml/, extMap[type]); | ||
// targetFilePath = resource.replace(/\.wxml/, extMap[type]); | ||
targetFilePath = resource.replace(new RegExp(`${extName}$`), extMap[type]); | ||
if (!cmlUtils.isFile(targetFilePath)) { | ||
throw new Error(`can't find ${targetFilePath}`) | ||
} else { | ||
self.addDependency(targetFilePath); | ||
output = fs.readFileSync(targetFilePath, {encoding: 'utf-8'}) | ||
} | ||
if(type === 'script'){ | ||
return `module.exports = function(){\n | ||
${output} | ||
}` | ||
} | ||
|
||
return output; | ||
|
||
} |
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
Oops, something went wrong.