diff options
author | eric <thul.eric@gmail.com> | 2015-07-18 17:11:00 -0400 |
---|---|---|
committer | eric <thul.eric@gmail.com> | 2015-07-18 17:11:00 -0400 |
commit | 78da2ff4a8ba259403efc166d3f753068221914e (patch) | |
tree | a4858f5e16e3df01aee249ad53b5b76f90fb97de /example | |
parent | 418c9429609c6d80ddaf7df41e0ee64192e2ec7b (diff) | |
parent | 3610dff1b8308a810d827f0595832b326deff37b (diff) | |
download | purs-loader-78da2ff4a8ba259403efc166d3f753068221914e.tar.gz purs-loader-78da2ff4a8ba259403efc166d3f753068221914e.tar.zst purs-loader-78da2ff4a8ba259403efc166d3f753068221914e.zip |
Merge pull request #20 from ethul/topic/issue-18
Add FFI JavaScript as a webpack dependency
Diffstat (limited to 'example')
-rw-r--r-- | example/package.json | 6 | ||||
-rw-r--r-- | example/src/Test.purs | 4 | ||||
-rw-r--r-- | example/src/TestFFI.js | 7 | ||||
-rw-r--r-- | example/src/entry.js | 8 | ||||
-rw-r--r-- | example/webpack.config.js | 4 |
5 files changed, 20 insertions, 9 deletions
diff --git a/example/package.json b/example/package.json index df3e74f..d1319b1 100644 --- a/example/package.json +++ b/example/package.json | |||
@@ -3,13 +3,15 @@ | |||
3 | "version": "0.0.0", | 3 | "version": "0.0.0", |
4 | "private": true, | 4 | "private": true, |
5 | "scripts": { | 5 | "scripts": { |
6 | "build": "mkdir -p output && ./node_modules/.bin/webpack", | 6 | "build": "mkdir -p output && ./node_modules/.bin/webpack --progress --colors", |
7 | "build:watch": "mkdir -p output && ./node_modules/.bin/webpack --progress --colors --watch", | ||
7 | "run": "node bundle.js", | 8 | "run": "node bundle.js", |
8 | "clean": "rm -rf bower_components && rm -rf bundle.js && rm -rf node_modules && rm -rf output" | 9 | "clean": "rm -rf bower_components && rm -rf bundle.js && rm -rf node_modules && rm -rf output" |
9 | }, | 10 | }, |
10 | "license": "MIT", | 11 | "license": "MIT", |
11 | "devDependencies": { | 12 | "devDependencies": { |
13 | "node-libs-browser": "^0.5.2", | ||
12 | "purs-loader": "file:../", | 14 | "purs-loader": "file:../", |
13 | "webpack": "^1.8.4" | 15 | "webpack": "^1.10.1" |
14 | } | 16 | } |
15 | } | 17 | } |
diff --git a/example/src/Test.purs b/example/src/Test.purs index d9f1b96..133a192 100644 --- a/example/src/Test.purs +++ b/example/src/Test.purs | |||
@@ -1,5 +1,7 @@ | |||
1 | module Test (test) where | 1 | module Test (test, testing) where |
2 | 2 | ||
3 | import Prelude | 3 | import Prelude |
4 | 4 | ||
5 | test = "a" | 5 | test = "a" |
6 | |||
7 | foreign import testing :: String | ||
diff --git a/example/src/TestFFI.js b/example/src/TestFFI.js new file mode 100644 index 0000000..dc2f04f --- /dev/null +++ b/example/src/TestFFI.js | |||
@@ -0,0 +1,7 @@ | |||
1 | 'use strict'; | ||
2 | |||
3 | // module Test | ||
4 | |||
5 | var testing = 'abcde'; | ||
6 | |||
7 | exports.testing = testing; | ||
diff --git a/example/src/entry.js b/example/src/entry.js index 344d4c6..a41536c 100644 --- a/example/src/entry.js +++ b/example/src/entry.js | |||
@@ -1,11 +1,11 @@ | |||
1 | var Prelude = require('Prelude'); | 1 | var Prelude = require('Prelude'); |
2 | 2 | ||
3 | var test = require('./Test'); | 3 | var test = require('./Test.purs'); |
4 | 4 | ||
5 | var foo = require('./Foo'); | 5 | var foo = require('./Foo.purs'); |
6 | 6 | ||
7 | var baz = require('./Foo/Baz'); | 7 | var baz = require('./Foo/Baz.purs'); |
8 | 8 | ||
9 | var bar = require('./Foo/Bar'); | 9 | var bar = require('./Foo/Bar.purs'); |
10 | 10 | ||
11 | console.log(Prelude, test, foo, baz, bar); | 11 | console.log(Prelude, test, foo, baz, bar); |
diff --git a/example/webpack.config.js b/example/webpack.config.js index 9294904..1a0eef6 100644 --- a/example/webpack.config.js +++ b/example/webpack.config.js | |||
@@ -2,7 +2,7 @@ var path = require('path'); | |||
2 | 2 | ||
3 | var srcs = ['src[]=bower_components/purescript-*/src/**/*.purs', 'src[]=src/**/*.purs']; | 3 | var srcs = ['src[]=bower_components/purescript-*/src/**/*.purs', 'src[]=src/**/*.purs']; |
4 | 4 | ||
5 | var ffis = ['ffi[]=bower_components/purescript-*/src/**/*.js']; | 5 | var ffis = ['ffi[]=bower_components/purescript-*/src/**/*.js', 'ffi[]=src/**/*FFI.js']; |
6 | 6 | ||
7 | var output = 'output'; | 7 | var output = 'output'; |
8 | 8 | ||
@@ -22,7 +22,7 @@ var config | |||
22 | , loader: 'purs-loader?output=' + output + '&' + srcs.concat(ffis).join('&') | 22 | , loader: 'purs-loader?output=' + output + '&' + srcs.concat(ffis).join('&') |
23 | } ] } | 23 | } ] } |
24 | , resolve: { modulesDirectories: modulesDirectories | 24 | , resolve: { modulesDirectories: modulesDirectories |
25 | , extensions: ['', '.js', '.purs'] | 25 | , extensions: ['', '.js'] |
26 | } | 26 | } |
27 | , resolveLoader: { root: path.join(__dirname, 'node_modules') } | 27 | , resolveLoader: { root: path.join(__dirname, 'node_modules') } |
28 | } | 28 | } |