Skip to content

Commit

Permalink
package.json updated for babel exports
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsboost committed Aug 7, 2024
1 parent 7221c80 commit 5d055fd
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 91 deletions.
Binary file modified .DS_Store
Binary file not shown.
153 changes: 78 additions & 75 deletions go/dist/App.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions go/dist/App.min.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion go/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ <h2 class="text-[#ffffff00]">kodeWeave is your on the go coding playground! Desi
<div id="app" class="absolute inset-0"></div>

<!-- Load Application Script -->
<!-- <script id="appScript" src="src/App.js"></script> -->
<!-- <script id="appScript" src="src/App.js"></script>
<script id="appScript" src="src/editor.js"></script> -->
<script src="dist/App.min.js"></script>
<script src="https://storage.googleapis.com/workbox-cdn/releases/6.4.1/workbox-sw.js"></script>
<script>
Expand Down
Binary file modified go/libraries/.DS_Store
Binary file not shown.
Binary file added go/libraries/tailwind/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion go/libraries/tailwind/tailwind-mod-noreset.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions go/libraries/tailwind/tailwind-mod.min.js

Large diffs are not rendered by default.

29 changes: 19 additions & 10 deletions go/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -1875,6 +1875,8 @@ async function compileCode(detect) {
try {
if (detect === 'html') {
switch (project.html_pre_processor) {
case 'html':
return project.html;
case 'markdown':
return marked.parse(project.html);
case 'jade':
Expand All @@ -1896,6 +1898,8 @@ async function compileCode(detect) {

if (detect === 'css') {
switch (project.css_pre_processor) {
case 'css':
return project.css;
case 'stylus':
return stylus.render(project.css);
case 'less':
Expand All @@ -1913,6 +1917,8 @@ async function compileCode(detect) {

if (detect === 'javascript') {
switch (project.javascript_pre_processor) {
case 'javascript':
return project.javascript;
case 'babel':
if (typeof Babel === 'undefined') {
await loadScript("libraries/preprocessors/babel.min.js");
Expand Down Expand Up @@ -2710,7 +2716,10 @@ export default {
},
plugins: [
${project.javascript_pre_processor === 'typescript' ? 'typescript(),' : ''}
${project.javascript_pre_processor === 'babel' ? 'babel({ exclude: "node_modules/**" }),' : ''}
${project.javascript_pre_processor === 'babel' ? `babel({
exclude: "node_modules/**",
presets: ["@babel/preset-env", "@babel/preset-react"]
}),` : ''}
terser() // minifies the JavaScript
]
};`;
Expand Down Expand Up @@ -2763,7 +2772,7 @@ export default {
"type": "module",
"scripts": {
${project.css.trim() !== '' ? `"build:css": "postcss src/styles.css -o dist/styles.min.css",
` : ''}"build:js": "rollup -c && terser ${rollupInput} -o dist/script.min.js",
` : ''}"build:js": "rollup -c",
"build": "${project.css.trim() !== '' ? 'npm run build:css && ' : ''}npm run build:js",
"serve": "http-server -c-1 -p 8081"
},
Expand Down Expand Up @@ -2899,14 +2908,14 @@ ${project.description}`;
let minifiedCSS = minifyCSS(await compileCode('css'));

// Add style.css
if (project.css_pre_processor === 'css') zip.file('src/style.css', project.css);
if (project.css_pre_processor === 'css') zip.file('dist/style.css', project.css);
if (project.css_pre_processor === 'stylus') zip.file('src/style.styl', project.css);
if (project.css_pre_processor === 'stylus') zip.file('dist/style.css', minifiedCSS);
if (project.css_pre_processor === 'less') zip.file('src/style.less', project.css);
if (project.css_pre_processor === 'less') zip.file('dist/style.css', iframe.contentDocument.getElementById('aeoibrfa1').textContent);
if (project.css_pre_processor === 'sass') zip.file('src/style.scss', project.css);
if (project.css_pre_processor === 'sass') zip.file('dist/style.css', minifiedCSS);
zip.file('src/style.css', project.css);
zip.file('dist/style.css', minifiedCSS);
// if (project.css_pre_processor === 'stylus') zip.file('src/style.styl', project.css);
// if (project.css_pre_processor === 'stylus') zip.file('dist/style.css', minifiedCSS);
// if (project.css_pre_processor === 'less') zip.file('src/style.less', project.css);
// if (project.css_pre_processor === 'less') zip.file('dist/style.css', iframe.contentDocument.getElementById('aeoibrfa1').textContent);
// if (project.css_pre_processor === 'sass') zip.file('src/style.scss', project.css);
// if (project.css_pre_processor === 'sass') zip.file('dist/style.css', minifiedCSS);

async function minifyJS(jsCode) {
// detect if terser exists
Expand Down

0 comments on commit 5d055fd

Please sign in to comment.