xpine 0.0.15 → 0.0.17

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.
package/TODO CHANGED
@@ -1 +1,2 @@
1
- - npx create-xpine-app
1
+ - static files from a +config.ts file in a folder (similar to vike)
2
+ - with a method of getting a list of file paths to feed into dynamic slugs, e.g. post/[id] slugs
package/dist/index.js CHANGED
@@ -71,13 +71,8 @@ function convertEntryPointsToSingleFile(entryPoints, tempWritePath) {
71
71
  entryPoints.map((entry) => `import "${entry}"`).join(";\n")
72
72
  );
73
73
  }
74
- function removeClientScriptInTSXFile(pathName) {
74
+ function removeClientScriptInTSXFile(pathName, source) {
75
75
  const content = fs.readFileSync(pathName, "utf-8");
76
- const source = ts.createSourceFile(
77
- pathName,
78
- content,
79
- ts.ScriptTarget.Latest
80
- );
81
76
  let toRemoveFrom;
82
77
  let clientDataStart;
83
78
  const clientImportsToHoist = [];
@@ -119,6 +114,17 @@ function removeClientScriptInTSXFile(pathName) {
119
114
  clientDataStart
120
115
  };
121
116
  }
117
+ function createStaticFile(pathName, source) {
118
+ source.forEachChild((child) => {
119
+ if (child.kind === ts.SyntaxKind.ExpressionStatement) {
120
+ const text = child.getText(source);
121
+ const cleanedText = text.replace(/["';]/g, "");
122
+ if (cleanedText === "xpine-static") {
123
+ console.log("make this file static", pathName);
124
+ }
125
+ }
126
+ });
127
+ }
122
128
 
123
129
  // src/scripts/build.ts
124
130
  import { globSync } from "glob";
@@ -196,6 +202,20 @@ var config = {
196
202
  ...userConfig
197
203
  };
198
204
 
205
+ // src/util/postcss/remove-layers.ts
206
+ var plugin = (opts = {}) => {
207
+ return {
208
+ postcssPlugin: "postcssRemoveLayers",
209
+ AtRule: {
210
+ layer: (atRule) => {
211
+ atRule.replaceWith(atRule.nodes);
212
+ }
213
+ }
214
+ };
215
+ };
216
+ plugin.postcss = true;
217
+ var remove_layers_default = plugin;
218
+
199
219
  // src/scripts/build.ts
200
220
  var extensions = [".ts", ".tsx"];
201
221
  var packageJson = JSON.parse(fs2.readFileSync(config.packageJsonPath, "utf-8"));
@@ -257,7 +277,14 @@ async function buildAppFiles(files, isDev) {
257
277
  name: "insert-html-banner-and-remove-client-scripts",
258
278
  setup(build2) {
259
279
  build2.onLoad({ filter: /.tsx/ }, (args) => {
260
- const cleanedContent = removeClientScriptInTSXFile(args.path);
280
+ const content = fs2.readFileSync(args.path, "utf-8");
281
+ const source = ts2.createSourceFile(
282
+ args.path,
283
+ content,
284
+ ts2.ScriptTarget.Latest
285
+ );
286
+ const cleanedContent = removeClientScriptInTSXFile(args.path, source);
287
+ createStaticFile(args.path, source);
261
288
  const htmlImportStart = "import { html } from 'xpine';\n";
262
289
  const newContent = `${htmlImportStart}${cleanedContent.content}`;
263
290
  componentData.push({
@@ -388,7 +415,7 @@ async function buildCSS() {
388
415
  const cssFiles = globSync(config.srcDir + "/**/*.css");
389
416
  for (const file of cssFiles) {
390
417
  const fileContents = fs2.readFileSync(file, "utf-8");
391
- const result = await postcss([tailwindPostcss()]).process(fileContents, { from: file });
418
+ const result = await postcss([tailwindPostcss(), remove_layers_default()]).process(fileContents, { from: file });
392
419
  const newPath = file.replace(config.srcDir, config.distDir);
393
420
  fs2.ensureFileSync(newPath);
394
421
  fs2.writeFileSync(newPath, result.css);
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/scripts/build.ts"],"names":[],"mappings":"AAyBA,wBAAsB,QAAQ,CAAC,KAAK,UAAQ,iBAa3C;AA4LD,wBAAsB,QAAQ,kBAW7B;AAGD,wBAAsB,yBAAyB,kBAgB9C;AAOD,wBAAsB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,KAAK,EAAE,eAAe,WAAkB,iBAahH"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/scripts/build.ts"],"names":[],"mappings":"AA0BA,wBAAsB,QAAQ,CAAC,KAAK,UAAQ,iBAa3C;AA4LD,wBAAsB,QAAQ,kBAW7B;AAGD,wBAAsB,yBAAyB,kBAgB9C;AAOD,wBAAsB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,KAAK,EAAE,eAAe,WAAkB,iBAahH"}
@@ -66,13 +66,8 @@ function convertEntryPointsToSingleFile(entryPoints, tempWritePath) {
66
66
  entryPoints.map((entry) => `import "${entry}"`).join(";\n")
67
67
  );
68
68
  }
69
- function removeClientScriptInTSXFile(pathName) {
69
+ function removeClientScriptInTSXFile(pathName, source) {
70
70
  const content = fs.readFileSync(pathName, "utf-8");
71
- const source = ts.createSourceFile(
72
- pathName,
73
- content,
74
- ts.ScriptTarget.Latest
75
- );
76
71
  let toRemoveFrom;
77
72
  let clientDataStart;
78
73
  const clientImportsToHoist = [];
@@ -114,6 +109,17 @@ function removeClientScriptInTSXFile(pathName) {
114
109
  clientDataStart
115
110
  };
116
111
  }
112
+ function createStaticFile(pathName, source) {
113
+ source.forEachChild((child) => {
114
+ if (child.kind === ts.SyntaxKind.ExpressionStatement) {
115
+ const text = child.getText(source);
116
+ const cleanedText = text.replace(/["';]/g, "");
117
+ if (cleanedText === "xpine-static") {
118
+ console.log("make this file static", pathName);
119
+ }
120
+ }
121
+ });
122
+ }
117
123
 
118
124
  // src/scripts/build.ts
119
125
  import { globSync } from "glob";
@@ -191,6 +197,20 @@ var config = {
191
197
  ...userConfig
192
198
  };
193
199
 
200
+ // src/util/postcss/remove-layers.ts
201
+ var plugin = (opts = {}) => {
202
+ return {
203
+ postcssPlugin: "postcssRemoveLayers",
204
+ AtRule: {
205
+ layer: (atRule) => {
206
+ atRule.replaceWith(atRule.nodes);
207
+ }
208
+ }
209
+ };
210
+ };
211
+ plugin.postcss = true;
212
+ var remove_layers_default = plugin;
213
+
194
214
  // src/scripts/build.ts
195
215
  var extensions = [".ts", ".tsx"];
196
216
  var packageJson = JSON.parse(fs2.readFileSync(config.packageJsonPath, "utf-8"));
@@ -252,7 +272,14 @@ async function buildAppFiles(files, isDev) {
252
272
  name: "insert-html-banner-and-remove-client-scripts",
253
273
  setup(build2) {
254
274
  build2.onLoad({ filter: /.tsx/ }, (args) => {
255
- const cleanedContent = removeClientScriptInTSXFile(args.path);
275
+ const content = fs2.readFileSync(args.path, "utf-8");
276
+ const source = ts2.createSourceFile(
277
+ args.path,
278
+ content,
279
+ ts2.ScriptTarget.Latest
280
+ );
281
+ const cleanedContent = removeClientScriptInTSXFile(args.path, source);
282
+ createStaticFile(args.path, source);
256
283
  const htmlImportStart = "import { html } from 'xpine';\n";
257
284
  const newContent = `${htmlImportStart}${cleanedContent.content}`;
258
285
  componentData.push({
@@ -383,7 +410,7 @@ async function buildCSS() {
383
410
  const cssFiles = globSync(config.srcDir + "/**/*.css");
384
411
  for (const file of cssFiles) {
385
412
  const fileContents = fs2.readFileSync(file, "utf-8");
386
- const result = await postcss([tailwindPostcss()]).process(fileContents, { from: file });
413
+ const result = await postcss([tailwindPostcss(), remove_layers_default()]).process(fileContents, { from: file });
387
414
  const newPath = file.replace(config.srcDir, config.distDir);
388
415
  fs2.ensureFileSync(newPath);
389
416
  fs2.writeFileSync(newPath, result.css);
@@ -73,13 +73,8 @@ function convertEntryPointsToSingleFile(entryPoints, tempWritePath) {
73
73
  entryPoints.map((entry) => `import "${entry}"`).join(";\n")
74
74
  );
75
75
  }
76
- function removeClientScriptInTSXFile(pathName) {
76
+ function removeClientScriptInTSXFile(pathName, source) {
77
77
  const content = fs.readFileSync(pathName, "utf-8");
78
- const source = ts.createSourceFile(
79
- pathName,
80
- content,
81
- ts.ScriptTarget.Latest
82
- );
83
78
  let toRemoveFrom;
84
79
  let clientDataStart;
85
80
  const clientImportsToHoist = [];
@@ -121,6 +116,17 @@ function removeClientScriptInTSXFile(pathName) {
121
116
  clientDataStart
122
117
  };
123
118
  }
119
+ function createStaticFile(pathName, source) {
120
+ source.forEachChild((child) => {
121
+ if (child.kind === ts.SyntaxKind.ExpressionStatement) {
122
+ const text = child.getText(source);
123
+ const cleanedText = text.replace(/["';]/g, "");
124
+ if (cleanedText === "xpine-static") {
125
+ console.log("make this file static", pathName);
126
+ }
127
+ }
128
+ });
129
+ }
124
130
 
125
131
  // src/scripts/build.ts
126
132
  import { globSync } from "glob";
@@ -198,6 +204,20 @@ var config = {
198
204
  ...userConfig
199
205
  };
200
206
 
207
+ // src/util/postcss/remove-layers.ts
208
+ var plugin = (opts = {}) => {
209
+ return {
210
+ postcssPlugin: "postcssRemoveLayers",
211
+ AtRule: {
212
+ layer: (atRule) => {
213
+ atRule.replaceWith(atRule.nodes);
214
+ }
215
+ }
216
+ };
217
+ };
218
+ plugin.postcss = true;
219
+ var remove_layers_default = plugin;
220
+
201
221
  // src/scripts/build.ts
202
222
  var extensions = [".ts", ".tsx"];
203
223
  var packageJson = JSON.parse(fs2.readFileSync(config.packageJsonPath, "utf-8"));
@@ -259,7 +279,14 @@ async function buildAppFiles(files, isDev) {
259
279
  name: "insert-html-banner-and-remove-client-scripts",
260
280
  setup(build2) {
261
281
  build2.onLoad({ filter: /.tsx/ }, (args) => {
262
- const cleanedContent = removeClientScriptInTSXFile(args.path);
282
+ const content = fs2.readFileSync(args.path, "utf-8");
283
+ const source = ts2.createSourceFile(
284
+ args.path,
285
+ content,
286
+ ts2.ScriptTarget.Latest
287
+ );
288
+ const cleanedContent = removeClientScriptInTSXFile(args.path, source);
289
+ createStaticFile(args.path, source);
263
290
  const htmlImportStart = "import { html } from 'xpine';\n";
264
291
  const newContent = `${htmlImportStart}${cleanedContent.content}`;
265
292
  componentData.push({
@@ -390,7 +417,7 @@ async function buildCSS() {
390
417
  const cssFiles = globSync(config.srcDir + "/**/*.css");
391
418
  for (const file of cssFiles) {
392
419
  const fileContents = fs2.readFileSync(file, "utf-8");
393
- const result = await postcss([tailwindPostcss()]).process(fileContents, { from: file });
420
+ const result = await postcss([tailwindPostcss(), remove_layers_default()]).process(fileContents, { from: file });
394
421
  const newPath = file.replace(config.srcDir, config.distDir);
395
422
  fs2.ensureFileSync(newPath);
396
423
  fs2.writeFileSync(newPath, result.css);
@@ -0,0 +1,8 @@
1
+ import { PluginCreator } from "postcss";
2
+ declare namespace plugin {
3
+ interface Options {
4
+ }
5
+ }
6
+ declare const plugin: PluginCreator<plugin.Options>;
7
+ export default plugin;
8
+ //# sourceMappingURL=remove-layers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-layers.d.ts","sourceRoot":"","sources":["../../../../src/util/postcss/remove-layers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,kBAAU,MAAM,CAAC;IACf,UAAiB,OAAO;KAEvB;CACF;AAID,QAAA,MAAM,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,OAAO,CASxC,CAAC;AAGH,eAAe,MAAM,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xpine",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "main": "dist/index.js",
5
5
  "dependencies": {
6
6
  "@aws-sdk/client-secrets-manager": "^3.758.0",
@@ -25,12 +25,15 @@
25
25
  "url": "git://github.com/dan-caldwell/xpine.git"
26
26
  },
27
27
  "scripts": {
28
- "build": "tsx ./src/scripts/build-module.ts && npm run build:types",
29
- "build:types": "sh ./src/scripts/build-types.sh"
28
+ "build": "tsx ./src/scripts/run-build-module.ts && npm run build:types",
29
+ "build:types": "sh ./src/scripts/build-types.sh",
30
+ "xpine-dev-server": "tsx ./src/scripts/xpine-dev-server.ts"
30
31
  },
31
32
  "bin": {
32
33
  "xpine-build": "dist/src/scripts/xpine-build.js",
33
- "xpine-dev": "dist/src/scripts/xpine-dev.js"
34
+ "xpine-dev": "dist/src/scripts/xpine-dev.js",
35
+ "xpine-build:debug": "tsx ./src/scripts/xpine-build.ts",
36
+ "xpine-dev:debug": "tsx ./src/scripts/xpine-dev.ts"
34
37
  },
35
38
  "types": "dist/index.d.ts",
36
39
  "type": "module",