xpine 0.0.16 → 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";
@@ -271,7 +277,14 @@ async function buildAppFiles(files, isDev) {
271
277
  name: "insert-html-banner-and-remove-client-scripts",
272
278
  setup(build2) {
273
279
  build2.onLoad({ filter: /.tsx/ }, (args) => {
274
- 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);
275
288
  const htmlImportStart = "import { html } from 'xpine';\n";
276
289
  const newContent = `${htmlImportStart}${cleanedContent.content}`;
277
290
  componentData.push({
@@ -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";
@@ -266,7 +272,14 @@ async function buildAppFiles(files, isDev) {
266
272
  name: "insert-html-banner-and-remove-client-scripts",
267
273
  setup(build2) {
268
274
  build2.onLoad({ filter: /.tsx/ }, (args) => {
269
- 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);
270
283
  const htmlImportStart = "import { html } from 'xpine';\n";
271
284
  const newContent = `${htmlImportStart}${cleanedContent.content}`;
272
285
  componentData.push({
@@ -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";
@@ -273,7 +279,14 @@ async function buildAppFiles(files, isDev) {
273
279
  name: "insert-html-banner-and-remove-client-scripts",
274
280
  setup(build2) {
275
281
  build2.onLoad({ filter: /.tsx/ }, (args) => {
276
- 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);
277
290
  const htmlImportStart = "import { html } from 'xpine';\n";
278
291
  const newContent = `${htmlImportStart}${cleanedContent.content}`;
279
292
  componentData.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xpine",
3
- "version": "0.0.16",
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",