-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove webpack and begin replace with vite
- Loading branch information
1 parent
313adfc
commit 7d457d7
Showing
7 changed files
with
262 additions
and
4,869 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ reactR.Rcheck | |
reactR_*.tar.gz | ||
*.swp | ||
.DS_Store | ||
inst/www/react-tools/react*.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
This file was deleted.
Oops, something went wrong.
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 @@ | ||
(function(s,c){typeof exports=="object"&&typeof module<"u"?c(require("react"),require("react-dom"),require("shiny"),require("jquery")):typeof define=="function"&&define.amd?define(["react","react-dom","shiny","jquery"],c):(s=typeof globalThis<"u"?globalThis:s||self,c(s.React,s.ReactDOM,s.Shiny,s.$))})(this,function(s,c,l,u){"use strict";function o(n,t){if(typeof t=="string")return t;if(t.name[0]===t.name[0].toUpperCase()&&!n.hasOwnProperty(t.name))throw new Error("Unknown component: "+t.name);for(var i=n.hasOwnProperty(t.name)?n[t.name]:t.name,r=[i,t.attribs],e=0;e<t.children.length;e++)r.push(o(n,t.children[e]));return React.createElement.apply(React,r)}const p={widthProperty:"width",heightProperty:"height",appendPx:!1,renderOnResize:!1};function w(n){var t={};for(var i in p)t[i]=p[i];for(var i in n){if(!p.hasOwnProperty(i))throw new Error("Unrecognized option: "+i);t[i]=n[i]}return t}function h(n,t){return t.appendPx?n+"px":n}function b(n,t,i,r){var e=w(r);window.HTMLWidgets.widget({name:n,type:t,factory:function(a,d,y){var g,P={},m=function(f){e.renderOnResize&&(typeof f.tag=="object"&&(f.tag.attribs[e.widthProperty]=h(d),f.tag.attribs[e.heightProperty]=h(y)),g=f),this.instance.component=ReactDOM.render(o(i,f.tag),a)};return{instance:P,renderValue:m,resize:function(f,v){e.renderOnResize&&(d=f,y=v,m(g))}}}})}function O(n,{configuration:t,value:i}){let r=!1;t!==void 0&&(this.setInputConfiguration(n,t),r=!0),i!==void 0&&(this.setInputValue(n,i),r=!0),r&&(this.getCallback(n)(),this.render(n))}const V={receiveMessage:O,type:!1,ratePolicy:null};function I(n,t,i,r){r=Object.assign({},V,r),l.inputBindings.register(new class extends l.InputBinding{find(e){return u(e).find(n)}getValue(e){return this.getInputValue(e)}setValue(e,a,d=!1){u(e).data("callback")!==void 0&&(this.setInputValue(e,a),this.getCallback(e)(d),this.render(e))}initialize(e){u(e).data("value",JSON.parse(u(e).next().text())),u(e).data("configuration",JSON.parse(u(e).next().next().text()))}subscribe(e,a){u(e).data("callback",a),this.render(e)}unsubscribe(e){c.render(null,e)}receiveMessage(e,a){r.receiveMessage.call(this,e,a)}getType(e){if(typeof r.type=="function")return r.type.call(this,e);if(r.type===!1||typeof r.type=="string")return r.type;throw new Error("options.type must be false, a string, or a function")}getRatePolicy(){return r.ratePolicy}getInputValue(e){return u(e).data("value")}setInputValue(e,a){u(e).data("value",a)}getInputConfiguration(e){return u(e).data("configuration")}setInputConfiguration(e,a){u(e).data("configuration",a)}getCallback(e){return u(e).data("callback")}render(e){const a=s.createElement(i,{configuration:this.getInputConfiguration(e),value:this.getValue(e),setValue:this.setValue.bind(this,e),el:e});c.render(a,e)}},t)}window.reactR={reactShinyInput:I,reactWidget:b,hydrate:o}}); |
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,26 +1,12 @@ | ||
{ | ||
"devDependencies": { | ||
"@babel/core": "^7.2.2", | ||
"@babel/preset-env": "^7.3.1", | ||
"@babel/preset-react": "^7.0.0", | ||
"@rgrove/parse-xml": "^1.1.1", | ||
"babel-loader": "^8.0.5", | ||
"chai": "^4.2.0", | ||
"karma": "^3.1.4", | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-mocha": "^1.3.0", | ||
"karma-source-map-support": "^1.3.0", | ||
"karma-webpack": "^4.0.0-rc.6", | ||
"mocha": "^5.2.0", | ||
"react": "^16.8.1", | ||
"react-dom": "^16.8.1", | ||
"react-html-parser": "^2.0.2", | ||
"webpack": "^4.27.1", | ||
"webpack-cli": "^3.1.2" | ||
}, | ||
"name": "react-tools", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"test": "karma start --single-run --browsers ChromeHeadless karma.conf.js" | ||
"build": "vite build" | ||
}, | ||
"devDependencies": { | ||
"vite": "^5.0.11" | ||
}, | ||
"dependencies": {} | ||
} | ||
} |
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,27 @@ | ||
import { resolve, join } from 'path'; | ||
import { defineConfig } from 'vite'; | ||
|
||
export default defineConfig({ | ||
define: { 'process.env.NODE_ENV': '"production"' }, | ||
build: { | ||
outDir: join(__dirname, "inst/www/react-tools/"), | ||
lib: { | ||
// Could also be a dictionary or array of multiple entry points | ||
entry: resolve(__dirname, '/srcjs/react-tools.js'), | ||
name: 'reactR', | ||
// the proper extensions will be added | ||
fileName: 'react-tools', | ||
}, | ||
rollupOptions: { | ||
external: ['react', 'react-dom', 'jquery', 'shiny'], | ||
output: { | ||
globals: { | ||
'react': 'React', | ||
'react-dom': 'ReactDOM', | ||
'jquery': '$', | ||
'shiny': 'Shiny' | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); |
Oops, something went wrong.