@unvt/charites 2.1.2 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,6 +38,14 @@ export async function serve(source, options) {
38
38
  }
39
39
  const server = http.createServer(async (req, res) => {
40
40
  const url = (req.url || '').replace(/\?.*/, '');
41
+ res.setHeader('Access-Control-Allow-Origin', '*');
42
+ res.setHeader('Access-Control-Allow-Methods', 'GET,HEAD,OPTIONS');
43
+ res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
44
+ if (req.method === 'OPTIONS') {
45
+ res.statusCode = 204;
46
+ res.end();
47
+ return;
48
+ }
41
49
  if (typeof spriteOut !== 'undefined' &&
42
50
  url.match(/^\/sprite(@2x)?\.(json|png)/)) {
43
51
  res.statusCode = 200;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unvt/charites",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "charites": "dist/cli.js"
@@ -54,6 +54,14 @@ export async function serve(source: string, options: serveOptions) {
54
54
 
55
55
  const server = http.createServer(async (req, res) => {
56
56
  const url = (req.url || '').replace(/\?.*/, '')
57
+ res.setHeader('Access-Control-Allow-Origin', '*')
58
+ res.setHeader('Access-Control-Allow-Methods', 'GET,HEAD,OPTIONS')
59
+ res.setHeader('Access-Control-Allow-Headers', 'Content-Type')
60
+ if (req.method === 'OPTIONS') {
61
+ res.statusCode = 204
62
+ res.end()
63
+ return
64
+ }
57
65
 
58
66
  if (
59
67
  typeof spriteOut !== 'undefined' &&