• Stars
    star
    125
  • Rank 286,335 (Top 6 %)
  • Language Haxe
  • License
    MIT License
  • Created almost 12 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple Haxe Macro Helpers that let you do or get things at compile-time.

Compile Time

Simple Haxe Macro Helpers that let you do or get things at compile-time.

Usage

// Compile date and time

var date = CompileTime.buildDate();						// Equivalent of writing `new Date(2012,11,25,20,48,15);`
var dateAsString = CompileTime.buildDateString();		// A string saying "2012-12-25 20:48:15"

// Compile git commit sha

var sha = CompileTime.buildGitCommitSha();
//'104ad4e'

// Read a file

var file = CompileTime.readFile("README.md"); // will be compiled as an ordinary string in your code

// Read a file and use String Interpolation

var name="Jason", age=25;
var greeting = CompileTime.interpolateFile("test.txt");
	// Reads the contents of test.txt, and interpolates local values, similar to single quote string interpolation
	// Same as writing greeting = 'Hello my name is $name and I am ${age-5} years old'
	// Result will be "Hello my name is Jason and I am 20 years old";

// Import a whole package to make sure it's included in compilation.  Does not affect dead-code-elimination.

CompileTime.importPackage("server.controllers");

// Read a file, and check it is valid XML.  Will give a compile time error if it's not XML.

var xmlString = CompileTime.readXmlFile("haxelib.xml");	// Will insert it as a String.  
Xml.parse(xmlString);

// Read a file, and check it is valid JSON.  Will give a compile time error if it's not valid Json.

var jsonString = CompileTime.readJsonFile("test.json"); // Inserts the contents of text.json as a String

// Parse the JSON file, so it is inserted as an object declaration into the code.
// This has the added benefit of giving you compile time typing and autocompletion.

var jsonObject = CompileTime.parseJsonFile("test.json");
var typedJsonObject:Person = CompileTime.parseJsonFile("test.json"); // Same as above, but check the result matches a typedef

// Parse the JSON file, so it is inserted as an object declaration into the code.
// This has the added benefit of giving you compile time typing and autocompletion.

var yamlObject = CompileTime.parseYamlFile("test.yaml");
var yamlObject:Person = CompileTime.parseYamlFile("test.yaml"); // Check the type is correct.

// Read a markdown file, convert to HTML and check the result is valid XML.  Will give a compile time error if it doesn't validate.

var htmlString = CompileTime.readMarkdownFile("test.md");	// Will insert it as a HTML String.  
Xml.parse(htmlString);

// Get lists of classes that have been compiled

// Returns a list of all the classes in the "my.package" package, including sub-packages
CompileTime.getAllClasses("my.package");

// Returns a list of only the classes in the "my.package" package, so not including sub-packages
CompileTime.getAllClasses("my.package", false);

// Returns a list of all the classes that inherit MySuperClass, no matter what package
CompileTime.getAllClasses(MySuperClass);

// Returns a list of all the classes in the "my.package" package that inherit MySuperClass.
CompileTime.getAllClasses("my.package", MySuperClass);

// Returns a list of all the classes that implement MyInterface, no matter what package.
CompileTime.getAllClasses(MyInterface);

// Returns a list of all the classes in the "my.package" package that implement MyInterface.
CompileTime.getAllClasses("my.package", MyInterface);

More Repositories

1

hxrandom

Extremely simple helper library to easy picking random numbers in Haxe.
Haxe
46
star
2

webpack-haxe-loader

Webpack loader for the Haxe programming language.
JavaScript
38
star
3

dodrugs

A macro-powered dependency injector for Haxe
Haxe
29
star
4

cleversort

Haxe macro for helping to sort arrays based on multiple properties with a very simple syntax
Haxe
25
star
5

hvm

Haxe Version Manager (compile and switch between different Haxe versions easily)
Haxe
21
star
6

mdown

Markdown Library for Haxe 2
Haxe
15
star
7

