Skip to content

Commit

Permalink
v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
solvedDev committed Sep 29, 2022
1 parent d4f02a5 commit d5b2da0
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 12 deletions.
3 changes: 2 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"importMap": "importMap.json",
"tasks": {
"install": "deno install -A --reload -f -n dash_compiler ./mod.ts",
"install": "deno install -A -f -n dash_compiler ./mod.ts",
"install:full": "deno install -A --reload -f -n dash_compiler ./mod.ts",
"build": "deno task build:apple-x86 && deno task build:apple-aarch64 && deno task build:windows-x86",
"build:apple-x86": "deno compile --target x86_64-apple-darwin --output ./executables/dash-apple-x64 -A ./mod.ts",
Expand Down
6 changes: 6 additions & 0 deletions importMap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"imports": {
"dash-compiler": "../dash-compiler/dist/dash-compiler.bundled.es.js",
"mc-project-core": "npm:mc-project-core"
}
}
3 changes: 2 additions & 1 deletion src/CLI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ export class CLI {
const outFs = out ? new DenoFileSystem(out) : undefined

const dash = new Dash(this.fs, outFs, {
config: './config.json',
config: path.join(Deno.cwd(), './config.json'),
compilerConfig: compilerConfig
? path.join(Deno.cwd(), compilerConfig)
: undefined,
packType: <any>new PackTypeImpl(undefined),
fileType: <any>new FileTypeImpl(undefined, isMatch),
mode,
verbose: true,

requestJsonData: (dataPath: string) =>
fetch(
Expand Down
20 changes: 17 additions & 3 deletions src/FileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export class DenoFileSystem extends FileSystem {
return new File([fileData], path.basename(filePath))
}
async writeFile(filePath: string, content: string | Uint8Array) {
await Deno.mkdir(path.dirname(this.resolvePath(filePath)), {
const dirPath = path.dirname(this.resolvePath(filePath))

await Deno.mkdir(dirPath, {
recursive: true,
})

Expand All @@ -47,8 +49,20 @@ export class DenoFileSystem extends FileSystem {

return entries
}
async mkdir(path: string): Promise<void> {
await Deno.mkdir(this.resolvePath(path), { recursive: true })
async copyFile(from: string, to: string, destFs = this) {
// Fallback to slow path if destination fs !== this
if (destFs !== this) return super.copyFile(from, to, destFs)

const transformedTo = this.resolvePath(to)
const dirPath = path.dirname(transformedTo)
await Deno.mkdir(dirPath, {
recursive: true,
})

await Deno.copyFile(this.resolvePath(from), transformedTo)
}
async mkdir(dirPath: string): Promise<void> {
await Deno.mkdir(this.resolvePath(dirPath), { recursive: true })
}
async lastModified(filePath: string) {
return (
Expand Down
15 changes: 8 additions & 7 deletions src/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ export {
FileType,
PackType,
ProjectConfig,
} from 'https://cdn.skypack.dev/mc-project-core?dts'
export { isMatch } from 'https://raw.githubusercontent.com/bridge-core/common-utils/main/src/glob/isMatch.ts'
// @deno-types="https://cdn.skypack.dev/-/dash-compiler@v0.9.26-rtDMyl7gGAKD0gZPrwEG/dist=es2019,mode=types/dist/main.d.ts"
type IFileType,
} from 'https://esm.sh/mc-project-core@0.3.21'
export { isMatch } from 'https://esm.sh/bridge-common-utils@0.3.3'
// @deno-types="https://esm.sh/dash-compiler@0.10.4"
export {
Dash,
FileSystem,
initRuntimes,
} from 'https://raw.githubusercontent.com/bridge-core/dash-compiler/main/dist/dash-compiler.bundled.es.js'
export { default as json5 } from 'https://cdn.skypack.dev/json5'
export { debounce } from 'https://cdn.skypack.dev/lodash?dts'
export { default as json5 } from 'https://esm.sh/json5@2.2.1'
export { debounce } from 'https://deno.land/std@0.156.0/async/mod.ts?s=debounce'
import { default as dashPackageJson } from 'https://raw.githubusercontent.com/bridge-core/dash-compiler/main/package.json' assert { type: 'json' }

let swcVersion = dashPackageJson.dependencies['@swc/wasm-web']
if(swcVersion.startsWith('^')) swcVersion = swcVersion.slice(1)
if (swcVersion.startsWith('^')) swcVersion = swcVersion.slice(1)

export {swcVersion}
export { swcVersion }

0 comments on commit d5b2da0

Please sign in to comment.