From 18c66709a0e0119b7dd0dbb01a268e502bfc28c7 Mon Sep 17 00:00:00 2001 From: Vladimir Kharlampidi Date: Wed, 7 Sep 2022 11:09:49 +0300 Subject: [PATCH] feat(solid): keep solid components incompiled fixes #5943 --- scripts/build-solid.js | 3 +++ scripts/build-svelte.js | 24 ------------------------ 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/scripts/build-solid.js b/scripts/build-solid.js index 8f7589cf4..cefe8185e 100644 --- a/scripts/build-solid.js +++ b/scripts/build-solid.js @@ -1,4 +1,5 @@ import execSh from 'exec-sh'; +import fs from 'fs-extra'; import { outputDir } from './utils/output-dir.js'; import { addBannerToFile } from './utils/banner.js'; /* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */ @@ -9,5 +10,7 @@ async function buildSolid() { `npx babel --config-file ./scripts/babel/babel.config.solid.json src/solid --out-dir ${outputDir}/solid`, ); await addBannerToFile(`./${outputDir}/solid/swiper-solid.js`, 'SolidJS'); + await fs.copyFile('./src/solid/swiper.js', `./${outputDir}/solid/swiper.js`); + await fs.copyFile('./src/solid/swiper-slide.js', `./${outputDir}/solid/swiper-slide.js`); } export default buildSolid; diff --git a/scripts/build-svelte.js b/scripts/build-svelte.js index 50e83d03a..14764999c 100644 --- a/scripts/build-svelte.js +++ b/scripts/build-svelte.js @@ -6,33 +6,9 @@ import { addBannerToFile } from './utils/banner.js'; export default async function buildSvelte() { await exec.promise(`npx babel src/svelte --out-dir ${outputDir}/svelte`); await addBannerToFile(`./${outputDir}/svelte/swiper-svelte.js`, 'Svelte'); - /* DON'T TRANSFORM SVELTE FILES - // Transform svelte files - let swiper = await fs.readFile('./src/svelte/swiper.svelte', 'utf8'); - const swiperResult = svelte.compile(swiper, { - format: 'esm', - filename: 'swiper.svelte', - }); - swiper = swiperResult.js.code; - await fs.writeFile(`./${outputDir}/svelte/swiper.js`, swiper); - - let swiperSlide = await fs.readFile('./src/svelte/swiper-slide.svelte', 'utf8'); - const swiperSlideResult = svelte.compile(swiperSlide, { - format: 'esm', - filename: 'swiper.svelte', - }); - swiperSlide = swiperSlideResult.js.code; - await fs.writeFile(`./${outputDir}/svelte/swiper-slide.js`, swiperSlide); - */ await fs.copyFile('./src/svelte/swiper.svelte', `./${outputDir}/svelte/swiper.svelte`); await fs.copyFile( './src/svelte/swiper-slide.svelte', `./${outputDir}/svelte/swiper-slide.svelte`, ); - // try { - // await fs.remove(`./${outputDir}/svelte/swiper-slide.svelte`); - // await fs.remove(`./${outputDir}/svelte/swiper.svelte`); - // } catch (err) { - // // no files - // } }