vocally

A friendly wrapper around the Web Speech API (VoiceRecognition and VoiceSynthesis) for JavaScript.
Haxe
14
star
8

OneLineHaxe

A collection of install scripts that can be called with a single line.
Shell
13
star
9

Haxe-NodeJS-Remoting-Demo

A working sample of Haxe Remoting from Browser JS to Server NodeJS
Haxe
10
star
10

hxpushstate

PushState wrapper library for haxe.
Haxe
9
star
11

Ext-JS-4.0-externs-for-Haxe

Unmaintained externs for ExtJS. Ask on the Haxe mailing list to see if there are more up-to-date externs.
Haxe
9
star
12

PBKDF2-Haxe

Haxe implementation of the PBKDF2 Algorithm for password hashing
Haxe
8
star
13

objectinit

A simple macro for helping with Haxe object initialization. Makes it shorter, prettier, and still type safe.
Haxe
8
star
14

OpenRoadFTP

A web based file browser with a really nice interface. Uses haxe, php, ftp, jquery.
PHP
6
star
15

ufront-tutorial-Q-A

Basic haxe/ufront tutorial: Question and Answers app
PHP
6
star
16

smalluniverse

Work out loud repo for Jason's dream web framework
Haxe
4
star
17

haxe-brackets-extension

An extension for Adobe Brackets that provides Haxe related features.
Haxe
4
star
18

UFTool

A command line tool to help you get going with UFront - a MVC server framework for haxe web apps.
Haxe
4
star
19

tora-installation-helper

Installation helper for getting mod_tora or mod_neko working on Ubuntu 14.04 64bit. (Neko, Haxe)
Shell
3
star
20

ufblog

A demo ufront app - a simple blog system
Haxe
3
star
21

AutoForm

Library for haxeJS that automatically creates a form based on a model. Uses Metadata to decide which elements to use.
Haxe
3
star
22

color-system-showcase

A simple color system showcase that shows base colours, tints, shades, contrast levels, copy-pastable color values, nearest-shade finder, and color-contrast checker. Based on Culture Amp's Kaizen design system. Built with React, available as an enthraler.
JavaScript
3
star
23

School-Logon

A simple PyQT program that allows a user to login to set SMB shares, useful for a school environment.
Python
2
star
24

beanhx

Haxe externs for the bean.js Javascript library
JavaScript
2
star
25

modelschool

A collection of Haxe database models, import scripts, and core files used by apps in K-12 schools.
Haxe
2
star
26

voseapp

Once again, the video editing app for Vose Seminary. This time going for NME / Neko / StablexUI, rather than web based. Should be much more sensible.
Haxe
1
star
27

BaseHx

A web application framework for haxe
Haxe
1
star
28

identifiedhair

Super simple website for identified hair
PHP
1
star
29

dtx-bootstrap

Bootstrap widgets for my detox library.
Haxe
1
star
30

PTNight

Parent Teacher Interview Night Booking System
Haxe
1
star
31

-old--Vose-Video-Node

Video production workflow for Vose Seminary.
JavaScript
1
star
32

ufront.net

The source code for the ufront.net website. This is for the site code, not the site content. See the "ufront" wiki and the "ufront-guides" repo for those.
Haxe
1
star
33

dependency-version-checker

A small node script to check dependency versions with yarn across multiple repos
TypeScript
1
star
34

HExpect

A library for haxe that allows you to monitor the output of a process and extract information using regular expressions.
Nemerle
1
star
35

OpenRoadFTP-output

This is the ready-to-run version of OpenRoadFTP, with the JS & PHP output files. For the original haxe source code, see https://github.com/jasononeil/OpenRoadFTP
PHP
1
star
36

netlify-server-side-rendering-experiment

A simple repo to experiment with Netlify deployments
JavaScript
1
star
37

School-Startup

Another utility for PWS, which executes at startup and can run things, particularly pull git updates.
Python
1
star