1.0.61 • Published 3 years ago

@hyext/compile v1.0.61

Weekly downloads
52
License
ISC
Repository
-
Last release
3 years ago

hyext-compile

A compiler for hyminapp, it can compile any files to any where by strategy you use.

Installation

npm install --save-dev  @hyext/compile

Modules

  • compile.feature

    • transformCss2Js(code), transform the css code to js code, return transformed code
    • transformStylesheet(code), replace jsx className to Styleheet, return transformed code
  • compile.strategy it is internal strategy used by Compiler

    • transformStyle a strategy for miniapp code to rn code, if you want design own strategy, you should follow as appoint
    interface BeProcessFile = {
      contents: Buffer,
    }
    
    // process file of special ext
    function compileProcessFn(file: BeProcessFile, filePath:String) {
        return new Promise((resolve) => {
          let code = file.contents.toString()
          let processedCode = transform(code) // the transform fn of you design
          file.contents = Buffer.from(processedCode)
          resolve(file)
        })
      }
    
    interface ProcssStrategy = {
      fileExtName:(js|jsx|css|...): fn
    }
    
    const strategy:ProcssStrategy = { js: compileProcessFn }
  • compile.Compiler The constructor of compiler, it can compile file from local to other place, and offer hot replace.
    • constructor(type, compileStrategy)
      • type string, the type of compiler
      • compileStrategy object, the compilestrategy
    • instance
      • compiler.assets(from, to) the files be processed from raw place to other place
        • from file path (absolute)
        • to file path (absolute or relative)
      • compiler.watch() watch raw files change, and imediately compile to distination, you should call it after call compiler.assets.
      • compiler.compile(file, filePath) compile single file, and return modified file obj
    interface ProcessFile = {
      contents: Buffer,
    }
    
    compiler.compile(file: ProcessFile, filePath: String): ProcessFile
1.0.61

3 years ago

1.0.60

3 years ago

1.0.60-alpha.0

3 years ago

1.0.59

3 years ago

1.0.58

3 years ago

1.0.57

3 years ago

1.0.56

3 years ago

1.0.55

3 years ago

1.0.54

4 years ago

1.0.53

4 years ago

1.0.52

4 years ago

1.0.50

4 years ago

1.0.49

5 years ago

1.0.48

5 years ago

1.0.47

5 years ago

1.0.46

5 years ago

1.0.45

5 years ago

1.0.44

5 years ago

1.0.43

5 years ago

1.0.42

5 years ago

1.0.41

5 years ago

1.0.40

5 years ago

1.0.39

5 years ago

1.0.38

5 years ago

1.0.37

5 years ago

1.0.36

5 years ago

1.0.35

5 years ago

1.0.34

5 years ago

1.0.33

5 years ago

1.0.32

5 years ago

1.0.31

5 years ago

1.0.30

5 years ago

1.0.29

5 years ago

1.0.28

5 years ago

1.0.27

5 years ago

1.0.24

5 years ago

1.0.22

5 years ago

1.0.23

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.10

6 years ago